mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-02 23:19:44 +01:00
Remove game.savemystats
This variable seems to have been intended to make sure game.savestatsandsettings() was called at the end of the frame, or make sure that it didn't get called more than once per frame. I don't see any frame ordering-related reason why it needs to be called specifically at the end of the frame (the function doesn't modify any state), so it's more plausible that it was added to make sure it didn't get called more than one per frame. However, upon further analysis, none of the code paths where game.savemystats is used ever calls or sets game.savemystats more than once, and a majority of the code directly calls game.savestatsandsettings() anyway, so there's no reason for this variable to exist. If we ever need to make sure it doesn't get called more than once, and there's no way to change the code paths around to prevent it otherwise, we can use the defer callbacks system that I added to #535, when it gets merged.
This commit is contained in:
parent
17d06f06be
commit
b1558f574c
4 changed files with 7 additions and 16 deletions
|
@ -130,7 +130,6 @@ void Game::init(void)
|
||||||
roomchange = false;
|
roomchange = false;
|
||||||
|
|
||||||
|
|
||||||
savemystats = false;
|
|
||||||
quickrestartkludge = false;
|
quickrestartkludge = false;
|
||||||
|
|
||||||
tapleft = 0;
|
tapleft = 0;
|
||||||
|
@ -6623,12 +6622,12 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
if (temp == 1)
|
if (temp == 1)
|
||||||
{
|
{
|
||||||
createmenu(Menu::unlocktimetrial, true);
|
createmenu(Menu::unlocktimetrial, true);
|
||||||
savemystats = true;
|
savestatsandsettings();
|
||||||
}
|
}
|
||||||
else if (temp > 1)
|
else if (temp > 1)
|
||||||
{
|
{
|
||||||
createmenu(Menu::unlocktimetrials, true);
|
createmenu(Menu::unlocktimetrials, true);
|
||||||
savemystats = true;
|
savestatsandsettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -6647,7 +6646,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
unlocknotify[17] = true;
|
unlocknotify[17] = true;
|
||||||
unlock[17] = true;
|
unlock[17] = true;
|
||||||
createmenu(Menu::unlocknodeathmode, true);
|
createmenu(Menu::unlocknodeathmode, true);
|
||||||
savemystats = true;
|
savestatsandsettings();
|
||||||
}
|
}
|
||||||
//Alright then! Flip mode?
|
//Alright then! Flip mode?
|
||||||
else if (unlock[5] && !unlocknotify[18])
|
else if (unlock[5] && !unlocknotify[18])
|
||||||
|
@ -6655,7 +6654,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
unlock[18] = true;
|
unlock[18] = true;
|
||||||
unlocknotify[18] = true;
|
unlocknotify[18] = true;
|
||||||
createmenu(Menu::unlockflipmode, true);
|
createmenu(Menu::unlockflipmode, true);
|
||||||
savemystats = true;
|
savestatsandsettings();
|
||||||
}
|
}
|
||||||
//What about the intermission levels?
|
//What about the intermission levels?
|
||||||
else if (unlock[7] && !unlocknotify[16])
|
else if (unlock[7] && !unlocknotify[16])
|
||||||
|
@ -6663,7 +6662,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
unlock[16] = true;
|
unlock[16] = true;
|
||||||
unlocknotify[16] = true;
|
unlocknotify[16] = true;
|
||||||
createmenu(Menu::unlockintermission, true);
|
createmenu(Menu::unlockintermission, true);
|
||||||
savemystats = true;
|
savestatsandsettings();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -374,8 +374,6 @@ public:
|
||||||
std::string hardestroom;
|
std::string hardestroom;
|
||||||
int hardestroomdeaths, currentroomdeaths;
|
int hardestroomdeaths, currentroomdeaths;
|
||||||
|
|
||||||
bool savemystats;
|
|
||||||
|
|
||||||
|
|
||||||
bool quickrestartkludge;
|
bool quickrestartkludge;
|
||||||
|
|
||||||
|
|
|
@ -687,7 +687,7 @@ static void menuactionpress()
|
||||||
{
|
{
|
||||||
// toggle Flip Mode
|
// toggle Flip Mode
|
||||||
graphics.setflipmode = !graphics.setflipmode;
|
graphics.setflipmode = !graphics.setflipmode;
|
||||||
game.savemystats = true;
|
game.savestatsandsettings();
|
||||||
if (graphics.setflipmode)
|
if (graphics.setflipmode)
|
||||||
{
|
{
|
||||||
music.playef(18);
|
music.playef(18);
|
||||||
|
@ -1307,7 +1307,7 @@ static void menuactionpress()
|
||||||
{
|
{
|
||||||
// WARNING: Partially duplicated in Menu::options
|
// WARNING: Partially duplicated in Menu::options
|
||||||
graphics.setflipmode = !graphics.setflipmode;
|
graphics.setflipmode = !graphics.setflipmode;
|
||||||
game.savemystats = true;
|
game.savestatsandsettings();
|
||||||
if (graphics.setflipmode)
|
if (graphics.setflipmode)
|
||||||
{
|
{
|
||||||
music.playef(18);
|
music.playef(18);
|
||||||
|
|
|
@ -639,12 +639,6 @@ static void inline fixedloop()
|
||||||
//We did editorinput, now it's safe to turn this off
|
//We did editorinput, now it's safe to turn this off
|
||||||
key.linealreadyemptykludge = false;
|
key.linealreadyemptykludge = false;
|
||||||
|
|
||||||
if (game.savemystats)
|
|
||||||
{
|
|
||||||
game.savemystats = false;
|
|
||||||
game.savestatsandsettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Mute button
|
//Mute button
|
||||||
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !key.textentry())
|
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !key.textentry())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue