refactor EngineController
This commit is contained in:
@@ -69,10 +69,6 @@ void ContentGfxCache::refresh() {
|
||||
|
||||
ContentGfxCache::~ContentGfxCache() = default;
|
||||
|
||||
const Content* ContentGfxCache::getContent() const {
|
||||
return &content;
|
||||
}
|
||||
|
||||
const model::Model& ContentGfxCache::getModel(blockid_t id) const {
|
||||
const auto& found = models.find(id);
|
||||
if (found == models.end()) {
|
||||
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
|
||||
const model::Model& getModel(blockid_t id) const;
|
||||
|
||||
const Content* getContent() const;
|
||||
|
||||
void refresh(const Block& block, const Atlas& atlas);
|
||||
|
||||
void refresh();
|
||||
|
||||
@@ -101,14 +101,6 @@ Level& LevelFrontend::getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
const Level& LevelFrontend::getLevel() const {
|
||||
return level;
|
||||
}
|
||||
|
||||
const Assets& LevelFrontend::getAssets() const {
|
||||
return assets;
|
||||
}
|
||||
|
||||
ContentGfxCache& LevelFrontend::getContentGfxCache() {
|
||||
return *contentCache;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ public:
|
||||
~LevelFrontend();
|
||||
|
||||
Level& getLevel();
|
||||
const Level& getLevel() const;
|
||||
const Assets& getAssets() const;
|
||||
const ContentGfxCache& getContentGfxCache() const;
|
||||
ContentGfxCache& getContentGfxCache();
|
||||
LevelController* getController() const;
|
||||
|
||||
@@ -32,13 +32,12 @@ void menus::create_version_label(gui::GUI& gui) {
|
||||
));
|
||||
}
|
||||
|
||||
bool menus::call(Engine& engine, runnable func) {
|
||||
void menus::call(Engine& engine, runnable func) {
|
||||
if (engine.isHeadless()) {
|
||||
throw std::runtime_error("menus::call(...) in headless mode");
|
||||
}
|
||||
try {
|
||||
func();
|
||||
return true;
|
||||
} catch (const contentpack_error& error) {
|
||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||
// could not to find or read pack
|
||||
@@ -47,7 +46,7 @@ bool menus::call(Engine& engine, runnable func) {
|
||||
langs::get(L"error.pack-not-found") + L": " +
|
||||
util::str2wstr_utf8(error.getPackId())
|
||||
);
|
||||
return false;
|
||||
throw std::runtime_error(error);
|
||||
} catch (const assetload::error& error) {
|
||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||
guiutil::alert(
|
||||
@@ -55,11 +54,11 @@ bool menus::call(Engine& engine, runnable func) {
|
||||
langs::get(L"Assets Load Error", L"menu") + L":\n" +
|
||||
util::str2wstr_utf8(error.what())
|
||||
);
|
||||
return false;
|
||||
throw std::runtime_error(error);
|
||||
} catch (const parsing_error& error) {
|
||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||
guiutil::alert(engine, util::str2wstr_utf8(error.errorLog()));
|
||||
return false;
|
||||
throw std::runtime_error(error);
|
||||
} catch (const std::runtime_error& error) {
|
||||
engine.setScreen(std::make_shared<MenuScreen>(engine));
|
||||
guiutil::alert(
|
||||
@@ -67,7 +66,7 @@ bool menus::call(Engine& engine, runnable func) {
|
||||
langs::get(L"Content Error", L"menu") + L":\n" +
|
||||
util::str2wstr_utf8(error.what())
|
||||
);
|
||||
return false;
|
||||
throw std::runtime_error(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ namespace menus {
|
||||
const std::wstring& text = L""
|
||||
);
|
||||
|
||||
bool call(Engine& engine, runnable func);
|
||||
void call(Engine& engine, runnable func);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user