Add special case to make past releases not die on Dead_controlcen_object_num

All releases to date have a bug where they treat
Dead_controlcen_object_num as an int, not an object number.  Storing
object_none (0xffff) into the save file causes affected releases to
crash when treating object_none as a valid object number.

Current code correctly treats object_none as a non-object and works
correctly without this hack.  The hack is only required to get past
releases to survive destroying the reactor after loading a saved game
written by current code.

Fixes: 9125ae32cd ("Make objnum unsigned")
This commit is contained in:
Kp 2017-01-21 19:05:43 +00:00
parent 6da2b446f5
commit 2e6b5e8467

View file

@ -1171,7 +1171,7 @@ int state_save_all_sub(const char *filename, const char *desc)
PHYSFS_write(fp, &Control_center_player_been_seen, sizeof(int), 1);
PHYSFS_write(fp, &Control_center_next_fire_time, sizeof(int), 1);
PHYSFS_write(fp, &Control_center_present, sizeof(int), 1);
int dead_controlcen_object_num = Dead_controlcen_object_num;
int dead_controlcen_object_num = Dead_controlcen_object_num == object_none ? -1 : Dead_controlcen_object_num;
PHYSFS_write(fp, &dead_controlcen_object_num, sizeof(int), 1);
// Save the AI state