From ee59bc988b695de44aebec534fcd0e8155a17b59 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 3 Apr 2021 10:39:34 +0200 Subject: [PATCH] fix: more aggressive memory management --- sonic-radiance.love/core/modules/menusystem/widgets/init.lua | 4 ++-- sonic-radiance.love/core/scenemanager.lua | 2 ++ sonic-radiance.love/game/abstractmobs/character.lua | 4 ++-- sonic-radiance.love/game/abstractmobs/ennemy.lua | 4 ++-- sonic-radiance.love/game/events/utils.lua | 2 +- sonic-radiance.love/game/modules/subgames/init.lua | 2 +- sonic-radiance.love/game/utils/battle/init.lua | 2 +- sonic-radiance.love/game/utils/choregraphy/init.lua | 2 +- sonic-radiance.love/game/utils/datas.lua | 2 +- sonic-radiance.love/main.lua | 4 ++-- 10 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sonic-radiance.love/core/modules/menusystem/widgets/init.lua b/sonic-radiance.love/core/modules/menusystem/widgets/init.lua index cd01267..2fd287f 100644 --- a/sonic-radiance.love/core/modules/menusystem/widgets/init.lua +++ b/sonic-radiance.love/core/modules/menusystem/widgets/init.lua @@ -23,8 +23,8 @@ local Widget = {} -BaseWidget = Object:extend() -TextWidget = BaseWidget:extend() +local BaseWidget = Object:extend() +local TextWidget = BaseWidget:extend() -- INIT FUNCTIONS -- Initialize and configure the widget diff --git a/sonic-radiance.love/core/scenemanager.lua b/sonic-radiance.love/core/scenemanager.lua index 1038b64..2541e9b 100644 --- a/sonic-radiance.love/core/scenemanager.lua +++ b/sonic-radiance.love/core/scenemanager.lua @@ -54,6 +54,7 @@ function SceneManager:setStoredScene(name) if storedScene ~= nil then self.currentScene = storedScene self.storage[name] = nil + collectgarbage() self.currentScene:restored() end end @@ -73,6 +74,7 @@ function SceneManager:update(dt) if (self.nextScene ~= nil) then self.currentScene = self.nextScene self.nextScene = nil + collectgarbage() end if (self.currentScene ~= nil) then diff --git a/sonic-radiance.love/game/abstractmobs/character.lua b/sonic-radiance.love/game/abstractmobs/character.lua index 6c24ec9..45c2172 100644 --- a/sonic-radiance.love/game/abstractmobs/character.lua +++ b/sonic-radiance.love/game/abstractmobs/character.lua @@ -1,6 +1,6 @@ -AbstractMobParent = require "game.abstractmobs.parent" +local AbstractMobParent = require "game.abstractmobs.parent" -AbstractCharacter = AbstractMobParent:extend() +local AbstractCharacter = AbstractMobParent:extend() local charutils = require "game.utils.characters" diff --git a/sonic-radiance.love/game/abstractmobs/ennemy.lua b/sonic-radiance.love/game/abstractmobs/ennemy.lua index f912aae..19ae413 100644 --- a/sonic-radiance.love/game/abstractmobs/ennemy.lua +++ b/sonic-radiance.love/game/abstractmobs/ennemy.lua @@ -1,6 +1,6 @@ -AbstractMobParent = require "game.abstractmobs.parent" +local AbstractMobParent = require "game.abstractmobs.parent" -AbstractEnnemy = AbstractMobParent:extend() +local AbstractEnnemy = AbstractMobParent:extend() local ennutils = require "game.utils.ennemies" diff --git a/sonic-radiance.love/game/events/utils.lua b/sonic-radiance.love/game/events/utils.lua index 5a27eec..cd7e992 100644 --- a/sonic-radiance.love/game/events/utils.lua +++ b/sonic-radiance.love/game/events/utils.lua @@ -1,4 +1,4 @@ -EventUtils = {} +local EventUtils = {} -- steps utils diff --git a/sonic-radiance.love/game/modules/subgames/init.lua b/sonic-radiance.love/game/modules/subgames/init.lua index 412706d..a3b9664 100644 --- a/sonic-radiance.love/game/modules/subgames/init.lua +++ b/sonic-radiance.love/game/modules/subgames/init.lua @@ -1,4 +1,4 @@ -Scene = require("core.modules.scenes") +local Scene = require("core.modules.scenes") local PlayStyle = Scene:extend() local PauseMenu = require("game.modules.subgames.pause") diff --git a/sonic-radiance.love/game/utils/battle/init.lua b/sonic-radiance.love/game/utils/battle/init.lua index fdd19c6..2a62ffc 100644 --- a/sonic-radiance.love/game/utils/battle/init.lua +++ b/sonic-radiance.love/game/utils/battle/init.lua @@ -1,4 +1,4 @@ -BattleUtils = {} +local BattleUtils = {} local datasutils = require "game.utils.datas" diff --git a/sonic-radiance.love/game/utils/choregraphy/init.lua b/sonic-radiance.love/game/utils/choregraphy/init.lua index 5f8f831..65b8243 100644 --- a/sonic-radiance.love/game/utils/choregraphy/init.lua +++ b/sonic-radiance.love/game/utils/choregraphy/init.lua @@ -1,4 +1,4 @@ -ChoregraphyUtils = {} +local ChoregraphyUtils = {} -- steps utils diff --git a/sonic-radiance.love/game/utils/datas.lua b/sonic-radiance.love/game/utils/datas.lua index 59de66a..1b7bf8e 100644 --- a/sonic-radiance.love/game/utils/datas.lua +++ b/sonic-radiance.love/game/utils/datas.lua @@ -1,4 +1,4 @@ -DataUtils = {} +local DataUtils = {} local DATADIR = "datas" local GAMEDATADIR = "gamedata" diff --git a/sonic-radiance.love/main.lua b/sonic-radiance.love/main.lua index 7298f68..3b334a3 100644 --- a/sonic-radiance.love/main.lua +++ b/sonic-radiance.love/main.lua @@ -21,8 +21,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -Core = require "core" -Game = require "game" +local Core = require "core" +local Game = require "game" scenes = require "scenes"