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

Method beginBattle

game/state/battle/battle.cpp:2429–2448  ·  view source on GitHub ↗

To be called when battle must be started, before showing battle briefing screen In case battle is in a craft (UFO)

Source from the content-addressed store, hash-verified

2427// To be called when battle must be started, before showing battle briefing screen
2428// In case battle is in a craft (UFO)
2429void Battle::beginBattle(GameState &state, bool hotseat, StateRef<Organisation> opponent,
2430 std::list<StateRef<Agent>> &player_agents,
2431 const std::map<StateRef<AgentType>, int> *aliens,
2432 StateRef<Vehicle> player_craft, StateRef<Vehicle> target_craft)
2433{
2434 if (state.current_battle)
2435 {
2436 LogError("Battle::beginBattle called while another battle is in progress!");
2437 return;
2438 }
2439 auto b =
2440 BattleMap::createBattle(state, opponent, player_agents, aliens, player_craft, target_craft);
2441 if (!b)
2442 {
2443 return;
2444 }
2445 b->locationOwner = target_craft->owner;
2446 b->hotseat = hotseat;
2447 state.current_battle = b;
2448}
2449
2450// To be called when battle must be started, before showing battle briefing screen
2451// In case battle is in a building

Callers

nothing calls this directly

Calls 1

tryDisableBuildingMethod · 0.80

Tested by

no test coverage detected