From 2475a7e8f577d6a533ba5c4885eb8ac637e571cc Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 3 Feb 2026 14:00:58 +0300 Subject: [PATCH] cleanup --- src/content/ContentControl.cpp | 2 - src/engine/ServerMainloop.cpp | 4 +- src/frontend/UiDocument.cpp | 6 +-- src/frontend/UiDocument.hpp | 8 +-- src/frontend/debug_panel.cpp | 12 ++--- src/frontend/hud.hpp | 2 - src/frontend/screens/LevelScreen.cpp | 5 +- src/graphics/core/Shadows.cpp | 70 +++++++++++++++----------- src/graphics/core/Shadows.hpp | 6 +-- src/graphics/render/ChunksRenderer.cpp | 8 +-- src/graphics/render/WorldRenderer.cpp | 8 +-- src/graphics/render/WorldRenderer.hpp | 4 +- src/graphics/ui/GUI.cpp | 2 +- src/logic/BlocksController.cpp | 2 +- src/logic/BlocksController.hpp | 6 +-- src/logic/EngineController.cpp | 6 +-- src/logic/LevelController.cpp | 7 ++- src/logic/LevelController.hpp | 3 +- src/logic/scripting/scripting.cpp | 2 +- src/logic/scripting/scripting.hpp | 4 +- 20 files changed, 88 insertions(+), 79 deletions(-) diff --git a/src/content/ContentControl.cpp b/src/content/ContentControl.cpp index f9b8d7736..6daf48dc0 100644 --- a/src/content/ContentControl.cpp +++ b/src/content/ContentControl.cpp @@ -52,8 +52,6 @@ std::vector& ContentControl::getBasePacks() { } void ContentControl::resetContent(const std::vector& nonReset) { - paths.setCurrentWorldFolder(""); - scripting::cleanup(nonReset); std::vector resRoots; { diff --git a/src/engine/ServerMainloop.cpp b/src/engine/ServerMainloop.cpp index 41887aeed..54698194e 100644 --- a/src/engine/ServerMainloop.cpp +++ b/src/engine/ServerMainloop.cpp @@ -1,7 +1,6 @@ #include "ServerMainloop.hpp" #include "Engine.hpp" -#include "EnginePaths.hpp" #include "logic/scripting/scripting.hpp" #include "logic/LevelController.hpp" #include "interfaces/Process.hpp" @@ -80,11 +79,10 @@ void ServerMainloop::run() { void ServerMainloop::setLevel(std::unique_ptr level) { if (level == nullptr) { controller->onWorldQuit(); - engine.getPaths().setCurrentWorldFolder(""); controller = nullptr; } else { controller = std::make_unique( - &engine, std::move(level), nullptr + engine, std::move(level), nullptr ); } } diff --git a/src/frontend/UiDocument.cpp b/src/frontend/UiDocument.cpp index c1269b879..a202c0d96 100644 --- a/src/frontend/UiDocument.cpp +++ b/src/frontend/UiDocument.cpp @@ -10,7 +10,7 @@ UiDocument::UiDocument( std::string id, - uidocscript script, + UiDocScript script, const std::shared_ptr& root, scriptenv env ) : id(std::move(id)), script(script), root(root), env(std::move(env)) { @@ -48,7 +48,7 @@ std::shared_ptr UiDocument::get(const std::string& id) const { return found->second.lock(); } -const uidocscript& UiDocument::getScript() const { +const UiDocScript& UiDocument::getScript() const { return script; } @@ -73,7 +73,7 @@ std::unique_ptr UiDocument::read( gui::UiXmlReader reader(gui, scriptenv(env)); auto view = reader.readXML(file.string(), *xmldoc->getRoot()); view->setId("root"); - uidocscript script {}; + UiDocScript script {}; auto scriptFile = io::path(file.string()+".lua"); if (io::is_regular_file(scriptFile)) { scripting::load_layout_script( diff --git a/src/frontend/UiDocument.hpp b/src/frontend/UiDocument.hpp index 8ebf7c3e6..57077bec0 100644 --- a/src/frontend/UiDocument.hpp +++ b/src/frontend/UiDocument.hpp @@ -13,7 +13,7 @@ namespace gui { class UINode; } -struct uidocscript { +struct UiDocScript { bool onopen : 1; bool onprogress : 1; bool onclose : 1; @@ -23,14 +23,14 @@ using UINodesMap = std::unordered_map>; class UiDocument { std::string id; - uidocscript script; + UiDocScript script; UINodesMap map; std::shared_ptr root; scriptenv env; public: UiDocument( std::string id, - uidocscript script, + UiDocScript script, const std::shared_ptr &root, scriptenv env ); @@ -42,7 +42,7 @@ public: const UINodesMap& getMap() const; std::shared_ptr getRoot() const; std::shared_ptr get(const std::string& id) const; - const uidocscript& getScript() const; + const UiDocScript& getScript() const; scriptenv getEnvironment() const; static std::unique_ptr read( diff --git a/src/frontend/debug_panel.cpp b/src/frontend/debug_panel.cpp index a9036b7ca..780bbf00a 100644 --- a/src/frontend/debug_panel.cpp +++ b/src/frontend/debug_panel.cpp @@ -1,9 +1,3 @@ -#include -#include -#include -#include -#include - #include "audio/audio.hpp" #include "constants.hpp" #include "content/Content.hpp" @@ -37,6 +31,12 @@ #include "world/Level.hpp" #include "world/World.hpp" +#include +#include +#include +#include +#include + using namespace gui; static std::shared_ptr