From fbfd8e627f86f768acc02b09370833ebf3d88662 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 15 Nov 2026 14:27:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Clamp=20UOA=20design=20placement?= =?UTF-8?q?=20altitude=20in=20both=20directions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving a design only guarded the upper altitude bound, letting tile altitudes wrap past the signed range. --- Client/UfrmMain.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index c2e8565..b70cc57 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -2360,13 +2360,16 @@ end; procedure TfrmMain.MoveUoaDesign(AX, AY: Word; AZ: ShortInt); var - offsetX, offsetY, offsetZ, maxZ: Integer; + offsetX, offsetY, offsetZ, maxZ, minZ: Integer; item: TStaticItem; begin maxZ := Low(Integer); + minZ := High(Integer); for item in FCurrentUoaDesign.Tiles do - if item.Z > maxZ then - maxZ := item.Z; + begin + if item.Z > maxZ then maxZ := item.Z; + if item.Z < minZ then minZ := item.Z; + end; offsetX := AX - FCurrentUoaDesign.Header.Width div 2; offsetY := AY - FCurrentUoaDesign.Header.Height div 2; @@ -2380,6 +2383,8 @@ begin offsetY := FLandscape.CellHeight - FCurrentUoaDesign.Header.Height; if offsetZ + maxZ > 127 then offsetZ := 127 - maxZ; + if offsetZ + minZ < -128 then + offsetZ := -128 - minZ; for item in FCurrentUoaTiles do begin