Fix hidden towns being considered for non-town terrain types
- Caused a crash on Windows and mysterious black tiles on Mac
This commit is contained in:
@@ -3373,6 +3373,8 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
|
||||
}
|
||||
|
||||
void set_terrain(location l, ter_num_t terrain_type) {
|
||||
// TODO: Use dynamic size() instead of hard-coded limit
|
||||
if(terrain_type >= 256) return;
|
||||
ter_num_t former = univ.town->terrain(l.x,l.y);
|
||||
univ.town->terrain(l.x,l.y) = terrain_type;
|
||||
if(univ.scenario.ter_types[terrain_type].special == eTerSpec::CONVEYOR)
|
||||
@@ -3916,6 +3918,7 @@ void outdoor_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
|
||||
*redraw = 1;
|
||||
break;
|
||||
case eSpecType::OUT_CHANGE_TER:
|
||||
if(spec.ex2a < 0) break;
|
||||
univ.out->terrain[spec.ex1a][spec.ex1b] = spec.ex2a;
|
||||
l.x = spec.ex1a;
|
||||
l.y = spec.ex1b;
|
||||
|
@@ -1216,7 +1216,8 @@ void erase_out_specials() {
|
||||
if(quadrant_legal(i,j)) {
|
||||
cOutdoors& sector = *univ.scenario.outdoors[univ.party.outdoor_corner.x + i][univ.party.outdoor_corner.y + j];
|
||||
for(short k = 0; k < 18; k++) {
|
||||
if(i < 8 && sector.exit_dests[k] >= 0 &&
|
||||
if(k < 8 && sector.exit_dests[k] >= 0 &&
|
||||
univ.scenario.ter_types[sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y]].special == eTerSpec::TOWN_ENTRANCE &&
|
||||
(sector.exit_locs[k].x == minmax(0,47,sector.exit_locs[k].x)) &&
|
||||
(sector.exit_locs[k].y == minmax(0,47,sector.exit_locs[k].y))) {
|
||||
if(univ.party.can_find_town[sector.exit_dests[k]] == 0) {
|
||||
|
Reference in New Issue
Block a user