1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00

Explicitly zero declared struct ScreenSettingss

Performance cost is negligible and well worth being safe in case there
are more members added in the future but we forget to initialize them.
This commit is contained in:
Misa 2021-12-25 00:22:22 -08:00
parent 1e157f3cc9
commit a6b076e234
2 changed files with 3 additions and 0 deletions

View File

@ -4328,6 +4328,7 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett
bool Game::savestats(bool sync /*= true*/)
{
struct ScreenSettings screen_settings;
SDL_zero(screen_settings);
gameScreen.GetSettings(&screen_settings);
return savestats(&screen_settings, sync);
@ -4593,6 +4594,7 @@ void Game::loadsettings(struct ScreenSettings* screen_settings)
bool Game::savesettings(void)
{
struct ScreenSettings screen_settings;
SDL_zero(screen_settings);
gameScreen.GetSettings(&screen_settings);
return savesettings(&screen_settings);

View File

@ -572,6 +572,7 @@ int main(int argc, char *argv[])
// Prioritize unlock.vvv first (2.2 and below),
// but settings have been migrated to settings.vvv (2.3 and up)
struct ScreenSettings screen_settings;
SDL_zero(screen_settings);
ScreenSettings_default(&screen_settings);
game.loadstats(&screen_settings);
game.loadsettings(&screen_settings);