diff --git a/desktop_version/src/Enums.h b/desktop_version/src/Enums.h index 4b7c852b..fc4bedd6 100644 --- a/desktop_version/src/Enums.h +++ b/desktop_version/src/Enums.h @@ -1,7 +1,7 @@ #ifndef ENUMGAME_H #define ENUMGAME_H -enum +enum GameGamestate { GAMEMODE, TITLEMODE, CLICKTOSTART, FOCUSMODE, MAPMODE, TELEPORTERMODE, GAMECOMPLETE, GAMECOMPLETE2, EDITORMODE, PRELOADER diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 9e2e8765..49e29968 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6877,7 +6877,7 @@ void Game::unlockAchievement(const char *name) { #endif } -void Game::mapmenuchange(const int newgamestate, const bool user_initiated) +void Game::mapmenuchange(const enum GameGamestate newgamestate, const bool user_initiated) { if (user_initiated && graphics.resumegamemode) { diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index e78b6384..de7f12ba 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -7,6 +7,13 @@ #include "ScreenSettings.h" +/* FIXME: Can't forward declare this enum in C++, unfortunately. + * In C, enum sizes are always the same, so you can forward declare them. + * In C++ instead, enum sizes are based on how many enums there are. + * You cannot specify the underlying type until C++11. + * But bumping the standard opens up a can of worms. I'd rather just move to C. -Misa */ +#include "Enums.h" + // Forward decl without including all of namespace tinyxml2 { @@ -227,8 +234,8 @@ public: bool glitchrunkludge; - int gamestate; - int prevgamestate; //only used sometimes + enum GameGamestate gamestate; + enum GameGamestate prevgamestate; //only used sometimes bool hascontrol, jumpheld; int jumppressed; int gravitycontrol; @@ -242,7 +249,7 @@ public: int tapleft, tapright; //Menu interaction stuff - void mapmenuchange(const int newgamestate, const bool user_initiated); + void mapmenuchange(const enum GameGamestate newgamestate, const bool user_initiated); bool mapheld; int menupage; int lastsaved;