mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
Observe "not found" response
Took 18 minutes Took 4 seconds
This commit is contained in:
parent
b44f927817
commit
25b7adba9f
3 changed files with 17 additions and 1 deletions
|
|
@ -217,7 +217,20 @@ void GameEventHandler::handleArrowDeletion(int arrowId)
|
|||
{
|
||||
Command_DeleteArrow cmd;
|
||||
cmd.set_arrow_id(arrowId);
|
||||
sendGameCommand(cmd);
|
||||
|
||||
auto preparedCommand = prepareGameCommand(cmd);
|
||||
|
||||
connect(preparedCommand, &PendingCommand::finished, this,
|
||||
[arrowId, this](const Response &response) { handleArrowDeletionFinished(response, arrowId); });
|
||||
|
||||
sendGameCommand(preparedCommand);
|
||||
}
|
||||
|
||||
void GameEventHandler::handleArrowDeletionFinished(const Response &response, int arrowId)
|
||||
{
|
||||
if (response.response_code() == Response::RespNameNotFound) {
|
||||
emit arrowDeleted(arrowId);
|
||||
}
|
||||
}
|
||||
|
||||
void GameEventHandler::eventSpectatorSay(const Event_GameSay &event,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public:
|
|||
void handleGameLeft();
|
||||
void handleChatMessageSent(const QString &chatMessage);
|
||||
void handleArrowDeletion(int arrowId);
|
||||
void handleArrowDeletionFinished(const Response &response, int arrowId);
|
||||
|
||||
void eventSpectatorSay(const Event_GameSay &event, int eventPlayerId, const GameEventContext &context);
|
||||
void eventSpectatorLeave(const Event_Leave &event, int eventPlayerId, const GameEventContext &context);
|
||||
|
|
@ -112,6 +113,7 @@ signals:
|
|||
void containerProcessingStarted(GameEventContext context);
|
||||
void setContextJudgeName(QString judgeName);
|
||||
void containerProcessingDone();
|
||||
void arrowDeleted(int arrowId);
|
||||
void logSpectatorSay(ServerInfo_User userInfo, QString message);
|
||||
void logSpectatorLeave(QString name, QString reason);
|
||||
void logGameStart();
|
||||
|
|
|
|||
|
|
@ -1147,6 +1147,7 @@ void TabGame::createPlayAreaWidget(bool bReplay)
|
|||
connect(game->getPlayerManager(), &PlayerManager::playerCountChanged, scene, &GameScene::rearrange);
|
||||
connect(scene, &GameScene::requestArrowDeletion, game->getGameEventHandler(),
|
||||
&GameEventHandler::handleArrowDeletion);
|
||||
connect(game->getGameEventHandler(), &GameEventHandler::arrowDeleted, scene, &GameScene::onArrowDeleted);
|
||||
gameView = new GameView(scene);
|
||||
|
||||
auto gamePlayAreaVBox = new QVBoxLayout;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue