| 2255 | } |
| 2256 | |
| 2257 | static void CopyLocalMap(df::world_data * worldData, df::world_region_details* worldRegionDetails, WorldMap * out) |
| 2258 | { |
| 2259 | int pos_x = worldRegionDetails->pos.x; |
| 2260 | int pos_y = worldRegionDetails->pos.y; |
| 2261 | out->set_map_x(pos_x); |
| 2262 | out->set_map_y(pos_y); |
| 2263 | out->set_world_width(17); |
| 2264 | out->set_world_height(17); |
| 2265 | std::string name = fmt::format("Region {}, {}", pos_x, pos_y); |
| 2266 | out->set_name_english(name); |
| 2267 | out->set_name(name); |
| 2268 | auto poles = worldData->flip_latitude; |
| 2269 | switch (poles) |
| 2270 | { |
| 2271 | case df::pole_type::None: |
| 2272 | out->set_world_poles(WorldPoles::NO_POLES); |
| 2273 | break; |
| 2274 | case df::pole_type::North: |
| 2275 | out->set_world_poles(WorldPoles::NORTH_POLE); |
| 2276 | break; |
| 2277 | case df::pole_type::South: |
| 2278 | out->set_world_poles(WorldPoles::SOUTH_POLE); |
| 2279 | break; |
| 2280 | case df::pole_type::Both: |
| 2281 | out->set_world_poles(WorldPoles::BOTH_POLES); |
| 2282 | break; |
| 2283 | default: |
| 2284 | break; |
| 2285 | } |
| 2286 | |
| 2287 | df::world_region_details * south = NULL; |
| 2288 | df::world_region_details * east = NULL; |
| 2289 | df::world_region_details * southEast = NULL; |
| 2290 | |
| 2291 | for (size_t i = 0; i < worldData->midmap_data.region_details.size(); i++) |
| 2292 | { |
| 2293 | auto region = worldData->midmap_data.region_details[i]; |
| 2294 | if (region->pos.x == pos_x + 1 && region->pos.y == pos_y + 1) |
| 2295 | southEast = region; |
| 2296 | else if (region->pos.x == pos_x + 1 && region->pos.y == pos_y) |
| 2297 | east = region; |
| 2298 | else if (region->pos.x == pos_x && region->pos.y == pos_y + 1) |
| 2299 | south = region; |
| 2300 | } |
| 2301 | |
| 2302 | for (int yy = 0; yy < 17; yy++) |
| 2303 | for (int xx = 0; xx < 17; xx++) |
| 2304 | { |
| 2305 | //This is because the bottom row doesn't line up. |
| 2306 | if (xx == 16 && yy == 16 && southEast != NULL) |
| 2307 | { |
| 2308 | out->add_elevation(southEast->elevation[0][0]); |
| 2309 | AddRegionTiles(out, ShiftCoords(df::coord2d(pos_x + 1, pos_y + 1), (southEast->biome[0][0])), worldData); |
| 2310 | } |
| 2311 | else if (xx == 16 && east != NULL) |
| 2312 | { |
| 2313 | out->add_elevation(east->elevation[0][yy]); |
| 2314 | AddRegionTiles(out, ShiftCoords(df::coord2d(pos_x + 1, pos_y), (east->biome[0][yy])), worldData); |
no test coverage detected