From 8fa45f387da7e9e605e8d136e081a14dc423b821 Mon Sep 17 00:00:00 2001
From: OTCv8 <otclient@otclient.ovh>
Date: Fri, 20 Nov 2020 14:15:44 +0100
Subject: [PATCH] Bot file name update, saving height for containers

---
 modules/corelib/ui/uiminiwindow.lua                            | 2 +-
 .../default_configs/vithrax_1.2/{eat food.lua => eat_food.lua} | 0
 modules/game_containers/containers.lua                         | 3 ++-
 3 files changed, 3 insertions(+), 2 deletions(-)
 rename modules/game_bot/default_configs/vithrax_1.2/{eat food.lua => eat_food.lua} (100%)

diff --git a/modules/corelib/ui/uiminiwindow.lua b/modules/corelib/ui/uiminiwindow.lua
index 6872dde..a1efabd 100644
--- a/modules/corelib/ui/uiminiwindow.lua
+++ b/modules/corelib/ui/uiminiwindow.lua
@@ -184,7 +184,7 @@ function UIMiniWindow:setup()
   self.miniLoaded = true
 
   if self.save then
-    if oldParent and oldParent:getClassName() == 'UIMiniWindowContainer' and not self.containerWindow then
+    if oldParent and oldParent:getClassName() == 'UIMiniWindowContainer' then
       addEvent(function() oldParent:order() end)
     end
     if newParent and newParent:getClassName() == 'UIMiniWindowContainer' and newParent ~= oldParent then
diff --git a/modules/game_bot/default_configs/vithrax_1.2/eat food.lua b/modules/game_bot/default_configs/vithrax_1.2/eat_food.lua
similarity index 100%
rename from modules/game_bot/default_configs/vithrax_1.2/eat food.lua
rename to modules/game_bot/default_configs/vithrax_1.2/eat_food.lua
diff --git a/modules/game_containers/containers.lua b/modules/game_containers/containers.lua
index 5aa2831..656eccc 100644
--- a/modules/game_containers/containers.lua
+++ b/modules/game_containers/containers.lua
@@ -167,7 +167,8 @@ function onContainerOpen(container, previousContainer)
   containerWindow:setContentMinimumHeight(cellSize.height)
   containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())
 
-  if not previousContainer then
+  local hasHeightInSettings = containerWindow:getSettings("height")
+  if not previousContainer and not hasHeightInSettings then
     local filledLines = math.max(math.ceil(container:getItemsCount() / layout:getNumColumns()), 1)
     containerWindow:setContentHeight(filledLines*cellSize.height)
   end