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

Method initMap

game/state/battle/battle.cpp:269–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void Battle::initMap()
270{
271 // If we were generating the map, then map parts are already initiated and we need to init the
272 // rest
273 if (!this->map)
274 {
275 this->map.reset(new TileMap(this->size, VELOCITY_SCALE_BATTLE,
276 {VOXEL_X_BATTLE, VOXEL_Y_BATTLE, VOXEL_Z_BATTLE}, layerMap));
277 for (auto &s : this->map_parts)
278 {
279 if (s->destroyed)
280 {
281 continue;
282 }
283 this->map->addObjectToMap(s);
284 if (s->type->exit)
285 {
286 exits.insert(s->position);
287 }
288 }
289 for (auto &h : this->hazards)
290 {
291 this->map->addObjectToMap(h);
292 }
293 for (auto &o : this->items)
294 {
295 this->map->addObjectToMap(o);
296 }
297 }
298 for (auto &u : this->units)
299 {
300 if (u.second->destroyed || u.second->retreated)
301 {
302 continue;
303 }
304 this->map->addObjectToMap(u.second);
305 }
306 for (auto &p : this->projectiles)
307 {
308 this->map->addObjectToMap(p);
309 }
310 for (auto &d : this->doodads)
311 {
312 this->map->addObjectToMap(d);
313 }
314}
315
316bool Battle::initialMapCheck(GameState &state, std::list<StateRef<Agent>> agents)
317{

Callers

nothing calls this directly

Calls 3

addObjectToMapMethod · 0.80
insertMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected