Xaiier/TimeControl — pull request #2 by jgottula (2014-09-11 01:22:08+00:00)
Title: Avoid saving settings repeatedly every frame

Currently `TimeControl.Settings.Update` is supposed to save settings every 10 seconds. But the way the function is currently written, settings are saved *every frame* for 1 out of every 10 seconds, because `Update` is called every frame, and the `if` statement condition will evaluate to `true` for every single frame if the `int` part of the current second is zero. On my system, I get about 50-60 calls to `GameSettings.SaveSettings` and `TimeControl.Settings.saveConfig` every 10 seconds because I'm getting 50-60 fps.

I've rewritten the function so it actually only saves once every 10 seconds. There's still probably a lot more that could be done to improve this this (e.g. don't check the time on *every single frame*; only save settings if any of them actually changed; etc.). But at the very least, this change makes the function behave as intended.