🚨 Clamp imported UOA design values to their field ranges

Out-of-range tile, position, and hue values from a design file
truncated or raised range errors on import.
This commit is contained in:
2026-11-15 22:06:51 +01:00
parent 9903de9c24
commit d56149a4c1
+4 -4
View File
@@ -104,14 +104,14 @@ begin
raise Exception.Create('Unsupported binary version'); raise Exception.Create('Unsupported binary version');
tile := TStaticItem.Create(nil); tile := TStaticItem.Create(nil);
tile.TileID := ReadInt; tile.TileID := EnsureRange(ReadInt, 0, $FFFF);
tile.X := ReadInt; tile.X := EnsureRange(ReadInt, 0, $FFFF);
tile.Y := ReadInt; tile.Y := EnsureRange(ReadInt, 0, $FFFF);
tile.Z := EnsureRange(ReadInt, -128, 127); tile.Z := EnsureRange(ReadInt, -128, 127);
ReadInt; // Level; unused ReadInt; // Level; unused
if version = 1 then if version = 1 then
tile.Hue := ReadInt; tile.Hue := EnsureRange(ReadInt, 0, $FFFF);
FTiles.Add(tile); FTiles.Add(tile);
end; end;