Move game state and event handling out of tab_game and into separate classes.

Took 6 hours 38 minutes

Took 23 seconds
This commit is contained in:
Lukas Brübach 2025-08-24 19:17:58 +02:00
parent f31d30bf84
commit 467d90e236
13 changed files with 1314 additions and 782 deletions

View file

@ -259,10 +259,10 @@ void CardItem::deleteDragItem()
void CardItem::drawArrow(const QColor &arrowColor)
{
if (static_cast<TabGame *>(owner->parent())->isSpectator())
if (static_cast<TabGame *>(owner->parent())->getGameState()->isSpectator())
return;
Player *arrowOwner = static_cast<TabGame *>(owner->parent())->getActiveLocalPlayer();
Player *arrowOwner = static_cast<TabGame *>(owner->parent())->getGameState()->getActiveLocalPlayer();
ArrowDragItem *arrow = new ArrowDragItem(arrowOwner, this, arrowColor);
scene()->addItem(arrow);
arrow->grabMouse();
@ -282,7 +282,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
void CardItem::drawAttachArrow()
{
if (static_cast<TabGame *>(owner->parent())->isSpectator())
if (static_cast<TabGame *>(owner->parent())->getGameState()->isSpectator())
return;
auto *arrow = new ArrowAttachItem(this);