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

Method getVoxelMap

game/state/tilemap/tileobject_battleunit.cpp:404–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404sp<VoxelMap> TileObjectBattleUnit::getVoxelMap(Vec3<int> mapIndex, bool) const
405{
406 auto u = this->getUnit();
407 auto size = u->agent->type->bodyType->size.at(u->current_body_state).at(u->facing);
408 if (mapIndex.x >= size.x || mapIndex.y >= size.y || mapIndex.z >= size.z || mapIndex.x < 0 ||
409 mapIndex.y < 0 || mapIndex.z < 0)
410 return nullptr;
411
412 return u->agent->type->bodyType->voxelMaps.at(u->current_body_state)
413 .at(u->facing)
414 .at(mapIndex.z * size.y * size.x + mapIndex.y * size.x + mapIndex.x);
415}
416
417sp<BattleUnit> TileObjectBattleUnit::getUnit() const { return this->unit.lock(); }
418

Callers

nothing calls this directly

Calls 1

getUnitMethod · 0.95

Tested by

no test coverage detected