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

Method placeUnit

game/state/battle/battle.cpp:1203–1218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201}
1202
1203sp<BattleUnit> Battle::placeUnit(GameState &state, StateRef<Agent> agent)
1204{
1205 auto unit = mksp<BattleUnit>();
1206 UString id = BattleUnit::generateObjectID(state);
1207 unit->id = id;
1208 unit->agent = agent;
1209 unit->strategyImages = state.battle_common_image_list->strategyImages;
1210 unit->genericHitSounds = state.battle_common_sample_list->genericHitSounds;
1211 unit->squadNumber = -1;
1212 unit->cloakTicksAccumulated = CLOAK_TICKS_REQUIRED_UNIT;
1213 unit->initCryTimer(state);
1214 unit->position = {-1.0, -1.0, -1.0};
1215 units[id] = unit;
1216 unit->init(state);
1217 return unit;
1218}
1219
1220sp<BattleUnit> Battle::placeUnit(GameState &state, StateRef<Agent> agent, Vec3<float> position)
1221{

Callers 2

fillSquadsMethod · 0.80
spawnUnitMethod · 0.80

Calls 3

initCryTimerMethod · 0.80
addObjectToMapMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected