summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJosh Jones <kilauea.jones@gmail.com>2022-11-20 23:35:20 -0800
committerJosh Jones <kilauea.jones@gmail.com>2023-02-09 23:04:16 -0800
commitf978d74fd0098a5f4fe51108a036fcfb3f48d525 (patch)
treea4961b695244c4e908e47788da16fe166847371c /main
parent929ee61170ec4d431d6d2cfeddccdec2a59a11b7 (diff)
Allow compiling out the navigation module
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 3aa9a44a21..d5c602d19f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -72,6 +72,7 @@
#include "servers/movie_writer/movie_writer_mjpeg.h"
#include "servers/navigation_server_2d.h"
#include "servers/navigation_server_3d.h"
+#include "servers/navigation_server_3d_dummy.h"
#include "servers/physics_server_2d.h"
#include "servers/physics_server_3d.h"
#include "servers/register_server_types.h"
@@ -278,8 +279,21 @@ void finalize_display() {
void initialize_navigation_server() {
ERR_FAIL_COND(navigation_server_3d != nullptr);
+ // Init 3D Navigation Server
navigation_server_3d = NavigationServer3DManager::new_default_server();
+
+ // Fall back to dummy if no default server has been registered.
+ if (!navigation_server_3d) {
+ WARN_PRINT_ONCE("No NavigationServer3D implementation has been registered! Falling back to a dummy implementation: navigation features will be unavailable.");
+ navigation_server_3d = memnew(NavigationServer3DDummy);
+ }
+
+ // Should be impossible, but make sure it's not null.
+ ERR_FAIL_NULL_MSG(navigation_server_3d, "Failed to initialize NavigationServer3D.");
+
+ // Init 2D Navigation Server
navigation_server_2d = memnew(NavigationServer2D);
+ ERR_FAIL_NULL_MSG(navigation_server_2d, "Failed to initialize NavigationServer2D.");
}
void finalize_navigation_server() {