Ludeon Forums

RimWorld => Bugs => Topic started by: Alistaire on April 07, 2016, 06:39:44 AM

Title: [A13] Savefile cluttering default(IntVec3) != IntVec3.Invalid
Post by: Alistaire on April 07, 2016, 06:39:44 AM
Quote from: Alistaire on January 10, 2016, 10:34:15 AMEvery Thing's "pos" is saved since default(IntVec3) is somehow not equal to (-1000,-1000,-1000), since that is IntVec3.Invalid. Replace
the following code:

Scribe_Values.LookValue<IntVec3>(ref this.positionInt, "pos", default(IntVec3), false);

to

Scribe_Values.LookValue<IntVec3>(ref this.positionInt, "pos", IntVec3.Invalid, false);


Anything that is worn, stored or otherwise has no position value has this value saved, introducing one line of text for every one of those that
exist in the game environment (I managed to replace 65 occurences of <pos>(-1000,-1000,-1000)</pos> from a new colony's initial save).

This is still present in A13. For reference:

default(IntVec3) == new IntVec3(0,0,0);
IntVec3.Invalid == new IntVec3(-1000,-1000,-1000);


In A13 creating a new world and colony yielded me 185(!) occurences of <pos>(-1000,-1000,-1000)</pos>, this should be fixed as follows:

Scribe_Values.LookValue<IntVec3>(ref this.positionInt, "pos", IntVec3.Invalid, false);

.. which causes the default value to be assumed to be IntVec3.Invalid as its value is set in the constructor:

private IntVec3 positionInt = IntVec3.Invalid;




Title: Re: [A13] Savefile cluttering default(IntVec3) != IntVec3.Invalid
Post by: ison on April 07, 2016, 12:11:21 PM
Fixed, thanks.