From 7407781cacbce3aa4295f034df25d98ab27c99dc Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 25 May 2025 17:49:25 -0500 Subject: [PATCH] Fix scenario editor crash setting terrain at town edge --- src/scenedit/scen.actions.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 28266159..a9c35acc 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -2184,6 +2184,7 @@ void set_terrain(location l,ter_num_t terrain_type) { for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { location l3(l.x+x,l.y+y); + if(!cur_area->is_on_map(l3)) continue; ter_num_t ter_there = cur_area->terrain(l3.x,l3.y); unsigned int ground_there = scenario.ter_types[ter_there].ground_type; if(ground_there != main_ground && ground_there != trim_ground) { @@ -2204,6 +2205,7 @@ void set_terrain(location l,ter_num_t terrain_type) { // Adjusting terrains with trim for(location d : trim_diffs) { location l3(l.x+d.x, l.y+d.y); + if(!cur_area->is_on_map(l3)) continue; adjust_space(l3); }