From 5dde7784de8cdf7490b93fbcb9abcdc08325283e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Fri, 29 Aug 2025 14:28:37 -0500 Subject: [PATCH] fix crash showing change site at edge of world --- src/scenedit/scen.undo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scenedit/scen.undo.cpp b/src/scenedit/scen.undo.cpp index 7f6bffcf..3d0ec7ec 100644 --- a/src/scenedit/scen.undo.cpp +++ b/src/scenedit/scen.undo.cpp @@ -65,6 +65,9 @@ void cTerrainAction::showChangeSite() { if(!((abs((short) (cen_x - area.where.x)) <=4) && (abs((short) (cen_y - area.where.y)) <= 4))){ cen_x = area.where.x; cen_y = area.where.y; + size_t max_dim = area.is_town ? town->max_dim : current_terrain->max_dim; + cen_x = minmax(4, max_dim - 5, cen_x); + cen_y = minmax(4, max_dim - 5, cen_y); } redraw_screen(); }