aboutsummaryrefslogtreecommitdiff
path: root/extension/src/GameSingleton.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-05-24 12:32:37 +0200
committer GitHub <noreply@github.com>2023-05-24 12:32:37 +0200
commit0a1a50cde54fee469bc0069978cd27a2bd1a2fb0 (patch)
tree2ba58efbe0ff3cfdc6f73b7a9e0bfab399d5e0d3 /extension/src/GameSingleton.cpp
parentac36a373139e3e815f70720b37d4ffc8d9062df9 (diff)
parentd6db91738ceee5cce9e7b7efc32bec89a83fa790 (diff)
Merge pull request #124 from OpenVicProject/bug-fixes
Date fix + string fix + Logger queue
Diffstat (limited to 'extension/src/GameSingleton.cpp')
-rw-r--r--extension/src/GameSingleton.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/extension/src/GameSingleton.cpp b/extension/src/GameSingleton.cpp
index cb7d0a7..e485cdc 100644
--- a/extension/src/GameSingleton.cpp
+++ b/extension/src/GameSingleton.cpp
@@ -12,9 +12,10 @@ using namespace OpenVic;
GameSingleton* GameSingleton::singleton = nullptr;
void GameSingleton::_bind_methods() {
+ ClassDB::bind_static_method("GameSingleton", D_METHOD("setup_logger"), &GameSingleton::setup_logger);
ClassDB::bind_method(D_METHOD("load_defines", "file_dict"), &GameSingleton::load_defines);
ClassDB::bind_method(D_METHOD("load_defines_compatibility_mode", "file_path"), &GameSingleton::load_defines_compatibility_mode);
- ClassDB::bind_method(D_METHOD("setup"), &GameSingleton::setup);
+ ClassDB::bind_method(D_METHOD("setup_game"), &GameSingleton::setup_game);
ClassDB::bind_method(D_METHOD("get_province_index_from_uv_coords", "coords"), &GameSingleton::get_province_index_from_uv_coords);
ClassDB::bind_method(D_METHOD("get_province_info_from_index", "index"), &GameSingleton::get_province_info_from_index);
@@ -88,7 +89,9 @@ GameSingleton::GameSingleton() : game_manager { [this]() { _on_state_updated();
terrain_variants { "terrain variants" } {
ERR_FAIL_COND(singleton != nullptr);
singleton = this;
+}
+void GameSingleton::setup_logger() {
Logger::set_info_func([](std::string&& str) { UtilityFunctions::print(std_to_godot_string(str)); });
Logger::set_error_func([](std::string&& str) { UtilityFunctions::push_error(std_to_godot_string(str)); });
}
@@ -162,7 +165,7 @@ GameSingleton::~GameSingleton() {
singleton = nullptr;
}
-Error GameSingleton::setup() {
+Error GameSingleton::setup_game() {
return ERR(game_manager.setup());
}