Took 10 minutes
This commit is contained in:
Lukas Brübach 2025-09-10 15:13:30 +02:00
parent 595eb609ad
commit 70f29256fd
9 changed files with 22 additions and 13 deletions

View file

@ -2,8 +2,7 @@
#include "player/player.h"
AbstractGame::AbstractGame(TabGame *_tab)
: tab(_tab)
AbstractGame::AbstractGame(TabGame *_tab) : tab(_tab)
{
gameMetaInfo = new GameMetaInfo(this);
gameEventHandler = new GameEventHandler(this);

View file

@ -17,4 +17,3 @@ Game::Game(TabGame *_tab,
playerManager = new PlayerManager(this, event.player_id(), event.judge(), event.spectator());
gameMetaInfo->setStarted(false);
}

View file

@ -2,6 +2,7 @@
#define COCKATRICE_GAME_H
#include "abstract_game.h"
#include <QObject>
class Game : public AbstractGame

View file

@ -1,4 +1,5 @@
#include "game_state.h"
#include "abstract_game.h"
GameState::GameState(AbstractGame *_game,

View file

@ -54,7 +54,10 @@ bool PlayerListTWI::operator<(const QTreeWidgetItem &other) const
return data(4, Qt::UserRole + 1).toInt() < other.data(4, Qt::UserRole + 1).toInt();
}
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, AbstractGame *_game, QWidget *parent)
PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor,
AbstractClient *_client,
AbstractGame *_game,
QWidget *parent)
: QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false)
{
readyIcon = QPixmap("theme:icons/ready_start");

View file

@ -47,7 +47,10 @@ signals:
void openMessageDialog(const QString &userName, bool focus);
public:
PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, AbstractGame *_game, QWidget *parent = nullptr);
PlayerListWidget(TabSupervisor *_tabSupervisor,
AbstractClient *_client,
AbstractGame *_game,
QWidget *parent = nullptr);
void retranslateUi();
void setActivePlayer(int playerId);
void setGameStarted(bool _gameStarted, bool resuming);

View file

@ -3,7 +3,10 @@
#include "../abstract_game.h"
#include "player.h"
PlayerManager::PlayerManager(AbstractGame *_game, int _localPlayerId, bool _localPlayerIsJudge, bool localPlayerIsSpectator)
PlayerManager::PlayerManager(AbstractGame *_game,
int _localPlayerId,
bool _localPlayerIsJudge,
bool localPlayerIsSpectator)
: QObject(_game), game(_game), players(QMap<int, Player *>()), localPlayerId(_localPlayerId),
localPlayerIsJudge(_localPlayerIsJudge), localPlayerIsSpectator(localPlayerIsSpectator)
{

View file

@ -2,11 +2,10 @@
#include "../client/tabs/tab_game.h"
Replay::Replay(TabGame *_tab, GameReplay *_replay) : AbstractGame(_tab)
Replay::Replay(TabGame *_tab, GameReplay *_replay) : AbstractGame(_tab)
{
gameState = new GameState(this, 0, -1, tab->getTabSupervisor()->getIsLocalGame(), {}, false,
false, -1, false);
connect(gameMetaInfo, &GameMetaInfo::startedChanged, gameState, &GameState::onStartedChanged);
playerManager = new PlayerManager(this, -1, false, true);
loadReplay(_replay);
gameState = new GameState(this, 0, -1, tab->getTabSupervisor()->getIsLocalGame(), {}, false, false, -1, false);
connect(gameMetaInfo, &GameMetaInfo::startedChanged, gameState, &GameState::onStartedChanged);
playerManager = new PlayerManager(this, -1, false, true);
loadReplay(_replay);
}

View file

@ -3,7 +3,8 @@
#include "abstract_game.h"
class Replay : public AbstractGame {
class Replay : public AbstractGame
{
Q_OBJECT
public: