| 207 | } |
| 208 | |
| 209 | sp<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 | |
| 232 | sp<Vehicle> TileObjectVehicle::getVehicle() const { return this->vehicle.lock(); } |
| 233 |
nothing calls this directly
no test coverage detected