| 2319 | } |
| 2320 | |
| 2321 | void Battle::beginTurn(GameState &state) |
| 2322 | { |
| 2323 | if (mode != Mode::TurnBased) |
| 2324 | { |
| 2325 | LogError("beginTurn called in real time?"); |
| 2326 | return; |
| 2327 | } |
| 2328 | |
| 2329 | // Cancel mind control |
| 2330 | for (auto &u : units) |
| 2331 | { |
| 2332 | if (u.second->owner != currentActiveOrganisation) |
| 2333 | { |
| 2334 | continue; |
| 2335 | } |
| 2336 | u.second->stopAttackPsi(state); |
| 2337 | } |
| 2338 | |
| 2339 | // Update everything related to this turn |
| 2340 | updateTBBegin(state); |
| 2341 | |
| 2342 | // Unit's begin turn routine |
| 2343 | for (auto &u : units) |
| 2344 | { |
| 2345 | if (u.second->owner != currentActiveOrganisation) |
| 2346 | { |
| 2347 | continue; |
| 2348 | } |
| 2349 | u.second->beginTurn(state); |
| 2350 | } |
| 2351 | |
| 2352 | aiBlock.beginTurnRoutine(state, currentActiveOrganisation); |
| 2353 | |
| 2354 | for (auto &p : participants) |
| 2355 | { |
| 2356 | ticksWithoutSeenAction[p] = TICKS_PER_TURN; |
| 2357 | } |
| 2358 | |
| 2359 | fw().pushEvent(new GameBattleEvent(GameEventType::NewTurn, shared_from_this())); |
| 2360 | } |
| 2361 | |
| 2362 | void Battle::endTurn(GameState &state) |
| 2363 | { |
no test coverage detected