From 45ffb3302505a143ef17cbf16ae34c5b2b1c0671 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 16 Apr 2023 18:23:56 +0200 Subject: [PATCH] Add init() virtual methods to the navigation servers. --- main/main.cpp | 4 ++-- servers/navigation_2d_server.cpp | 3 +++ servers/navigation_2d_server.h | 2 ++ servers/navigation_server.cpp | 3 +++ servers/navigation_server.h | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index da589d25c..a565b0ebf 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -230,7 +230,7 @@ void initialize_navigation_server() { navigation_server = NavigationServerManager::new_default_server(); } ERR_FAIL_COND(!navigation_server); - //physics_server->init(); + navigation_server->init(); /// 2D Navigation server navigation_2d_server = Navigation2DServerManager::new_server(ProjectSettings::get_singleton()->get(Navigation2DServerManager::setting_property_name)); @@ -239,7 +239,7 @@ void initialize_navigation_server() { navigation_2d_server = Navigation2DServerManager::new_default_server(); } ERR_FAIL_COND(!navigation_2d_server); - //navigation_2d_server->init(); + navigation_2d_server->init(); } void finalize_navigation_server() { diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 43332b433..a1b5dd820 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -90,6 +90,9 @@ void Navigation2DServer::_bind_methods() { ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); } +void Navigation2DServer::init() { +} + Navigation2DServer::Navigation2DServer() { singleton = this; } diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h index 4e1d5aabc..a052fe696 100644 --- a/servers/navigation_2d_server.h +++ b/servers/navigation_2d_server.h @@ -184,6 +184,8 @@ public: /// Destroy the `RID` virtual void free(RID p_object) const = 0; + virtual void init(); + Navigation2DServer(); virtual ~Navigation2DServer(); }; diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index c301951a3..ee6f8404e 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -36,6 +36,9 @@ NavigationServer *NavigationServer::singleton = nullptr; +void NavigationServer::init() { +} + void NavigationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer::get_maps); diff --git a/servers/navigation_server.h b/servers/navigation_server.h index b67e24fde..715f751bd 100644 --- a/servers/navigation_server.h +++ b/servers/navigation_server.h @@ -213,6 +213,8 @@ public: /// Note: This function is not thread safe. virtual void process(real_t delta_time) = 0; + virtual void init(); + NavigationServer(); virtual ~NavigationServer(); };