CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
574 stars 85 forks source link

Un-invert `Options.disableDespawning` data byte #1463

Closed originalfoo closed 2 years ago

originalfoo commented 2 years ago

For some reason the value of Options.disableDespawning was historically inverted during de/serialization.

GameplayTab_VehicleBehaviourGroup.DisableDespawning.Value = !LoadBool(data, idx: 15, true); // inverted

This PR fixes that by making the serialized value conistent with how all other options work (not inverted), whilst handling legacy value (inverted) if necessary.

It's based in part on new Version field that @kianzarrin put in PR #1211 (note: if merging prior to that PR, Kian would need to change version in his PR to 2).

Also fixes some trivial analyzer warnings I noticed.

krzychu124 commented 2 years ago

I'm not sure why I didn't notice it but.... if we are starting "new game", there won't be Configuration data so public static int Version => _configuration.Version; will throw null ref exception