From 01bdeb2c7f8d434f005f2bf631395723982c24eb Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 29 Mar 2015 15:44:26 +0000 Subject: [PATCH] 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 --- GameVersion.cpp | 18 +++++++++--------- Strategic/Strategic Movement.cpp | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index ae5f1848..6c853696 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7800 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7800 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7800 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7800 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7800 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7800 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7800 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.7646 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.7800 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 14.11.3" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 15.03.29" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 7198ee2a..81d25c46 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -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;