From 94ba1c83c6f5b74cd1dd78f8d270351d85ac2ae2 Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Mon, 15 Sep 2025 01:22:11 -0700 Subject: [PATCH] Removed unused fields in GameMetaInfo and GameState (#6142) * Removed unused fields in GameMetaInfo and GameState * revert parent to AbstractGame * init activePlayer to -1 --- cockatrice/src/game/game_meta_info.cpp | 2 +- cockatrice/src/game/game_meta_info.h | 8 +------- cockatrice/src/game/game_state.cpp | 6 +++--- cockatrice/src/game/game_state.h | 17 ++--------------- 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/cockatrice/src/game/game_meta_info.cpp b/cockatrice/src/game/game_meta_info.cpp index 45146dad9..7f3086cf6 100644 --- a/cockatrice/src/game/game_meta_info.cpp +++ b/cockatrice/src/game/game_meta_info.cpp @@ -2,6 +2,6 @@ #include "abstract_game.h" -GameMetaInfo::GameMetaInfo(AbstractGame *_game) : QObject(_game), game(_game) +GameMetaInfo::GameMetaInfo(AbstractGame *parent) : QObject(parent) { } diff --git a/cockatrice/src/game/game_meta_info.h b/cockatrice/src/game/game_meta_info.h index 39d589c65..dbf193e0c 100644 --- a/cockatrice/src/game/game_meta_info.h +++ b/cockatrice/src/game/game_meta_info.h @@ -15,7 +15,7 @@ class GameMetaInfo : public QObject { Q_OBJECT public: - explicit GameMetaInfo(AbstractGame *_game); + explicit GameMetaInfo(AbstractGame *parent); QMap roomGameTypes; @@ -79,11 +79,6 @@ public: return roomGameTypes.find(gameInfo_.game_types(index)).value(); } - AbstractGame *getGame() const - { - return game; - } - public slots: void setStarted(bool s) { @@ -105,7 +100,6 @@ signals: void spectatorsOmniscienceChanged(bool omniscient); private: - AbstractGame *game; ServerInfo_Game gameInfo_; }; diff --git a/cockatrice/src/game/game_state.cpp b/cockatrice/src/game/game_state.cpp index 4d86a16d4..04248819f 100644 --- a/cockatrice/src/game/game_state.cpp +++ b/cockatrice/src/game/game_state.cpp @@ -2,7 +2,7 @@ #include "abstract_game.h" -GameState::GameState(AbstractGame *_game, +GameState::GameState(AbstractGame *parent, int _secondsElapsed, int _hostId, bool _isLocalGame, @@ -11,9 +11,9 @@ GameState::GameState(AbstractGame *_game, bool _resuming, int _currentPhase, bool _gameClosed) - : QObject(_game), game(_game), secondsElapsed(_secondsElapsed), hostId(_hostId), isLocalGame(_isLocalGame), + : QObject(parent), gameTimer(nullptr), secondsElapsed(_secondsElapsed), hostId(_hostId), isLocalGame(_isLocalGame), clients(_clients), gameStateKnown(_gameStateKnown), resuming(_resuming), currentPhase(_currentPhase), - gameClosed(_gameClosed) + activePlayer(-1), gameClosed(_gameClosed) { } diff --git a/cockatrice/src/game/game_state.h b/cockatrice/src/game/game_state.h index 4f1cd4b17..63d38ebb7 100644 --- a/cockatrice/src/game/game_state.h +++ b/cockatrice/src/game/game_state.h @@ -16,7 +16,7 @@ class GameState : public QObject Q_OBJECT public: - explicit GameState(AbstractGame *_game, + explicit GameState(AbstractGame *parent, int secondsElapsed, int hostId, bool isLocalGame, @@ -51,7 +51,7 @@ public: resuming = _resuming; } - bool isGameStateKnown() + bool isGameStateKnown() const { return gameStateKnown; } @@ -100,16 +100,6 @@ public: void startGameTimer(); - QMap getRoomGameTypes() const - { - return roomGameTypes; - } - - void setRoomGameTypes(QMap _roomGameTypes) - { - roomGameTypes = _roomGameTypes; - } - void setGameStateKnown(bool known) { gameStateKnown = known; @@ -132,16 +122,13 @@ public slots: void setGameTime(int _secondsElapsed); private: - AbstractGame *game; QTimer *gameTimer; int secondsElapsed; - QMap roomGameTypes; int hostId; const bool isLocalGame; QList clients; bool gameStateKnown; bool resuming; - QStringList phasesList; int currentPhase; int activePlayer; bool gameClosed;