Convert menu names to be an enum instead of being stringly-typed

Stringly-typed things are bad, because if you make a typo when typing
out a string, it's not caught at compile-time. And in the case of this
menu system, you'd have to do an excessive amount of testing to uncover
any bugs caused by a typo. Why do that when you can just use an enum and
catch compile-time errors instead?

Also, you can't use switch-case statements on stringly-typed variables.

So every menu name is now in the enum Menu::MenuName, but you can simply
refer to a menu name by just prefixing it with Menu::.

Unfortunately, I've had to change the "continue" menu name to be
"continuemenu", because "continue" is a keyword in C and C++. Also, it
looks like "timetrialcomplete4" is an unused menu name, even though it
was referenced in Render.cpp.
This commit is contained in:
Misa
2020-04-15 21:53:36 -07:00
committed by Ethan Lee
parent 83ca75a831
commit e8a07f9c3d
7 changed files with 324 additions and 269 deletions

View File

@@ -2534,7 +2534,7 @@ void scriptclass::resetgametomenu()
graphics.flipmode = false;
obj.entities.clear();
graphics.fademode = 4;
game.createmenu("gameover");
game.createmenu(Menu::gameover);
}
void scriptclass::startgamemode( int t )