fluffy-mods / ColonyManager

Colony manager for RimWorld
Other
72 stars 38 forks source link

Fix settings not persisting, fix resultant "No active language" translation errors. #145

Closed maarxx closed 5 years ago

maarxx commented 5 years ago

The Main Menu -> Options -> Mod Settings configuration option for "Default update interval" was not being persisted after quitting to desktop and relaunching the application.

This was fixed by adding the two lines to Controller.cs.

This, in turn, raised errors regarding "No active language! Cannot translate from key ..."

This seems to be because the DefaultUpdateInterval variable involves calling translations, and translations are not available at this point in the application startup process.

The DefaultUpdateInterval has been moved to a synthetic variable that saves and fetches on-demand, only when requested, persisting itself only in the raw integer scribe value.

This defers all translation attempts until much later, when the game is fully loaded, when the actual mod settings window attempts to render, or the game is actually being played, at which point translations are fully available.

FluffierThanThou commented 5 years ago

good call. I'm slightly wary about the getter doing a loop every time, but I suppose it's not called enough for that to remotely matter.