| 4044 | } |
| 4045 | |
| 4046 | bool BattleView::handleGameStateEvent(Event *e) |
| 4047 | { |
| 4048 | auto gameEvent = dynamic_cast<GameEvent *>(e); |
| 4049 | if (!gameEvent) |
| 4050 | { |
| 4051 | LogError("Invalid game state event"); |
| 4052 | return true; |
| 4053 | } |
| 4054 | if (!gameEvent->message().empty()) |
| 4055 | { |
| 4056 | state->logEvent(gameEvent); |
| 4057 | baseForm->findControlTyped<Ticker>("NEWS_TICKER")->addMessage(gameEvent->message()); |
| 4058 | if (battle.mode == Battle::Mode::RealTime) |
| 4059 | { |
| 4060 | bool pause = false; |
| 4061 | if (GameEvent::optionsMap.find(gameEvent->type) != GameEvent::optionsMap.end()) |
| 4062 | { |
| 4063 | pause = config().getBool(GameEvent::optionsMap.at(gameEvent->type)); |
| 4064 | } |
| 4065 | if (pause) |
| 4066 | { |
| 4067 | fw().stageQueueCommand({StageCmd::Command::PUSH, |
| 4068 | mksp<NotificationScreen>(state, *this, gameEvent->message(), |
| 4069 | gameEvent->type)}); |
| 4070 | } |
| 4071 | } |
| 4072 | } |
| 4073 | switch (gameEvent->type) |
| 4074 | { |
| 4075 | case GameEventType::ZoomView: |
| 4076 | if (GameLocationEvent *gle = dynamic_cast<GameLocationEvent *>(gameEvent)) |
| 4077 | { |
| 4078 | zoomAt(gle->location); |
| 4079 | } |
| 4080 | break; |
| 4081 | case GameEventType::AgentPsiProbed: |
| 4082 | { |
| 4083 | auto gameAgentEvent = dynamic_cast<GameAgentEvent *>(e); |
| 4084 | fw().stageQueueCommand( |
| 4085 | {StageCmd::Command::PUSH, mksp<AEquipScreen>(state, gameAgentEvent->agent)}); |
| 4086 | break; |
| 4087 | } |
| 4088 | case GameEventType::HostileDied: |
| 4089 | case GameEventType::AgentDiedBattle: |
| 4090 | case GameEventType::AgentUnconscious: |
| 4091 | // FIXME: there is no event on BattleMapPart destruction, so we cannot detect this and |
| 4092 | // update the path preview |
| 4093 | // a battleunit has died, potentially unblocking/changing the previewed path |
| 4094 | // but only update if there's a path stored |
| 4095 | if (previewedPathCost != PreviewedPathCostSpecial::NONE) |
| 4096 | { |
| 4097 | updatePathPreview(); |
| 4098 | } |
| 4099 | break; |
| 4100 | case GameEventType::HostileSpotted: |
| 4101 | if (battle.mode == Battle::Mode::TurnBased) |
| 4102 | { |
| 4103 | for (const auto &o : battle.units) |
nothing calls this directly
no test coverage detected