Set matcen_creator on loaded robots

This avoids a Valgrind warning for use of an uninitialized field.
This commit is contained in:
Kp 2019-07-07 22:00:02 +00:00
parent eeb310467b
commit 01eb585c7a
2 changed files with 7 additions and 4 deletions

View file

@ -365,11 +365,15 @@ static void read_object(const vmobjptr_t obj,PHYSFS_File *f,int version)
set_object_type(*obj, PHYSFSX_readByte(f));
obj->id = PHYSFSX_readByte(f);
if (obj->type == OBJ_ROBOT)
{
#if defined(DXX_BUILD_DESCENT_I)
if (obj->type == OBJ_ROBOT && get_robot_id(obj) > 23) {
set_robot_id(obj, get_robot_id(obj) % 24);
}
const auto id = get_robot_id(obj);
if (id > 23)
set_robot_id(obj, id % 24);
#endif
obj->matcen_creator = 0;
}
obj->control_type = PHYSFSX_readByte(f);
set_object_movement_type(*obj, PHYSFSX_readByte(f));
obj->render_type = PHYSFSX_readByte(f);

View file

@ -805,7 +805,6 @@ void reset_player_object()
// Clear misc
ConsoleObject->flags = 0;
ConsoleObject->matcen_creator = 0;
}