mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Server: only run the loop if we have an attached NavMesh
This commit is contained in:
parent
bca3a595e5
commit
c72e34606b
@ -156,9 +156,11 @@ void Detour_HotSwap()
|
|||||||
Assert(ThreadInMainOrServerFrameThread());
|
Assert(ThreadInMainOrServerFrameThread());
|
||||||
g_pServerScript->ExecuteCodeCallback("CodeCallback_OnNavMeshHotSwapBegin");
|
g_pServerScript->ExecuteCodeCallback("CodeCallback_OnNavMeshHotSwapBegin");
|
||||||
|
|
||||||
const dtNavMesh* queryNav = g_pNavMeshQuery->getAttachedNavMesh();
|
const dtNavMesh* const queryNav = g_pNavMeshQuery->getAttachedNavMesh();
|
||||||
NavMeshType_e queryNavType = NAVMESH_INVALID;
|
NavMeshType_e queryNavType = NAVMESH_INVALID;
|
||||||
|
|
||||||
|
if (queryNav)
|
||||||
|
{
|
||||||
// Figure out which NavMesh type is attached to the global query.
|
// Figure out which NavMesh type is attached to the global query.
|
||||||
for (int i = 0; i < NAVMESH_COUNT; i++)
|
for (int i = 0; i < NAVMESH_COUNT; i++)
|
||||||
{
|
{
|
||||||
@ -170,6 +172,7 @@ void Detour_HotSwap()
|
|||||||
queryNavType = in;
|
queryNavType = in;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Free and re-init NavMesh.
|
// Free and re-init NavMesh.
|
||||||
Detour_LevelShutdown();
|
Detour_LevelShutdown();
|
||||||
@ -182,7 +185,7 @@ void Detour_HotSwap()
|
|||||||
// Attach the new NavMesh to the global Detour query.
|
// Attach the new NavMesh to the global Detour query.
|
||||||
if (queryNavType != NAVMESH_INVALID)
|
if (queryNavType != NAVMESH_INVALID)
|
||||||
{
|
{
|
||||||
const dtNavMesh* newQueryNav = Detour_GetNavMeshByType(queryNavType);
|
const dtNavMesh* const newQueryNav = Detour_GetNavMeshByType(queryNavType);
|
||||||
|
|
||||||
if (newQueryNav)
|
if (newQueryNav)
|
||||||
g_pNavMeshQuery->attachNavMeshUnsafe(newQueryNav);
|
g_pNavMeshQuery->attachNavMeshUnsafe(newQueryNav);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user