diff --git a/src/content/ContentControl.cpp b/src/content/ContentControl.cpp index 4a7ed14f..f9b8d773 100644 --- a/src/content/ContentControl.cpp +++ b/src/content/ContentControl.cpp @@ -12,7 +12,7 @@ #include "logic/scripting/scripting.hpp" #include "core_defs.hpp" -static void load_configs(Input& input, const io::path& root) { +static void load_configs(Input* input, const io::path& root) { auto configFolder = root / "config"; } @@ -26,7 +26,7 @@ static std::vector default_content_sources { ContentControl::ContentControl( const Project& project, EnginePaths& paths, - Input& input, + Input* input, std::function postContent ) : paths(paths), diff --git a/src/content/ContentControl.hpp b/src/content/ContentControl.hpp index 1d1d48fc..72b7f579 100644 --- a/src/content/ContentControl.hpp +++ b/src/content/ContentControl.hpp @@ -19,7 +19,7 @@ public: ContentControl( const Project& project, EnginePaths& paths, - Input& input, + Input* input, std::function postContent ); ~ContentControl(); @@ -49,7 +49,7 @@ public: const std::vector& getContentSources() const; private: EnginePaths& paths; - Input& input; + Input* input; std::unique_ptr content; std::function postContent; std::vector basePacks; diff --git a/src/core_defs.cpp b/src/core_defs.cpp index a72d6eef..f30da728 100644 --- a/src/core_defs.cpp +++ b/src/core_defs.cpp @@ -10,7 +10,7 @@ #include "coders/toml.hpp" // All in-game definitions (blocks, items, etc..) -void corecontent::setup(Input& input, ContentBuilder& builder) { +void corecontent::setup(Input* input, ContentBuilder& builder) { { Block& block = builder.blocks.create(CORE_AIR); block.replaceable = true; @@ -28,8 +28,8 @@ void corecontent::setup(Input& input, ContentBuilder& builder) { } auto bindsFile = "res:bindings.toml"; - if (io::is_regular_file(bindsFile)) { - input.getBindings().read( + if (input && io::is_regular_file(bindsFile)) { + input->getBindings().read( toml::parse(bindsFile, io::read_string(bindsFile)), BindType::BIND ); } diff --git a/src/core_defs.hpp b/src/core_defs.hpp index d85d3448..e9e37a50 100644 --- a/src/core_defs.hpp +++ b/src/core_defs.hpp @@ -32,5 +32,5 @@ class Input; class ContentBuilder; namespace corecontent { - void setup(Input& input, ContentBuilder& builder); + void setup(Input* input, ContentBuilder& builder); } diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 4239531e..f79fae75 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -163,9 +163,9 @@ void Engine::initialize(CoreParameters coreParameters) { langs::locale_by_envlocale(platform::detect_locale()) ); } - content = std::make_unique(*project, *paths, *input, [this]() { - onContentLoad(); - }); + content = std::make_unique( + *project, *paths, input.get(), [this]() { onContentLoad(); } + ); scripting::initialize(this); if (!isHeadless()) {