Merged revision(s) 7798 from branches/ja2_source_official_2014:

Fix: Due to unknown circumstances, a GROUP's waypoints can be corrupted. This will cause incorrect movement and can crash the game. As we have no way of knowing where the group was supposed to move, we instead delete the waypoints and stop moving.

This does NOT fix the initial corruption of waypoints. That is a very troubling error that should be fixed ASAP!

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7800 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-03-29 15:44:26 +00:00
parent 6891d102c3
commit 01bdeb2c7f
2 changed files with 20 additions and 9 deletions
+11
View File
@@ -2712,6 +2712,17 @@ void InitiateGroupMovementToNextSector( GROUP *pGroup )
// the sector we are currently in
ubSector = (UINT8)SECTOR( pGroup->ubSectorX, pGroup->ubSectorY );
// Flugente: for unknown reasons, it is possible for waypoints to be filled with complete garbage. In this case we cannot use them.
// As we have no idea as to where this group was originally intended to go, and wandering around aimlessly would potentially be bad, we just stop moving...
if ( wp->x < 1 || wp->x > 16 || wp->y < 1 || wp->y > 16 )
{
ScreenMsg( FONT_YELLOW, MSG_ERROR, L"Group %d has corrupted waypoints. Cancelling movement!", pGroup->ubGroupID );
RemovePGroupWaypoints( pGroup );
return;
}
//We now have the correct waypoint.
//Analyse the group and determine which direction it will move from the current sector.
dx = wp->x - pGroup->ubSectorX;