mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-04 20:43:54 -07:00
Refactor: rename and consolidate getSpectator (#6067)
This commit is contained in:
parent
03bebbe4c2
commit
46d65f0b7e
4 changed files with 6 additions and 13 deletions
|
|
@ -415,11 +415,6 @@ void TabGame::adminLockChanged(bool lock)
|
||||||
sayEdit->setVisible(v);
|
sayEdit->setVisible(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabGame::isSpectator()
|
|
||||||
{
|
|
||||||
return spectator;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabGame::actGameInfo()
|
void TabGame::actGameInfo()
|
||||||
{
|
{
|
||||||
DlgCreateGame dlg(gameInfo, roomGameTypes, this);
|
DlgCreateGame dlg(gameInfo, roomGameTypes, this);
|
||||||
|
|
|
||||||
|
|
@ -235,15 +235,14 @@ public:
|
||||||
return gameInfo.game_id();
|
return gameInfo.game_id();
|
||||||
}
|
}
|
||||||
QString getTabText() const override;
|
QString getTabText() const override;
|
||||||
bool getSpectator() const
|
bool isSpectator() const
|
||||||
{
|
{
|
||||||
return spectator;
|
return spectator;
|
||||||
}
|
}
|
||||||
bool getSpectatorsSeeEverything() const
|
bool isSpectatorsOmniscient() const
|
||||||
{
|
{
|
||||||
return gameInfo.spectators_omniscient();
|
return gameInfo.spectators_omniscient();
|
||||||
}
|
}
|
||||||
bool isSpectator();
|
|
||||||
Player *getActiveLocalPlayer() const;
|
Player *getActiveLocalPlayer() const;
|
||||||
AbstractClient *getClientForPlayer(int playerId) const;
|
AbstractClient *getClientForPlayer(int playerId) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ void CardItem::deleteDragItem()
|
||||||
|
|
||||||
void CardItem::drawArrow(const QColor &arrowColor)
|
void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
{
|
{
|
||||||
if (static_cast<TabGame *>(owner->parent())->getSpectator())
|
if (static_cast<TabGame *>(owner->parent())->isSpectator())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player *arrowOwner = static_cast<TabGame *>(owner->parent())->getActiveLocalPlayer();
|
Player *arrowOwner = static_cast<TabGame *>(owner->parent())->getActiveLocalPlayer();
|
||||||
|
|
@ -282,7 +282,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||||
|
|
||||||
void CardItem::drawAttachArrow()
|
void CardItem::drawAttachArrow()
|
||||||
{
|
{
|
||||||
if (static_cast<TabGame *>(owner->parent())->getSpectator())
|
if (static_cast<TabGame *>(owner->parent())->isSpectator())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto *arrow = new ArrowAttachItem(this);
|
auto *arrow = new ArrowAttachItem(this);
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
||||||
|
|
||||||
stack = addZone(new StackZone(this, (int)table->boundingRect().height(), this));
|
stack = addZone(new StackZone(this, (int)table->boundingRect().height(), this));
|
||||||
|
|
||||||
hand = addZone(new HandZone(this,
|
hand = addZone(new HandZone(this, _local || _judge || (_parent->isSpectator() && _parent->isSpectatorsOmniscient()),
|
||||||
_local || _judge || (_parent->getSpectator() && _parent->getSpectatorsSeeEverything()),
|
|
||||||
(int)table->boundingRect().height(), this));
|
(int)table->boundingRect().height(), this));
|
||||||
connect(hand, &HandZone::cardCountChanged, handCounter, &HandCounter::updateNumber);
|
connect(hand, &HandZone::cardCountChanged, handCounter, &HandCounter::updateNumber);
|
||||||
connect(handCounter, &HandCounter::showContextMenu, hand, &HandZone::showContextMenu);
|
connect(handCounter, &HandCounter::showContextMenu, hand, &HandZone::showContextMenu);
|
||||||
|
|
@ -2782,7 +2781,7 @@ void Player::processPlayerInfo(const ServerInfo_Player &info)
|
||||||
|
|
||||||
switch (zoneInfo.type()) {
|
switch (zoneInfo.type()) {
|
||||||
case ServerInfo_Zone::PrivateZone:
|
case ServerInfo_Zone::PrivateZone:
|
||||||
contentsKnown = local || judge || (game->getSpectator() && game->getSpectatorsSeeEverything());
|
contentsKnown = local || judge || (game->isSpectator() && game->isSpectatorsOmniscient());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ServerInfo_Zone::PublicZone:
|
case ServerInfo_Zone::PublicZone:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue