fix segfault when picking up items, fix CAO yaw not being set when initialised

This commit is contained in:
darkrose 2014-12-07 15:29:18 +10:00
parent 4a169b16c3
commit f592e2620e
2 changed files with 7 additions and 7 deletions

View File

@ -109,8 +109,6 @@ void ItemCAO::step(float dtime, ClientEnvironment *env)
if (m_node == NULL)
return;
updateVisual();
LocalPlayer *player = env->getLocalPlayer();
assert(player);
v3f rot = m_node->getRotation();
@ -153,6 +151,8 @@ void ItemCAO::initialize(const std::string &data)
m_inventorystring = deSerializeString(is);
}
updateVisual();
updateNodePos();
}
@ -496,12 +496,12 @@ void MobCAO::initialize(const std::string &data)
return;
// pos
m_position = readV3F1000(is);
pos_translator.init(m_position);
// content
m_content = readU16(is);
m_draw_type = content_mob_features(m_content).texture_display;
// yaw
m_yaw = readF1000(is);
pos_translator.init(m_position,m_yaw);
// speed
v3f speed = readV3F1000(is);
// age

View File

@ -63,7 +63,7 @@ struct SmoothTranslator
yaw_aim(0)
{}
void init(v3f vect)
void init(v3f vect, f32 yaw = 0)
{
vect_old = vect;
vect_show = vect;
@ -71,9 +71,9 @@ struct SmoothTranslator
anim_counter = 0;
anim_time = 0;
anim_time_counter = 0;
yaw_old = 0;
yaw_show = 0;
yaw_aim = 0;
yaw_old = yaw;
yaw_show = yaw;
yaw_aim = yaw;
}
void sharpen()