Skip to content

Commit 901d202

Browse files
committed
refactor: move _game declaration to cpp file for better encapsulation
1 parent 7264920 commit 901d202

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/game_level_ui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <util/log.hpp>
33
#include <ui/common.hpp>
44

5+
static core::Game* _game = nullptr;
6+
57
void gameLvl_configureGameOptions(core::GameOptions* options) {
68
util::WriteToLog("Configuring game options...", "gameLvl_configureGameOptions()");
79
gameLvl_gameOptions = options;

src/game_level_ui.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// ==== IMPORTANT ====
1010
// All variables/functions that will be used outside this file MUST begin with "gameLvl_"
11-
// All variables/functions that will be used only in this file MUST begin with "_"
11+
// All variables/functions that will be used only in this file MUST be defined in the .cpp file, not here.
1212

1313
#include <core/game.hpp>
1414

@@ -24,7 +24,5 @@ static std::atomic<bool> gameLvl_customMode = false;
2424
void gameLvl_mainGameLoop();
2525
// The score of the game.
2626
static int gameLvl_score = 0;
27-
// The private Game object.
28-
static core::Game* _game;
2927

3028
#endif // _GAME_LEVEL_UI_HPP

0 commit comments

Comments
 (0)