Fix out-of-range access check for legacy town entrance

Fix #745
This commit is contained in:
2025-05-24 15:16:15 -05:00
parent e7bf5847d0
commit dee6d988a6

View File

@@ -1244,8 +1244,8 @@ void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y) {
for(short tile_index = 0; tile_index < sector.city_locs.size(); tile_index++) {
auto city_loc = sector.city_locs[tile_index];
if(!univ.scenario.is_town_entrance_valid(city_loc) ||
!does_location_have_special(sector, city_loc, eTerSpec::TOWN_ENTRANCE) ||
!sector.is_on_map(city_loc)) {
!sector.is_on_map(city_loc) ||
!does_location_have_special(sector, city_loc, eTerSpec::TOWN_ENTRANCE)) {
continue;
}
auto town_pos_x = AREA_MEDIUM * quadrant_x + sector.city_locs[tile_index].x;