Add and use Game::save_exists()

This is simply a shorthand for telesummary != "" || quicksummary != "",
to make it easier and less error-prone to negate. This improves
readability.
This commit is contained in:
Misa
2020-04-26 13:41:35 -07:00
committed by Ethan Lee
parent 7df42242e7
commit 197c7caf08
3 changed files with 13 additions and 7 deletions

View File

@@ -1357,7 +1357,7 @@ void Game::updatestate()
{
returntomenu(Menu::levellist);
}
else if (telesummary != "" || quicksummary != "" || anything_unlocked())
else if (save_exists() || anything_unlocked())
{
returntomenu(Menu::play);
}
@@ -7031,7 +7031,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
}
else
{
if (telesummary != "" || quicksummary != "")
if (save_exists())
{
option("continue");
}
@@ -7045,7 +7045,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option("secret lab", !map.invincibility && slowdown == 30);
}
option("play modes");
if (telesummary != "" || quicksummary != "")
if (save_exists())
{
option("new game");
}
@@ -7346,3 +7346,8 @@ bool Game::anything_unlocked()
}
return false;
}
bool Game::save_exists()
{
return telesummary != "" || quicksummary != "";
}