Removed unused fields in GameMetaInfo and GameState (#6142)

* Removed unused fields in GameMetaInfo and GameState

* revert parent to AbstractGame

* init activePlayer to -1
This commit is contained in:
RickyRister 2025-09-15 01:22:11 -07:00 committed by GitHub
parent 9b3756e591
commit 94ba1c83c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 26 deletions

View file

@ -2,6 +2,6 @@
#include "abstract_game.h" #include "abstract_game.h"
GameMetaInfo::GameMetaInfo(AbstractGame *_game) : QObject(_game), game(_game) GameMetaInfo::GameMetaInfo(AbstractGame *parent) : QObject(parent)
{ {
} }

View file

@ -15,7 +15,7 @@ class GameMetaInfo : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit GameMetaInfo(AbstractGame *_game); explicit GameMetaInfo(AbstractGame *parent);
QMap<int, QString> roomGameTypes; QMap<int, QString> roomGameTypes;
@ -79,11 +79,6 @@ public:
return roomGameTypes.find(gameInfo_.game_types(index)).value(); return roomGameTypes.find(gameInfo_.game_types(index)).value();
} }
AbstractGame *getGame() const
{
return game;
}
public slots: public slots:
void setStarted(bool s) void setStarted(bool s)
{ {
@ -105,7 +100,6 @@ signals:
void spectatorsOmniscienceChanged(bool omniscient); void spectatorsOmniscienceChanged(bool omniscient);
private: private:
AbstractGame *game;
ServerInfo_Game gameInfo_; ServerInfo_Game gameInfo_;
}; };

View file

@ -2,7 +2,7 @@
#include "abstract_game.h" #include "abstract_game.h"
GameState::GameState(AbstractGame *_game, GameState::GameState(AbstractGame *parent,
int _secondsElapsed, int _secondsElapsed,
int _hostId, int _hostId,
bool _isLocalGame, bool _isLocalGame,
@ -11,9 +11,9 @@ GameState::GameState(AbstractGame *_game,
bool _resuming, bool _resuming,
int _currentPhase, int _currentPhase,
bool _gameClosed) 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), clients(_clients), gameStateKnown(_gameStateKnown), resuming(_resuming), currentPhase(_currentPhase),
gameClosed(_gameClosed) activePlayer(-1), gameClosed(_gameClosed)
{ {
} }

View file

@ -16,7 +16,7 @@ class GameState : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit GameState(AbstractGame *_game, explicit GameState(AbstractGame *parent,
int secondsElapsed, int secondsElapsed,
int hostId, int hostId,
bool isLocalGame, bool isLocalGame,
@ -51,7 +51,7 @@ public:
resuming = _resuming; resuming = _resuming;
} }
bool isGameStateKnown() bool isGameStateKnown() const
{ {
return gameStateKnown; return gameStateKnown;
} }
@ -100,16 +100,6 @@ public:
void startGameTimer(); void startGameTimer();
QMap<int, QString> getRoomGameTypes() const
{
return roomGameTypes;
}
void setRoomGameTypes(QMap<int, QString> _roomGameTypes)
{
roomGameTypes = _roomGameTypes;
}
void setGameStateKnown(bool known) void setGameStateKnown(bool known)
{ {
gameStateKnown = known; gameStateKnown = known;
@ -132,16 +122,13 @@ public slots:
void setGameTime(int _secondsElapsed); void setGameTime(int _secondsElapsed);
private: private:
AbstractGame *game;
QTimer *gameTimer; QTimer *gameTimer;
int secondsElapsed; int secondsElapsed;
QMap<int, QString> roomGameTypes;
int hostId; int hostId;
const bool isLocalGame; const bool isLocalGame;
QList<AbstractClient *> clients; QList<AbstractClient *> clients;
bool gameStateKnown; bool gameStateKnown;
bool resuming; bool resuming;
QStringList phasesList;
int currentPhase; int currentPhase;
int activePlayer; int activePlayer;
bool gameClosed; bool gameClosed;