mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
- Fix: wrong final destination displayed for travelling militia
- Fix: when ordering militia movement, data of another group's path can be erased - Fix: a militia groups's path isn't always destroyed if the group is deleted - Fix: unsafe pointer handling can result in a gamecrash when loading strategic AI data from a savegame - Fix: traveltime calculations do not correctly handle waypoints, resulting in possible crashes git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7876 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3185,6 +3185,7 @@ INT32 CalculateTravelTimeOfGroup( GROUP *pGroup )
|
||||
{
|
||||
INT32 iDelta;
|
||||
UINT32 uiEtaTime = 0;
|
||||
INT32 i = 0;
|
||||
WAYPOINT *pNode = NULL;
|
||||
WAYPOINT pCurrent, pDest;
|
||||
// check if valid group
|
||||
@@ -3197,6 +3198,18 @@ INT32 CalculateTravelTimeOfGroup( GROUP *pGroup )
|
||||
// set up next node
|
||||
pNode = pGroup->pWaypoints;
|
||||
|
||||
// Flugente: start with the next waypoint we travel to, not the first one in the list
|
||||
i = pGroup->ubNextWaypointID;
|
||||
while ( i-- )
|
||||
{
|
||||
//Traverse through the waypoint list to the next waypoint ID
|
||||
if( pNode );
|
||||
pNode = pNode->next;
|
||||
}
|
||||
|
||||
if ( !pNode )
|
||||
return uiEtaTime;
|
||||
|
||||
// now get the delta in current sector and next sector
|
||||
iDelta = ( INT32 )( SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) - SECTOR( pGroup->ubNextX, pGroup->ubNextY ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user