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:
RickyRister 2024-11-08 17:06:23 -08:00 committed by GitHub
parent dd04c610ec
commit e894e78346
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 58 additions and 22 deletions

View file

@ -614,9 +614,9 @@ void TabGame::closeRequest()
actLeaveGame();
}
void TabGame::replayNextEvent()
void TabGame::replayNextEvent(Player::EventProcessingOptions options)
{
processGameEventContainer(replay->event_list(timelineWidget->getCurrentEvent()), nullptr);
processGameEventContainer(replay->event_list(timelineWidget->getCurrentEvent()), nullptr, options);
}
void TabGame::replayFinished()
@ -862,7 +862,9 @@ Player *TabGame::addPlayer(int playerId, const ServerInfo_User &info)
return newPlayer;
}
void TabGame::processGameEventContainer(const GameEventContainer &cont, AbstractClient *client)
void TabGame::processGameEventContainer(const GameEventContainer &cont,
AbstractClient *client,
Player::EventProcessingOptions options)
{
const GameEventContext &context = cont.context();
messageLog->containerProcessingStarted(context);
@ -937,7 +939,7 @@ void TabGame::processGameEventContainer(const GameEventContainer &cont, Abstract
qDebug() << "unhandled game event: invalid player id";
break;
}
player->processGameEvent(eventType, event, context);
player->processGameEvent(eventType, event, context, options);
emitUserEvent();
}
}
@ -1731,7 +1733,8 @@ void TabGame::createReplayDock()
// timeline widget
timelineWidget = new ReplayTimelineWidget;
timelineWidget->setTimeline(replayTimeline);
connect(timelineWidget, SIGNAL(processNextEvent()), this, SLOT(replayNextEvent()));
connect(timelineWidget, SIGNAL(processNextEvent(Player::EventProcessingOptions)), this,
SLOT(replayNextEvent(Player::EventProcessingOptions)));
connect(timelineWidget, SIGNAL(replayFinished()), this, SLOT(replayFinished()));
connect(timelineWidget, &ReplayTimelineWidget::rewound, this, &TabGame::replayRewind);

View file

@ -2,6 +2,7 @@
#define TAB_GAME_H
#include "../../client/tearoff_menu.h"
#include "../../game/player/player.h"
#include "pb/event_leave.pb.h"
#include "pb/serverinfo_game.pb.h"
#include "tab.h"
@ -47,7 +48,6 @@ class Event_Ping;
class Event_GameSay;
class Event_Kicked;
class Event_ReverseTurn;
class Player;
class CardZone;
class AbstractCardItem;
class CardItem;
@ -221,7 +221,7 @@ signals:
void openDeckEditor(const DeckLoader *deck);
void notIdle();
private slots:
void replayNextEvent();
void replayNextEvent(Player::EventProcessingOptions options);
void replayFinished();
void replayPlayButtonToggled(bool checked);
void replayFastForwardButtonToggled(bool checked);
@ -307,7 +307,9 @@ public:
return activeCard;
}
void processGameEventContainer(const GameEventContainer &cont, AbstractClient *client);
void processGameEventContainer(const GameEventContainer &cont,
AbstractClient *client,
Player::EventProcessingOptions options);
PendingCommand *prepareGameCommand(const ::google::protobuf::Message &cmd);
PendingCommand *prepareGameCommand(const QList<const ::google::protobuf::Message *> &cmdList);
public slots:

View file

@ -541,7 +541,7 @@ void TabSupervisor::processGameEventContainer(const GameEventContainer &cont)
{
TabGame *tab = gameTabs.value(cont.game_id());
if (tab)
tab->processGameEventContainer(cont, qobject_cast<AbstractClient *>(sender()));
tab->processGameEventContainer(cont, qobject_cast<AbstractClient *>(sender()), {});
else
qDebug() << "gameEvent: invalid gameId";
}