fix headless mode fatal error in some systems
This commit is contained in:
parent
618b3d7f61
commit
bcfcd9ca76
@ -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<io::path> default_content_sources {
|
||||
ContentControl::ContentControl(
|
||||
const Project& project,
|
||||
EnginePaths& paths,
|
||||
Input& input,
|
||||
Input* input,
|
||||
std::function<void()> postContent
|
||||
)
|
||||
: paths(paths),
|
||||
|
||||
@ -19,7 +19,7 @@ public:
|
||||
ContentControl(
|
||||
const Project& project,
|
||||
EnginePaths& paths,
|
||||
Input& input,
|
||||
Input* input,
|
||||
std::function<void()> postContent
|
||||
);
|
||||
~ContentControl();
|
||||
@ -49,7 +49,7 @@ public:
|
||||
const std::vector<io::path>& getContentSources() const;
|
||||
private:
|
||||
EnginePaths& paths;
|
||||
Input& input;
|
||||
Input* input;
|
||||
std::unique_ptr<Content> content;
|
||||
std::function<void()> postContent;
|
||||
std::vector<std::string> basePacks;
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,5 +32,5 @@ class Input;
|
||||
class ContentBuilder;
|
||||
|
||||
namespace corecontent {
|
||||
void setup(Input& input, ContentBuilder& builder);
|
||||
void setup(Input* input, ContentBuilder& builder);
|
||||
}
|
||||
|
||||
@ -163,9 +163,9 @@ void Engine::initialize(CoreParameters coreParameters) {
|
||||
langs::locale_by_envlocale(platform::detect_locale())
|
||||
);
|
||||
}
|
||||
content = std::make_unique<ContentControl>(*project, *paths, *input, [this]() {
|
||||
onContentLoad();
|
||||
});
|
||||
content = std::make_unique<ContentControl>(
|
||||
*project, *paths, input.get(), [this]() { onContentLoad(); }
|
||||
);
|
||||
scripting::initialize(this);
|
||||
|
||||
if (!isHeadless()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user