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

Method updateBattlescapeUnitPresent

game/state/tilemap/tile.cpp:291–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void Tile::updateBattlescapeUnitPresent()
292{
293 firstUnitPresent = nullptr;
294 for (auto &o : intersectingObjects)
295 {
296 if (o->getType() == TileObject::Type::Unit)
297 {
298 auto u = std::static_pointer_cast<TileObjectBattleUnit>(o);
299 if (!firstUnitPresent)
300 {
301 firstUnitPresent = u;
302 }
303 auto pos = o->getPosition();
304 auto x = pos.x - position.x;
305 auto y = pos.y - position.y;
306 doorOpeningUnitPresent =
307 doorOpeningUnitPresent | (x > 0.45f && x < 0.55f && y > 0.45f && y < 0.55f) ||
308 u->getUnit()->isLarge();
309 if (firstUnitPresent && doorOpeningUnitPresent)
310 {
311 break;
312 }
313 }
314 }
315 if (!firstUnitPresent)
316 {
317 doorOpeningUnitPresent = false;
318 }
319}
320
321void Tile::updateCityscapeParameters()
322{

Callers 3

removeFromMapMethod · 0.80
setPositionMethod · 0.80

Calls 4

isLargeMethod · 0.80
getUnitMethod · 0.80
getTypeMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected