Add special case to make past releases not die on MarkerObject
All releases to date have a bug where they treat MarkerObject as an int,
not an object number. Storing object_none (0xffff) into the save file
causes affected releases to exhibit several problems. Most obviously,
they crash if the automap is opened, because they try to show
Objects[0xffff] as a marker, but no such object exists. Additionally,
they refuse to let the player drop a marker because none of the elements
of MarkerObject are -1, so they incorrectly tell the player that all
marker slots are busy. Finally, they will crash if the guidebot is
killed, because the guidebot death code deletes marker 0xffff because it
fails to recognize that this is object_none.
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 work correctly after loading a saved game written by current
code.
Fixes: 9125ae32cd
("Make objnum unsigned")
This commit is contained in:
parent
2e6b5e8467
commit
e127072f21
|
@ -1196,7 +1196,11 @@ int state_save_all_sub(const char *filename, const char *desc)
|
|||
// Save automap marker info
|
||||
|
||||
range_for (int m, MarkerObject)
|
||||
{
|
||||
if (m == object_none)
|
||||
m = -1;
|
||||
PHYSFS_write(fp, &m, sizeof(m), 1);
|
||||
}
|
||||
PHYSFS_seek(fp, PHYSFS_tell(fp) + (NUM_MARKERS)*(CALLSIGN_LEN+1)); // PHYSFS_write(fp, MarkerOwner, sizeof(MarkerOwner), 1); MarkerOwner is obsolete
|
||||
range_for (const auto &m, MarkerMessage)
|
||||
PHYSFS_write(fp, m.data(), m.size(), 1);
|
||||
|
|
Loading…
Reference in a new issue