Fix nodes

This commit is contained in:
mittorn 2016-03-06 20:12:29 +00:00
parent d9422fdb86
commit 1ca34fcb43
2 changed files with 10 additions and 10 deletions

View File

@ -42,7 +42,7 @@ LINK_ENTITY_TO_CLASS( info_node, CNodeEnt );
LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt );
#ifdef __linux__
#include <unistd.h>
#include <sys/stat.h>
#include <sys/stat.h>
#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;

View File

@ -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