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 "logic/scripting/scripting.hpp"
|
||||||
#include "core_defs.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";
|
auto configFolder = root / "config";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ static std::vector<io::path> default_content_sources {
|
|||||||
ContentControl::ContentControl(
|
ContentControl::ContentControl(
|
||||||
const Project& project,
|
const Project& project,
|
||||||
EnginePaths& paths,
|
EnginePaths& paths,
|
||||||
Input& input,
|
Input* input,
|
||||||
std::function<void()> postContent
|
std::function<void()> postContent
|
||||||
)
|
)
|
||||||
: paths(paths),
|
: paths(paths),
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public:
|
|||||||
ContentControl(
|
ContentControl(
|
||||||
const Project& project,
|
const Project& project,
|
||||||
EnginePaths& paths,
|
EnginePaths& paths,
|
||||||
Input& input,
|
Input* input,
|
||||||
std::function<void()> postContent
|
std::function<void()> postContent
|
||||||
);
|
);
|
||||||
~ContentControl();
|
~ContentControl();
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
const std::vector<io::path>& getContentSources() const;
|
const std::vector<io::path>& getContentSources() const;
|
||||||
private:
|
private:
|
||||||
EnginePaths& paths;
|
EnginePaths& paths;
|
||||||
Input& input;
|
Input* input;
|
||||||
std::unique_ptr<Content> content;
|
std::unique_ptr<Content> content;
|
||||||
std::function<void()> postContent;
|
std::function<void()> postContent;
|
||||||
std::vector<std::string> basePacks;
|
std::vector<std::string> basePacks;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#include "coders/toml.hpp"
|
#include "coders/toml.hpp"
|
||||||
|
|
||||||
// All in-game definitions (blocks, items, etc..)
|
// 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& block = builder.blocks.create(CORE_AIR);
|
||||||
block.replaceable = true;
|
block.replaceable = true;
|
||||||
@ -28,8 +28,8 @@ void corecontent::setup(Input& input, ContentBuilder& builder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto bindsFile = "res:bindings.toml";
|
auto bindsFile = "res:bindings.toml";
|
||||||
if (io::is_regular_file(bindsFile)) {
|
if (input && io::is_regular_file(bindsFile)) {
|
||||||
input.getBindings().read(
|
input->getBindings().read(
|
||||||
toml::parse(bindsFile, io::read_string(bindsFile)), BindType::BIND
|
toml::parse(bindsFile, io::read_string(bindsFile)), BindType::BIND
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,5 +32,5 @@ class Input;
|
|||||||
class ContentBuilder;
|
class ContentBuilder;
|
||||||
|
|
||||||
namespace corecontent {
|
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())
|
langs::locale_by_envlocale(platform::detect_locale())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
content = std::make_unique<ContentControl>(*project, *paths, *input, [this]() {
|
content = std::make_unique<ContentControl>(
|
||||||
onContentLoad();
|
*project, *paths, input.get(), [this]() { onContentLoad(); }
|
||||||
});
|
);
|
||||||
scripting::initialize(this);
|
scripting::initialize(this);
|
||||||
|
|
||||||
if (!isHeadless()) {
|
if (!isHeadless()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user