Fix build break from 30f9233

Commit 30f9233b36 introduced a test for
Game_Mode, which does not exist, rather than Game_mode, which does
exist.  However, the test for game mode is unnecessary.  Objects of type
OBJ_NONE are always in segment_none and no object of any other type
should be in segment_none.  Use that fact to test obj->type instead of
obj->segnum during multiplayer object clobber, so that multiplayer can
overwrite unallocated objects without accessing any undefined fields and
without making object::segnum a defined field.

Fixes: 30f9233b36 ("Reverted 2e6aa0f081 and partially reverted 7064fcccba to still allow segnum and signature init for multiplayer games, keeping consistency during object sync.")
This commit is contained in:
Kp 2016-11-06 17:12:03 +00:00
parent e231fb7d3a
commit 7ccd537362
2 changed files with 1 additions and 7 deletions

View file

@ -2047,7 +2047,7 @@ static void net_udp_read_object_packet( ubyte *data )
}
if (objnum != object_none) {
auto obj = vobjptridx(objnum);
if (obj->segnum != segment_none)
if (obj->type != OBJ_NONE)
{
obj_unlink(obj);
Assert(obj->segnum == segment_none);

View file

@ -828,12 +828,6 @@ void init_objects()
free_obj_list[i] = i;
const auto &&objp = vobjptr(i);
objp->type = OBJ_NONE;
// init segment and signature for multiplayer object sync.
if (Game_Mode & GM_MULTI)
{
objp->segnum = segment_none;
objp->signature = obj_get_signature();
}
}
range_for (auto &j, Segments)