MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / beginTurn

Method beginTurn

game/state/battle/battle.cpp:2321–2360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2319}
2320
2321void 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
2362void Battle::endTurn(GameState &state)
2363{

Callers 2

initBattleMethod · 0.45
initialUnitSpawnMethod · 0.45

Calls 3

stopAttackPsiMethod · 0.80
pushEventMethod · 0.80
beginTurnRoutineMethod · 0.45

Tested by

no test coverage detected