[A13] Savefile cluttering <health>85</health>

Started by Alistaire, April 07, 2016, 09:09:19 AM

Previous topic - Next topic

Alistaire

Scribe_Defs.LookDef<ThingDef>(ref this.def, "def");

(..)

if (this.def.useHitPoints)
{
Scribe_Values.LookValue<int>(ref this.hitPointsInt, "health", -1, false);
}


Since def is already initialized at this point the default could be set to def.BaseMaxHitPoints (which might increase save times) or alternatively to 85 (replacing <health>85</health> in a fresh savefile yielded 35014 occurrences). A default of -1 would obviously never help loading/saving times.

All other <health> values (not 85 which has 35014 occurences) add up to 7053 occurrences:

  • 3026 times <health>120</health> (bushes)
  • 3489 times <health>300</health> (trees)
  • 538 other things (walls, equipment)

ison

Using 85 as a default value would indeed help decrease savefile's size, but it's an unintuitive value. Also, if we ever change things HPs so 85 is no longer an optimal value, then we'll end up with an unintuitive, non-optimal default value which we won't be able to change without affecting savefiles compatibility. Thanks for the report though!