mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
* [Cleanup] Unused #includes Took 44 minutes * [Cleanup] More unused #includes Took 55 minutes * [Cleanup] Include QSet Took 4 minutes * [Cleanup] Include QDebug in deck_list.cpp Took 3 minutes * [Cleanup] Include protocol stuff in servatrice_database_interface.h Took 3 minutes * [Cleanup] Include QDialogButtonBox Took 8 minutes * [Cleanup] Include QUrl Took 8 minutes * [Cleanup] Include QTextOption in header. Took 3 minutes * [Cleanup] Include QMap in user_list_manager.h Took 8 minutes * [Cleanup] Adjust qjson Took 8 minutes * [Cleanup] include button box. Took 3 minutes * [Cleanup] Redo fwd declarations. * [Cleanup] Redo last removed fwd declarations. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
137 lines
2.6 KiB
C++
137 lines
2.6 KiB
C++
/**
|
|
* @file game_state.h
|
|
* @ingroup GameLogic
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef COCKATRICE_GAME_STATE_H
|
|
#define COCKATRICE_GAME_STATE_H
|
|
|
|
#include <QTimer>
|
|
#include <libcockatrice/network/client/abstract/abstract_client.h>
|
|
|
|
class AbstractGame;
|
|
class ServerInfo_PlayerProperties;
|
|
class ServerInfo_User;
|
|
|
|
class GameState : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GameState(AbstractGame *parent,
|
|
int secondsElapsed,
|
|
int hostId,
|
|
bool isLocalGame,
|
|
QList<AbstractClient *> clients,
|
|
bool gameStateKnown,
|
|
bool resuming,
|
|
int currentPhase,
|
|
bool gameClosed);
|
|
|
|
void setHostId(int _hostId)
|
|
{
|
|
hostId = _hostId;
|
|
}
|
|
|
|
QList<AbstractClient *> getClients() const
|
|
{
|
|
return clients;
|
|
}
|
|
|
|
bool getIsLocalGame() const
|
|
{
|
|
return isLocalGame;
|
|
}
|
|
|
|
bool isResuming() const
|
|
{
|
|
return resuming;
|
|
}
|
|
|
|
void setResuming(bool _resuming)
|
|
{
|
|
resuming = _resuming;
|
|
}
|
|
|
|
bool isGameStateKnown() const
|
|
{
|
|
return gameStateKnown;
|
|
}
|
|
|
|
int getCurrentPhase() const
|
|
{
|
|
return currentPhase;
|
|
}
|
|
|
|
void setCurrentPhase(int phase)
|
|
{
|
|
currentPhase = phase;
|
|
emit activePhaseChanged(phase);
|
|
}
|
|
|
|
void setActivePlayer(int activePlayerId)
|
|
{
|
|
activePlayer = activePlayerId;
|
|
emit activePlayerChanged(activePlayer);
|
|
}
|
|
|
|
int getActivePlayer() const
|
|
{
|
|
return activePlayer;
|
|
}
|
|
|
|
void setGameClosed(bool closed)
|
|
{
|
|
gameClosed = closed;
|
|
}
|
|
|
|
bool isGameClosed() const
|
|
{
|
|
return gameClosed;
|
|
}
|
|
|
|
void onStartedChanged(bool _started)
|
|
{
|
|
if (_started) {
|
|
emit gameStarted(_started);
|
|
} else {
|
|
emit gameStopped();
|
|
}
|
|
}
|
|
|
|
void setGameStateKnown(bool known)
|
|
{
|
|
gameStateKnown = known;
|
|
}
|
|
|
|
int getHostId() const
|
|
{
|
|
return hostId;
|
|
}
|
|
|
|
signals:
|
|
void updateTimeElapsedLabel(QString newTime);
|
|
void gameStarted(bool resuming);
|
|
void gameStopped();
|
|
void activePhaseChanged(int activePhase);
|
|
void activePlayerChanged(int playerId);
|
|
|
|
public slots:
|
|
void incrementGameTime();
|
|
void setGameTime(int _secondsElapsed);
|
|
|
|
private:
|
|
QTimer *gameTimer;
|
|
int secondsElapsed;
|
|
int hostId;
|
|
const bool isLocalGame;
|
|
QList<AbstractClient *> clients;
|
|
bool gameStateKnown;
|
|
bool resuming;
|
|
int currentPhase;
|
|
int activePlayer;
|
|
bool gameClosed;
|
|
};
|
|
|
|
#endif // COCKATRICE_GAME_STATE_H
|