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

Method getVoxelMap

game/state/tilemap/tileobject_vehicle.cpp:209–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209sp<VoxelMap> TileObjectVehicle::getVoxelMap(Vec3<int> mapIndex, bool los) const
210{
211 auto v = this->getVehicle();
212 auto vtype = v->type;
213 auto facing = vtype->getVoxelMapFacing(v->facing);
214 auto size = vtype->size.at(facing);
215 if (mapIndex.x >= size.x || mapIndex.y >= size.y || mapIndex.z >= size.z)
216 {
217 return nullptr;
218 }
219 // Crashed vehicles have proper voxel models
220 if (los || v->crashed)
221 {
222 return vtype->voxelMapsLOS.at(facing).at(mapIndex.z * size.y * size.x +
223 mapIndex.y * size.x + mapIndex.x);
224 }
225 else
226 {
227 return vtype->voxelMaps.at(facing).at(mapIndex.z * size.y * size.x + mapIndex.y * size.x +
228 mapIndex.x);
229 }
230}
231
232sp<Vehicle> TileObjectVehicle::getVehicle() const { return this->vehicle.lock(); }
233

Callers

nothing calls this directly

Calls 2

getVehicleMethod · 0.95
getVoxelMapFacingMethod · 0.80

Tested by

no test coverage detected