mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-27 00:53:55 -07:00
Do not open card reveal windows when skipping in replays (#5157)
* create EventProcessingOption QFlag * pass EventProcessingOption all the way down * implement reveal skipping logic
This commit is contained in:
parent
dd04c610ec
commit
e894e78346
7 changed files with 58 additions and 22 deletions
|
|
@ -2341,7 +2341,7 @@ void Player::eventDrawCards(const Event_DrawCards &event)
|
|||
emit logDrawCards(this, event.number(), _deck->getCards().size() == 0);
|
||||
}
|
||||
|
||||
void Player::eventRevealCards(const Event_RevealCards &event)
|
||||
void Player::eventRevealCards(const Event_RevealCards &event, EventProcessingOptions options)
|
||||
{
|
||||
CardZone *zone = zones.value(QString::fromStdString(event.zone_name()));
|
||||
if (!zone) {
|
||||
|
|
@ -2388,7 +2388,7 @@ void Player::eventRevealCards(const Event_RevealCards &event)
|
|||
showZoneView = false;
|
||||
}
|
||||
}
|
||||
if (showZoneView && !cardList.isEmpty()) {
|
||||
if (!options.testFlag(SKIP_REVEAL_WINDOW) && showZoneView && !cardList.isEmpty()) {
|
||||
static_cast<GameScene *>(scene())->addRevealedZoneView(this, zone, cardList, event.grant_write_access());
|
||||
}
|
||||
|
||||
|
|
@ -2415,7 +2415,10 @@ void Player::eventChangeZoneProperties(const Event_ChangeZoneProperties &event)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::processGameEvent(GameEvent::GameEventType type, const GameEvent &event, const GameEventContext &context)
|
||||
void Player::processGameEvent(GameEvent::GameEventType type,
|
||||
const GameEvent &event,
|
||||
const GameEventContext &context,
|
||||
EventProcessingOptions options)
|
||||
{
|
||||
switch (type) {
|
||||
case GameEvent::GAME_SAY:
|
||||
|
|
@ -2470,7 +2473,7 @@ void Player::processGameEvent(GameEvent::GameEventType type, const GameEvent &ev
|
|||
eventDrawCards(event.GetExtension(Event_DrawCards::ext));
|
||||
break;
|
||||
case GameEvent::REVEAL_CARDS:
|
||||
eventRevealCards(event.GetExtension(Event_RevealCards::ext));
|
||||
eventRevealCards(event.GetExtension(Event_RevealCards::ext), options);
|
||||
break;
|
||||
case GameEvent::CHANGE_ZONE_PROPERTIES:
|
||||
eventChangeZoneProperties(event.GetExtension(Event_ChangeZoneProperties::ext));
|
||||
|
|
|
|||
|
|
@ -226,6 +226,13 @@ private slots:
|
|||
|
||||
void initSayMenu();
|
||||
|
||||
public:
|
||||
enum EventProcessingOption
|
||||
{
|
||||
SKIP_REVEAL_WINDOW = 0x0001
|
||||
};
|
||||
Q_DECLARE_FLAGS(EventProcessingOptions, EventProcessingOption)
|
||||
|
||||
private:
|
||||
TabGame *game;
|
||||
QMenu *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu, *mRevealLibrary, *mLendLibrary, *mRevealTopCard,
|
||||
|
|
@ -332,7 +339,7 @@ private:
|
|||
void eventDestroyCard(const Event_DestroyCard &event);
|
||||
void eventAttachCard(const Event_AttachCard &event);
|
||||
void eventDrawCards(const Event_DrawCards &event);
|
||||
void eventRevealCards(const Event_RevealCards &event);
|
||||
void eventRevealCards(const Event_RevealCards &event, EventProcessingOptions options);
|
||||
void eventChangeZoneProperties(const Event_ChangeZoneProperties &event);
|
||||
void cmdSetTopCard(Command_MoveCard &cmd);
|
||||
void cmdSetBottomCard(Command_MoveCard &cmd);
|
||||
|
|
@ -470,7 +477,10 @@ public:
|
|||
void processPlayerInfo(const ServerInfo_Player &info);
|
||||
void processCardAttachment(const ServerInfo_Player &info);
|
||||
|
||||
void processGameEvent(GameEvent::GameEventType type, const GameEvent &event, const GameEventContext &context);
|
||||
void processGameEvent(GameEvent::GameEventType type,
|
||||
const GameEvent &event,
|
||||
const GameEventContext &context,
|
||||
EventProcessingOptions options);
|
||||
|
||||
PendingCommand *prepareGameCommand(const ::google::protobuf::Message &cmd);
|
||||
PendingCommand *prepareGameCommand(const QList<const ::google::protobuf::Message *> &cmdList);
|
||||
|
|
@ -480,6 +490,8 @@ public:
|
|||
void setLastToken(CardInfoPtr cardInfo);
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Player::EventProcessingOptions)
|
||||
|
||||
class AnnotationDialog : public QInputDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue