| 152 | } |
| 153 | |
| 154 | static void normalize_item_vector(color_ostream &out, df::map_block *block, bool dry_run) { |
| 155 | bool needs_sorting = false; |
| 156 | int32_t prev_id = -1; |
| 157 | for (auto item_id : block->items) { |
| 158 | // do we need to handle duplicates as well? |
| 159 | if (item_id < prev_id) { |
| 160 | needs_sorting = true; |
| 161 | break; |
| 162 | } |
| 163 | prev_id = item_id; |
| 164 | } |
| 165 | if (needs_sorting) { |
| 166 | INFO(log,out).print("{} item list for map block at ({}, {}, {})\n", |
| 167 | dry_run ? "would fix" : "fixing", block->map_pos.x, block->map_pos.y, block->map_pos.z); |
| 168 | if (!dry_run) |
| 169 | std::sort(block->items.begin(), block->items.end()); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | static void reconcile_map_tile(color_ostream &out, df::building * bld, const df::tile_occupancy & expected_occ, |
| 174 | df::tile_occupancy & block_occ, bool dry_run, int x, int y, int z) |