mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
- Fix: possible crash if enemy forces arrive via non-group (enemy heli)
- Fix: possible crash when ordering militia to move if previous path was not properly cleared git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8541 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+9
-9
@@ -15,9 +15,9 @@
|
|||||||
#ifdef JA2EDITOR
|
#ifdef JA2EDITOR
|
||||||
|
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8541 (Development Build)" };
|
||||||
#else
|
#else
|
||||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8541 (Development Build)" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ------------------------------
|
// ------------------------------
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
|
|
||||||
//DEBUG BUILD VERSION
|
//DEBUG BUILD VERSION
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8541 (Development Build)" };
|
||||||
#elif defined (JA113DEMO)
|
#elif defined (JA113DEMO)
|
||||||
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8541 (Development Build)" };
|
||||||
#else
|
#else
|
||||||
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8541 (Development Build)" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined CRIPPLED_VERSION
|
#elif defined CRIPPLED_VERSION
|
||||||
@@ -46,16 +46,16 @@
|
|||||||
|
|
||||||
//RELEASE BUILD VERSION
|
//RELEASE BUILD VERSION
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8541 (Development Build)" };
|
||||||
#elif defined (JA113DEMO)
|
#elif defined (JA113DEMO)
|
||||||
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8541 (Development Build)" };
|
||||||
#else
|
#else
|
||||||
CHAR16 zVersionLabel[256] = { L"Release v1.13.8537 (Development Build)" };
|
CHAR16 zVersionLabel[256] = { L"Release v1.13.8541 (Development Build)" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CHAR8 czVersionNumber[16] = { "Build 18.03.04" }; //YY.MM.DD
|
CHAR8 czVersionNumber[16] = { "Build 18.03.08" }; //YY.MM.DD
|
||||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||||
|
|
||||||
// SAVE_GAME_VERSION is defined in header, change it there
|
// SAVE_GAME_VERSION is defined in header, change it there
|
||||||
|
|||||||
@@ -2442,8 +2442,6 @@ void HandleNonCombatGroupArrival( GROUP *pGroup, BOOLEAN fMainGroup, BOOLEAN fNe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//MilitiaFollowPlayer( pGroup->ubPrevX, pGroup->ubPrevY, pGroup->ubSectorX, pGroup->ubSectorY );
|
|
||||||
|
|
||||||
// look for NPCs to stop for, anyone is too tired to keep going, if all OK rebuild waypoints & continue movement
|
// look for NPCs to stop for, anyone is too tired to keep going, if all OK rebuild waypoints & continue movement
|
||||||
// NOTE: Only the main group (first group arriving) will stop for NPCs, it's just too much hassle to stop them all
|
// NOTE: Only the main group (first group arriving) will stop for NPCs, it's just too much hassle to stop them all
|
||||||
PlayerGroupArrivedSafelyInSector( pGroup, fMainGroup );
|
PlayerGroupArrivedSafelyInSector( pGroup, fMainGroup );
|
||||||
@@ -2501,7 +2499,7 @@ void HandleOtherGroupsArrivingSimultaneously( UINT8 ubSectorX, UINT8 ubSectorY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flugente: concealed spies are added if a battle occurs
|
// Flugente: concealed spies are added if a battle occurs
|
||||||
if ( !IsGroupTheHelicopterGroup( pArrivingGroup ) )
|
if ( pArrivingGroup && !IsGroupTheHelicopterGroup( pArrivingGroup ) )
|
||||||
{
|
{
|
||||||
UINT16 uiCnt = 0;
|
UINT16 uiCnt = 0;
|
||||||
SOLDIERTYPE* pSoldier = NULL;
|
SOLDIERTYPE* pSoldier = NULL;
|
||||||
|
|||||||
@@ -912,8 +912,6 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
INT16 sSector = 0;
|
INT16 sSector = 0;
|
||||||
INT16 sCurrentSector = -1;
|
INT16 sCurrentSector = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// is there in fact a path?
|
// is there in fact a path?
|
||||||
if( pNode == NULL )
|
if( pNode == NULL )
|
||||||
{
|
{
|
||||||
@@ -921,7 +919,6 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
return ( pNode );
|
return ( pNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get sector value
|
// get sector value
|
||||||
sSector = sX + ( sY * MAP_WORLD_X );
|
sSector = sX + ( sY * MAP_WORLD_X );
|
||||||
|
|
||||||
@@ -934,7 +931,6 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
// move through list
|
// move through list
|
||||||
while( ( pNode )&&( sSector != sCurrentSector ) )
|
while( ( pNode )&&( sSector != sCurrentSector ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// next value
|
// next value
|
||||||
pNode = pNode->pPrev;
|
pNode = pNode->pPrev;
|
||||||
|
|
||||||
@@ -952,7 +948,6 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
return ( pHeadOfPath );
|
return ( pHeadOfPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// we want to KEEP the target sector, not delete it, so advance to the next sector
|
// we want to KEEP the target sector, not delete it, so advance to the next sector
|
||||||
pNode = pNode->pNext;
|
pNode = pNode->pNext;
|
||||||
|
|
||||||
@@ -963,7 +958,6 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
return ( pHeadOfPath );
|
return ( pHeadOfPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if we're NOT about to clear the head (there's a previous entry)
|
// if we're NOT about to clear the head (there's a previous entry)
|
||||||
if( pNode->pPrev )
|
if( pNode->pPrev )
|
||||||
{
|
{
|
||||||
@@ -998,6 +992,103 @@ PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX
|
|||||||
MemFree( pDeleteNode );
|
MemFree( pDeleteNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear out last node
|
||||||
|
MemFree( pNode );
|
||||||
|
pNode = NULL;
|
||||||
|
pDeleteNode = NULL;
|
||||||
|
|
||||||
|
return( pHeadOfPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
PathStPtr ClearStrategicPathListBeforeThisSector( PathStPtr pHeadOfPath, INT16 sX, INT16 sY, INT16 sMvtGroup )
|
||||||
|
{
|
||||||
|
// will clear out a strategic path and return head of list as NULL
|
||||||
|
PathStPtr pNode = pHeadOfPath;
|
||||||
|
PathStPtr pDeleteNode = pHeadOfPath;
|
||||||
|
INT16 sSector = 0;
|
||||||
|
INT16 sCurrentSector = -1;
|
||||||
|
|
||||||
|
// is there in fact a path?
|
||||||
|
if ( pNode == NULL )
|
||||||
|
{
|
||||||
|
// no path, leave
|
||||||
|
return ( pNode );
|
||||||
|
}
|
||||||
|
|
||||||
|
// get sector value
|
||||||
|
sSector = sX + ( sY * MAP_WORLD_X );
|
||||||
|
|
||||||
|
// go to end of list
|
||||||
|
pNode = MoveToBeginningOfPathList( pNode );
|
||||||
|
|
||||||
|
// get current sector value
|
||||||
|
sCurrentSector = (INT16)pNode->uiSectorId;
|
||||||
|
|
||||||
|
// move through list
|
||||||
|
while ( ( pNode ) && ( sSector != sCurrentSector ) )
|
||||||
|
{
|
||||||
|
// next value
|
||||||
|
pNode = pNode->pNext;
|
||||||
|
|
||||||
|
// get current sector value
|
||||||
|
if ( pNode != NULL )
|
||||||
|
{
|
||||||
|
sCurrentSector = (INT16)pNode->uiSectorId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// did we find the target sector?
|
||||||
|
if ( pNode == NULL )
|
||||||
|
{
|
||||||
|
// nope, leave
|
||||||
|
return ( pHeadOfPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
// we want to KEEP the target sector, not delete it, so advance to the next sector
|
||||||
|
pNode = pNode->pPrev;
|
||||||
|
|
||||||
|
// is nothing left?
|
||||||
|
if ( pNode == NULL )
|
||||||
|
{
|
||||||
|
// that's it, leave
|
||||||
|
return ( pHeadOfPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're NOT about to clear the head (there's a previous entry)
|
||||||
|
if ( pNode->pNext )
|
||||||
|
{
|
||||||
|
// set next for tail to NULL
|
||||||
|
pNode->pNext->pPrev = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// clear head, return NULL
|
||||||
|
pHeadOfPath = ClearStrategicPathList( pHeadOfPath, sMvtGroup );
|
||||||
|
|
||||||
|
return ( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
pHeadOfPath = pNode->pNext;
|
||||||
|
|
||||||
|
// clear list
|
||||||
|
while ( pNode->pPrev )
|
||||||
|
{
|
||||||
|
// set up delete node
|
||||||
|
pDeleteNode = pNode;
|
||||||
|
|
||||||
|
// move to next node
|
||||||
|
pNode = pNode->pPrev;
|
||||||
|
|
||||||
|
// check if we are clearing the head of the list
|
||||||
|
if ( pDeleteNode == pHeadOfPath )
|
||||||
|
{
|
||||||
|
// null out head
|
||||||
|
pHeadOfPath = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete delete node
|
||||||
|
MemFree( pDeleteNode );
|
||||||
|
}
|
||||||
|
|
||||||
// clear out last node
|
// clear out last node
|
||||||
MemFree( pNode );
|
MemFree( pNode );
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ PathStPtr RemoveSectorFromStrategicPathList( PathStPtr pList , INT16 sX, INT16 s
|
|||||||
// clear out path list after/including this sector sX, sY..will start at end of path and work it's way back till sector is found...removes most recent sectors first
|
// clear out path list after/including this sector sX, sY..will start at end of path and work it's way back till sector is found...removes most recent sectors first
|
||||||
PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX, INT16 sY, INT16 sMvtGroup );
|
PathStPtr ClearStrategicPathListAfterThisSector( PathStPtr pHeadOfPath, INT16 sX, INT16 sY, INT16 sMvtGroup );
|
||||||
|
|
||||||
|
// similar to above, clear out the path from the start until the sector is found
|
||||||
|
PathStPtr ClearStrategicPathListBeforeThisSector( PathStPtr pHeadOfPath, INT16 sX, INT16 sY, INT16 sMvtGroup );
|
||||||
|
|
||||||
// get id of last sector in mercs path list
|
// get id of last sector in mercs path list
|
||||||
INT16 GetLastSectorIdInCharactersPath( SOLDIERTYPE *pCharacter );
|
INT16 GetLastSectorIdInCharactersPath( SOLDIERTYPE *pCharacter );
|
||||||
|
|
||||||
|
|||||||
+12
-16
@@ -8948,7 +8948,8 @@ void PollLeftButtonInMapView( UINT32 *puiNewEvent )
|
|||||||
}
|
}
|
||||||
else // clicked on a new sector
|
else // clicked on a new sector
|
||||||
{
|
{
|
||||||
gfAllowSkyriderTooFarQuote = TRUE;
|
if ( fPlotForHelicopter )
|
||||||
|
gfAllowSkyriderTooFarQuote = TRUE;
|
||||||
|
|
||||||
// draw new map route
|
// draw new map route
|
||||||
*puiNewEvent = MAP_EVENT_PLOT_PATH;
|
*puiNewEvent = MAP_EVENT_PLOT_PATH;
|
||||||
@@ -8981,7 +8982,6 @@ void PollRightButtonInMapView( UINT32 *puiNewEvent )
|
|||||||
static BOOLEAN fRBBeenPressedInMapView = FALSE;
|
static BOOLEAN fRBBeenPressedInMapView = FALSE;
|
||||||
INT16 sMapX, sMapY;
|
INT16 sMapX, sMapY;
|
||||||
|
|
||||||
|
|
||||||
// if the mouse is currently over the MAP area
|
// if the mouse is currently over the MAP area
|
||||||
if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA )
|
if ( gMapViewRegion.uiFlags & MSYS_MOUSE_IN_AREA )
|
||||||
{
|
{
|
||||||
@@ -12487,7 +12487,6 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone )
|
|||||||
return ( FALSE );
|
return ( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HandleSpontanousTalking( )
|
void HandleSpontanousTalking( )
|
||||||
{
|
{
|
||||||
// simply polls if the talking guy is done, if so...send an end command to continue dialogue
|
// simply polls if the talking guy is done, if so...send an end command to continue dialogue
|
||||||
@@ -12499,11 +12498,8 @@ void HandleSpontanousTalking( )
|
|||||||
ContinueDialogue( ( &Menptr[gCharactersList[bSelectedInfoChar].usSolID] ), TRUE );
|
ContinueDialogue( ( &Menptr[gCharactersList[bSelectedInfoChar].usSolID] ), TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY )
|
BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY )
|
||||||
{
|
{
|
||||||
PathStPtr *ppMovePath = NULL;
|
PathStPtr *ppMovePath = NULL;
|
||||||
@@ -12511,7 +12507,6 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY )
|
|||||||
INT32 iVehicleId = -1;
|
INT32 iVehicleId = -1;
|
||||||
PathStPtr pPreviousMercPath = NULL;
|
PathStPtr pPreviousMercPath = NULL;
|
||||||
|
|
||||||
|
|
||||||
// see if we have clicked on the last sector in the characters path
|
// see if we have clicked on the last sector in the characters path
|
||||||
|
|
||||||
// check if helicopter
|
// check if helicopter
|
||||||
@@ -12545,23 +12540,24 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY )
|
|||||||
// helicopter route confirmed
|
// helicopter route confirmed
|
||||||
if ( gMilitiaPath[gMilitiaGroupId].sGroupid > -1 && sX + (sY * MAP_WORLD_X) == GetLastSectorOfMilitiaPath( ) )
|
if ( gMilitiaPath[gMilitiaGroupId].sGroupid > -1 && sX + (sY * MAP_WORLD_X) == GetLastSectorOfMilitiaPath( ) )
|
||||||
{
|
{
|
||||||
// if confirm moving to another sector
|
// rebuild waypoints
|
||||||
//if( ( CheckForClickOverHelicopterIcon( sX, sY ) == FALSE ) )
|
ppMovePath = &( gMilitiaPath[gMilitiaGroupId].path );
|
||||||
|
|
||||||
|
// if our current sector is in our path, and we are not moving, we can obviously delete what came before it from the path
|
||||||
|
// (this was added as there were occasions where the previous path was not properly cleared even though the group was no longer travelling)
|
||||||
|
GROUP* pGroup = GetGroup( (UINT8)gMilitiaPath[gMilitiaGroupId].sGroupid );
|
||||||
|
|
||||||
|
if ( pGroup && pGroup->usGroupTeam == MILITIA_TEAM && !pGroup->fBetweenSectors )
|
||||||
{
|
{
|
||||||
// take off
|
*ppMovePath = ClearStrategicPathListBeforeThisSector( *ppMovePath, pGroup->ubSectorX, pGroup->ubSectorY, gMilitiaPath[gMilitiaGroupId].sGroupid );
|
||||||
//TakeOffHelicopter( );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rebuild waypoints - helicopter
|
|
||||||
ppMovePath = &(gMilitiaPath[gMilitiaGroupId].path);
|
|
||||||
RebuildWayPointsForGroupPath( *ppMovePath, (UINT8)gMilitiaPath[gMilitiaGroupId].sGroupid );
|
RebuildWayPointsForGroupPath( *ppMovePath, (UINT8)gMilitiaPath[gMilitiaGroupId].sGroupid );
|
||||||
|
|
||||||
// pointer to previous helicopter path
|
// pointer to previous path
|
||||||
pPreviousMercPath = gpMilitiaPreviousMercPath;
|
pPreviousMercPath = gpMilitiaPreviousMercPath;
|
||||||
|
|
||||||
fLastSectorInPath = TRUE;
|
fLastSectorInPath = TRUE;
|
||||||
|
|
||||||
//gMilitiaPlotStartSector = (INT16)(sX + sY*(MAP_WORLD_X));//SECTOR(sX, sY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // not doing helicopter movement
|
else // not doing helicopter movement
|
||||||
|
|||||||
Reference in New Issue
Block a user