| 30 | { |
| 31 | |
| 32 | TileMap::TileMap(Vec3<int> size, Vec3<float> velocityScale, Vec3<int> voxelMapSize, |
| 33 | std::vector<std::set<TileObject::Type>> layerMap) |
| 34 | : layerMap(layerMap), size(size), voxelMapSize(voxelMapSize), velocityScale(velocityScale) |
| 35 | { |
| 36 | tiles.reserve(size.x * size.y * size.z); |
| 37 | for (int z = 0; z < size.z; z++) |
| 38 | { |
| 39 | for (int y = 0; y < size.y; y++) |
| 40 | { |
| 41 | for (int x = 0; x < size.x; x++) |
| 42 | { |
| 43 | tiles.emplace_back(*this, Vec3<int>{x, y, z}, this->getLayerCount()); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // Quick sanity check of the layer map: |
| 49 | std::set<TileObject::Type> seenTypes; |
| 50 | for (auto &typesInLayer : layerMap) |
| 51 | { |
| 52 | for (auto &type : typesInLayer) |
| 53 | { |
| 54 | if (seenTypes.find(type) != seenTypes.end()) |
| 55 | { |
| 56 | LogError("Type %d appears in multiple layers", static_cast<int>(type)); |
| 57 | } |
| 58 | seenTypes.insert(type); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | TileMap::~TileMap() = default; |
| 64 |
nothing calls this directly
no test coverage detected