Game: make AI utility class instance static

Static allocation instead of dynamic.
This commit is contained in:
Kawe Mazidjatari 2024-09-16 14:15:15 +02:00
parent 986fe4a93d
commit 0eb0d73ae1
3 changed files with 8 additions and 8 deletions

View File

@ -297,7 +297,7 @@ void DrawAllOverlays(bool bRender)
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
if (bOverlayEnabled) if (bOverlayEnabled)
{ {
g_pAIUtility->RunRenderFrame(); g_AIUtility.RunRenderFrame();
} }
#endif // !CLIENT_DLL #endif // !CLIENT_DLL

View File

@ -82,15 +82,15 @@ void CAI_Utility::RunRenderFrame(void)
const bool bUseDepthBuffer = r_debug_draw_depth_test.GetBool(); const bool bUseDepthBuffer = r_debug_draw_depth_test.GetBool();
if (iScriptNodeIndex > -1) if (iScriptNodeIndex > -1)
g_pAIUtility->DrawAIScriptNetwork(*g_pAINetwork, vCamera, iScriptNodeIndex, flCameraRange, bUseDepthBuffer); g_AIUtility.DrawAIScriptNetwork(*g_pAINetwork, vCamera, iScriptNodeIndex, flCameraRange, bUseDepthBuffer);
if (iNavMeshBVTreeIndex > -1) if (iNavMeshBVTreeIndex > -1)
g_pAIUtility->DrawNavMeshBVTree(nullptr, vCamera, vCullPlane, iNavMeshBVTreeIndex, flCameraRange, nTileRange, bUseDepthBuffer); g_AIUtility.DrawNavMeshBVTree(nullptr, vCamera, vCullPlane, iNavMeshBVTreeIndex, flCameraRange, nTileRange, bUseDepthBuffer);
if (iNavMeshPortalIndex > -1) if (iNavMeshPortalIndex > -1)
g_pAIUtility->DrawNavMeshPortals(nullptr, vCamera, vCullPlane, iNavMeshPortalIndex, flCameraRange, nTileRange, bUseDepthBuffer); g_AIUtility.DrawNavMeshPortals(nullptr, vCamera, vCullPlane, iNavMeshPortalIndex, flCameraRange, nTileRange, bUseDepthBuffer);
if (iNavMeshPolyIndex > -1) if (iNavMeshPolyIndex > -1)
g_pAIUtility->DrawNavMeshPolys(nullptr, vCamera, vCullPlane, iNavMeshPolyIndex, flCameraRange, nTileRange, bUseDepthBuffer); g_AIUtility.DrawNavMeshPolys(nullptr, vCamera, vCullPlane, iNavMeshPolyIndex, flCameraRange, nTileRange, bUseDepthBuffer);
if (iNavMeshPolyBoundIndex > -1) if (iNavMeshPolyBoundIndex > -1)
g_pAIUtility->DrawNavMeshPolyBoundaries(nullptr, vCamera, vCullPlane, iNavMeshPolyBoundIndex, flCameraRange, nTileRange, bUseDepthBuffer); g_AIUtility.DrawNavMeshPolyBoundaries(nullptr, vCamera, vCullPlane, iNavMeshPolyBoundIndex, flCameraRange, nTileRange, bUseDepthBuffer);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -723,4 +723,4 @@ int CAI_Utility::GetNearestNodeToPos(const CAI_Network* pAINetwork, const Vector
return result; return result;
} }
CAI_Utility* g_pAIUtility = new (CAI_Utility); CAI_Utility g_AIUtility;

View File

@ -66,5 +66,5 @@ private:
Color m_LinkColor; Color m_LinkColor;
}; };
extern CAI_Utility* g_pAIUtility; extern CAI_Utility g_AIUtility;
#endif // AI_UTILITY_SHARED_H #endif // AI_UTILITY_SHARED_H