From 1ca34fcb4381682bd517612b530db22a1354a795 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sun, 6 Mar 2016 20:12:29 +0000 Subject: [PATCH] Fix nodes --- dlls/nodes.cpp | 18 +++++++++--------- dlls/nodes.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index 058260b3..1a55cd43 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -42,7 +42,7 @@ LINK_ENTITY_TO_CLASS( info_node, CNodeEnt ); LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ); #ifdef __linux__ #include -#include +#include #define CreateDirectory(p, n) mkdir(p, 0777) #endif //========================================================= @@ -515,13 +515,13 @@ int CGraph::NextNodeInRoute( int iCurrentNode, int iDest, int iHull, int iCap ) { int iNext = iCurrentNode; int nCount = iDest+1; - char *pRoute = m_pRouteInfo + m_pNodes[ iCurrentNode ].m_pNextBestNode[iHull][iCap]; + signed char *pRoute = m_pRouteInfo + m_pNodes[ iCurrentNode ].m_pNextBestNode[iHull][iCap]; // Until we decode the next best node // while (nCount > 0) { - char ch = *pRoute++; + signed char ch = *pRoute++; //ALERT(at_aiconsole, "C(%d)", ch); if (ch < 0) { @@ -2420,7 +2420,7 @@ int CGraph :: FLoadGraph ( char *szMapName ) // Malloc for the routing info. // m_fRoutingComplete = FALSE; - m_pRouteInfo = (char *)calloc( sizeof(char), m_nRouteInfo ); + m_pRouteInfo = (signed char *)calloc( sizeof(signed char), m_nRouteInfo ); if ( !m_pRouteInfo ) { ALERT ( at_aiconsole, "***ERROR**\nCounldn't malloc %d route bytes!\n", m_nRouteInfo ); @@ -2534,7 +2534,7 @@ int CGraph :: FSaveGraph ( char *szMapName ) // if ( m_pRouteInfo && m_nRouteInfo ) { - fwrite ( m_pRouteInfo, sizeof( char ), m_nRouteInfo, file ); + fwrite ( m_pRouteInfo, sizeof( signed char ), m_nRouteInfo, file ); } if (m_pHashLinks && m_nHashLinks) @@ -3035,7 +3035,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) int *pMyPath = new int[m_cNodes]; unsigned short *BestNextNodes = new unsigned short[m_cNodes]; - char *pRoute = new char[m_cNodes*2]; + signed char *pRoute = new signed char[m_cNodes*2]; if (Routes && pMyPath && BestNextNodes && pRoute) @@ -3129,7 +3129,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) int cSequence = 0; int cRepeats = 0; int CompressedSize = 0; - char *p = pRoute; + signed char *p = pRoute; for (int i = 0; i < m_cNodes; i++) { BOOL CanRepeat = ((BestNextNodes[i] == iLastNode) && cRepeats < 127); @@ -3289,7 +3289,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) } else { - char *Tmp = (char *)calloc(sizeof(char), (m_nRouteInfo + nRoute)); + signed char *Tmp = (signed char *)calloc(sizeof(signed char), (m_nRouteInfo + nRoute)); memcpy(Tmp, m_pRouteInfo, m_nRouteInfo); free(m_pRouteInfo); m_pRouteInfo = Tmp; @@ -3302,7 +3302,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) else { m_nRouteInfo = nRoute; - m_pRouteInfo = (char *)calloc(sizeof(char), nRoute); + m_pRouteInfo = (signed char *)calloc(sizeof(signed char), nRoute); memcpy(m_pRouteInfo, pRoute, nRoute); m_pNodes[ iFrom ].m_pNextBestNode[iHull][iCap] = 0; nTotalCompressedSize += CompressedSize; diff --git a/dlls/nodes.h b/dlls/nodes.h index 6b6739d6..cc1b6e20 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -116,7 +116,7 @@ public: CNode *m_pNodes;// pointer to the memory block that contains all node info CLink *m_pLinkPool;// big list of all node connections - char *m_pRouteInfo; // compressed routing information the nodes use. + signed char *m_pRouteInfo; // compressed routing information the nodes use. int m_cNodes;// total number of nodes int m_cLinks;// total number of links