Observe "not found" response

Took 18 minutes

Took 4 seconds
This commit is contained in:
Lukas Brübach 2026-05-24 21:18:50 +02:00
parent b44f927817
commit 25b7adba9f
3 changed files with 17 additions and 1 deletions

View file

@ -217,7 +217,20 @@ void GameEventHandler::handleArrowDeletion(int arrowId)
{ {
Command_DeleteArrow cmd; Command_DeleteArrow cmd;
cmd.set_arrow_id(arrowId); 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, void GameEventHandler::eventSpectatorSay(const Event_GameSay &event,

View file

@ -61,6 +61,7 @@ public:
void handleGameLeft(); void handleGameLeft();
void handleChatMessageSent(const QString &chatMessage); void handleChatMessageSent(const QString &chatMessage);
void handleArrowDeletion(int arrowId); void handleArrowDeletion(int arrowId);
void handleArrowDeletionFinished(const Response &response, int arrowId);
void eventSpectatorSay(const Event_GameSay &event, int eventPlayerId, const GameEventContext &context); void eventSpectatorSay(const Event_GameSay &event, int eventPlayerId, const GameEventContext &context);
void eventSpectatorLeave(const Event_Leave &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 containerProcessingStarted(GameEventContext context);
void setContextJudgeName(QString judgeName); void setContextJudgeName(QString judgeName);
void containerProcessingDone(); void containerProcessingDone();
void arrowDeleted(int arrowId);
void logSpectatorSay(ServerInfo_User userInfo, QString message); void logSpectatorSay(ServerInfo_User userInfo, QString message);
void logSpectatorLeave(QString name, QString reason); void logSpectatorLeave(QString name, QString reason);
void logGameStart(); void logGameStart();

View file

@ -1147,6 +1147,7 @@ void TabGame::createPlayAreaWidget(bool bReplay)
connect(game->getPlayerManager(), &PlayerManager::playerCountChanged, scene, &GameScene::rearrange); connect(game->getPlayerManager(), &PlayerManager::playerCountChanged, scene, &GameScene::rearrange);
connect(scene, &GameScene::requestArrowDeletion, game->getGameEventHandler(), connect(scene, &GameScene::requestArrowDeletion, game->getGameEventHandler(),
&GameEventHandler::handleArrowDeletion); &GameEventHandler::handleArrowDeletion);
connect(game->getGameEventHandler(), &GameEventHandler::arrowDeleted, scene, &GameScene::onArrowDeleted);
gameView = new GameView(scene); gameView = new GameView(scene);
auto gamePlayAreaVBox = new QVBoxLayout; auto gamePlayAreaVBox = new QVBoxLayout;