|
|
@ -515,13 +515,13 @@ int CGraph::NextNodeInRoute( int iCurrentNode, int iDest, int iHull, int iCap ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int iNext = iCurrentNode; |
|
|
|
int iNext = iCurrentNode; |
|
|
|
int nCount = iDest+1; |
|
|
|
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
|
|
|
|
// Until we decode the next best node
|
|
|
|
//
|
|
|
|
//
|
|
|
|
while (nCount > 0) |
|
|
|
while (nCount > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char ch = *pRoute++; |
|
|
|
signed char ch = *pRoute++; |
|
|
|
//ALERT(at_aiconsole, "C(%d)", ch);
|
|
|
|
//ALERT(at_aiconsole, "C(%d)", ch);
|
|
|
|
if (ch < 0) |
|
|
|
if (ch < 0) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2420,7 +2420,7 @@ int CGraph :: FLoadGraph ( char *szMapName ) |
|
|
|
// Malloc for the routing info.
|
|
|
|
// Malloc for the routing info.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
m_fRoutingComplete = FALSE; |
|
|
|
m_fRoutingComplete = FALSE; |
|
|
|
m_pRouteInfo = (char *)calloc( sizeof(char), m_nRouteInfo ); |
|
|
|
m_pRouteInfo = (signed char *)calloc( sizeof(signed char), m_nRouteInfo ); |
|
|
|
if ( !m_pRouteInfo ) |
|
|
|
if ( !m_pRouteInfo ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ALERT ( at_aiconsole, "***ERROR**\nCounldn't malloc %d route bytes!\n", m_nRouteInfo ); |
|
|
|
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 ) |
|
|
|
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) |
|
|
|
if (m_pHashLinks && m_nHashLinks) |
|
|
@ -3035,7 +3035,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) |
|
|
|
|
|
|
|
|
|
|
|
int *pMyPath = new int[m_cNodes]; |
|
|
|
int *pMyPath = new int[m_cNodes]; |
|
|
|
unsigned short *BestNextNodes = new unsigned short[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) |
|
|
|
if (Routes && pMyPath && BestNextNodes && pRoute) |
|
|
@ -3129,7 +3129,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) |
|
|
|
int cSequence = 0; |
|
|
|
int cSequence = 0; |
|
|
|
int cRepeats = 0; |
|
|
|
int cRepeats = 0; |
|
|
|
int CompressedSize = 0; |
|
|
|
int CompressedSize = 0; |
|
|
|
char *p = pRoute; |
|
|
|
signed char *p = pRoute; |
|
|
|
for (int i = 0; i < m_cNodes; i++) |
|
|
|
for (int i = 0; i < m_cNodes; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BOOL CanRepeat = ((BestNextNodes[i] == iLastNode) && cRepeats < 127); |
|
|
|
BOOL CanRepeat = ((BestNextNodes[i] == iLastNode) && cRepeats < 127); |
|
|
@ -3289,7 +3289,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
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); |
|
|
|
memcpy(Tmp, m_pRouteInfo, m_nRouteInfo); |
|
|
|
free(m_pRouteInfo); |
|
|
|
free(m_pRouteInfo); |
|
|
|
m_pRouteInfo = Tmp; |
|
|
|
m_pRouteInfo = Tmp; |
|
|
@ -3302,7 +3302,7 @@ void CGraph :: ComputeStaticRoutingTables( void ) |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_nRouteInfo = nRoute; |
|
|
|
m_nRouteInfo = nRoute; |
|
|
|
m_pRouteInfo = (char *)calloc(sizeof(char), nRoute); |
|
|
|
m_pRouteInfo = (signed char *)calloc(sizeof(signed char), nRoute); |
|
|
|
memcpy(m_pRouteInfo, pRoute, nRoute); |
|
|
|
memcpy(m_pRouteInfo, pRoute, nRoute); |
|
|
|
m_pNodes[ iFrom ].m_pNextBestNode[iHull][iCap] = 0; |
|
|
|
m_pNodes[ iFrom ].m_pNextBestNode[iHull][iCap] = 0; |
|
|
|
nTotalCompressedSize += CompressedSize; |
|
|
|
nTotalCompressedSize += CompressedSize; |
|
|
|