Fixed issue with double initalization

This commit is contained in:
Timothy O'Barr
2026-08-28 14:54:45 -05:00
parent 3e50d46284
commit ef54fa6609
3 changed files with 23 additions and 9 deletions
+16 -4
View File
@@ -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) {