Refactor Game::savestats() to not use a default argument

In order to be able to fix the bug #556, I'm planning on adding
ScreenSettings* to the settings.vvv write function. However, that
entails adding another argument to Game::savesettings(), which is going
to be really messy given the default argument of Game::savestats().
That, combined with the fact that the code comment at the site of the
implementation of Game::savestats() being wrong (!!!), leads me to
believe that using default function arguments here isn't worth it.

Instead, what I've done is made it so callers are explicit about whether
or not they're calling savestats(), savesettings(), or both at the same
time. If they are calling both at the same time, then they will be using
a new function named savestatsandsettings().

In short, these are the interface changes:
 * bool Game::savestats(bool) has been removed
 * bool Game::savestatsandsettings() has been added
 * void Game::savestats_menu() has been renamed to
   void Game::savestatsandsettings_menu()
 * All previous callers of bool Game::savestats() are now using bool
   Game::savestatsandsettings()
 * The one caller of bool Game::savestats(bool) is now using bool
   Game::savestats()
This commit is contained in:
Misa
2020-12-21 16:03:19 -08:00
committed by Ethan Lee
parent 98effeee58
commit b62908f0f4
6 changed files with 61 additions and 56 deletions

View File

@@ -133,8 +133,7 @@ public:
void loadstats(ScreenSettings* screen_settings);
bool savestats(const bool stats_only = false);
void savestats_menu();
bool savestats();
void deletestats();
@@ -146,6 +145,10 @@ public:
bool savesettings();
bool savestatsandsettings();
void savestatsandsettings_menu();
void deletesettings();
void deletequick();