[B18][CRITICAL] Code error in Verse.BackCompatibility.WorldPawnPostLoadInit(wp)

Started by user19990313, March 08, 2018, 08:35:16 AM

Previous topic - Next topic

user19990313

While wandering in source codes with ILSpy:
public static void WorldPawnPostLoadInit(WorldPawns wp)
{
if (VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) == 0 && VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) <= 17)
{
wp.UnpinAllForcefullyKeptPawns();
}
if (wp.gc == null)
{
wp.gc = new WorldPawnGC();
}
}


Notice that in line 3:
if (VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) == 0 && VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) <= 17)
This suppose to be MinorFromVersionString() if you want to apply the rest of this func to 0.17 or lower saves.

Currently, MajorFromVersionString("0.18.1722 rev xxx") returns 0, and 0<=17 is true for sure, so this patch designed for 0.17 or lower saves is also applied to any of the 0.18 up-to-date saves.
The consequence is, wp.UnpinAllForcefullyKeptPawns() will run on any 0.18 saves loaded, which cleared wp.pawnsForcefullyKeptAsWorldPawns; then you click save button, the new save file will have an empty ForcefullyKept list stored.
<worldPawns>
<pawnsForcefullyKeptAsWorldPawns />
......
</worldPawns>

Yes, that's what a save looks like. I think you know what does that mean... A bomb with rand() seconds countdown.

The same issue occurs in Verse.BackCompatibility.RecordsTrackerPostLoadInit(recordTracker).

Please fix it @Tynan.

And stop forwarding my mail about wpgc... The WorldPawnGC issue is MUCH MORE CRITICAL than this one, but you just play deaf on that...

Calahan

Looks like you PM'ed this to Tynan, and he created another thread for this bug based on your PM: https://ludeon.com/forums/index.php?topic=39397.0

Therefore I'm locking this as a duplicate. (Edit ↓↓↓: Note to self, delete any duplicate bug threads Tynan creates in future ;D).

Tynan

Tynan Sylvester - @TynanSylvester - Tynan's Blog