diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index d35f72e80c..5bb3fa4b58 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -27,10 +27,7 @@ #include -#include -#include -#include -#include +#include #include "../mwbase/environment.hpp" #include "../mwbase/soundmanager.hpp" @@ -197,12 +194,11 @@ namespace MWWorld { auto navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager(); navigatorSettings.mSwimHeightScale = mSwimHeightScale; - DetourNavigator::RecastGlobalAllocator::init(); - mNavigator.reset(new DetourNavigator::NavigatorImpl(navigatorSettings)); + mNavigator = DetourNavigator::makeNavigator(navigatorSettings); } else { - mNavigator.reset(new DetourNavigator::NavigatorStub()); + mNavigator = DetourNavigator::makeNavigatorStub(); } mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, resourcePath, *mNavigator)); diff --git a/components/detournavigator/navigator.cpp b/components/detournavigator/navigator.cpp index 700217c52f..fc7b0ffb6d 100644 --- a/components/detournavigator/navigator.cpp +++ b/components/detournavigator/navigator.cpp @@ -1,6 +1,9 @@ #include "findrandompointaroundcircle.hpp" #include "navigator.hpp" #include "raycast.hpp" +#include "navigatorimpl.hpp" +#include "navigatorstub.hpp" +#include "recastglobalallocator.hpp" namespace DetourNavigator { @@ -33,4 +36,15 @@ namespace DetourNavigator return {}; return fromNavMeshCoordinates(settings, *result); } + + std::unique_ptr makeNavigator(const Settings& settings) + { + DetourNavigator::RecastGlobalAllocator::init(); + return std::make_unique(settings); + } + + std::unique_ptr makeNavigatorStub() + { + return std::make_unique(); + } } diff --git a/components/detournavigator/navigator.hpp b/components/detournavigator/navigator.hpp index 265d69b6e1..0ab351981a 100644 --- a/components/detournavigator/navigator.hpp +++ b/components/detournavigator/navigator.hpp @@ -240,6 +240,10 @@ namespace DetourNavigator virtual float getMaxNavmeshAreaRealRadius() const = 0; }; + + std::unique_ptr makeNavigator(const Settings& settings); + + std::unique_ptr makeNavigatorStub(); } #endif