Fixed issue with double initalization
This commit is contained in:
+16
-4
@@ -11,7 +11,6 @@
|
||||
|
||||
static int curX, curY;
|
||||
|
||||
extern bool isActive;
|
||||
extern std::vector<std::vector<Room>> rooms;
|
||||
|
||||
#define MAP_HEIGHT 5
|
||||
@@ -26,7 +25,9 @@ private:
|
||||
nlohmann::json json;
|
||||
fs::path filePath = "Resources/Rooms.json";
|
||||
std::ifstream stream;
|
||||
|
||||
bool isActive;
|
||||
|
||||
|
||||
inline static Game *game_;
|
||||
|
||||
|
||||
@@ -36,7 +37,7 @@ private:
|
||||
|
||||
public:
|
||||
Game();
|
||||
static bool GetIsActive() { return isActive; }
|
||||
inline bool GetIsActive() const { return isActive; }
|
||||
bool Init();
|
||||
void Run();
|
||||
bool Save();
|
||||
@@ -44,7 +45,18 @@ public:
|
||||
void ChangeRoom(Room r);
|
||||
Room GetCurrentRoom() { return currentRoom; }
|
||||
|
||||
static void SetIsActive(const bool active) { isActive = active; }
|
||||
inline bool operator!() const {
|
||||
if (isActive) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetIsActive(const bool active) { isActive = active; }
|
||||
|
||||
static void SetGameInstance(Game * g) {
|
||||
game_ = g;
|
||||
}
|
||||
|
||||
static Game &Instance() {
|
||||
if (game_ == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user