]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix 1x1 storage windows (#35985)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 29 Mar 2025 18:57:28 +0000 (05:57 +1100)
committerGitHub <noreply@github.com>
Sat, 29 Mar 2025 18:57:28 +0000 (19:57 +0100)
Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs

index a4afebc217b69e35b79f022d80148cf86988dcaf..39ffd883bb758d5c75bd7727181d6b2eb46d0a9b 100644 (file)
@@ -42,6 +42,9 @@ public sealed class StorageWindow : BaseWindow
     private ValueList<EntityUid> _contained = new();
     private ValueList<EntityUid> _toRemove = new();
 
+    // Manually store this because you can't have a 0x0 GridContainer but we still need to add child controls for 1x1 containers.
+    private Vector2i _pieceGridSize;
+
     private TextureButton? _backButton;
 
     private bool _isDirty;
@@ -408,11 +411,14 @@ public sealed class StorageWindow : BaseWindow
         _contained.Clear();
         _contained.AddRange(storageComp.Container.ContainedEntities.Reverse());
 
+        var width = boundingGrid.Width + 1;
+        var height = boundingGrid.Height + 1;
+
         // Build the grid representation
-        if (_pieceGrid.Rows - 1 != boundingGrid.Height || _pieceGrid.Columns - 1 != boundingGrid.Width)
+         if (_pieceGrid.Rows != _pieceGridSize.Y || _pieceGrid.Columns != _pieceGridSize.X)
         {
-            _pieceGrid.Rows = boundingGrid.Height + 1;
-            _pieceGrid.Columns = boundingGrid.Width + 1;
+            _pieceGrid.Rows = height;
+            _pieceGrid.Columns = width;
             _controlGrid.Clear();
 
             for (var y = boundingGrid.Bottom; y <= boundingGrid.Top; y++)
@@ -430,6 +436,7 @@ public sealed class StorageWindow : BaseWindow
             }
         }
 
+        _pieceGridSize = new(width, height);
         _toRemove.Clear();
 
         // Remove entities no longer relevant / Update existing ones