From 2c5e85f8286c1c7bf574d5e94a8b1891d97df9f1 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Thu, 11 Aug 2016 13:48:38 +0000 Subject: [PATCH] Fix: VS2010 debug builds crashed while reading InteractiveActions.xml git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8284 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 18 +++++++++--------- Tactical/XML_InteractiveTiles.cpp | 18 +++++++++++------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 593de0b41..f57384cbe 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.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8284 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8284 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8284 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8284 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8284 (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.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8284 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8284 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.8281 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8284 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 16.08.06" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 16.08.11" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Tactical/XML_InteractiveTiles.cpp b/Tactical/XML_InteractiveTiles.cpp index 7281713bc..62cf4b55f 100644 --- a/Tactical/XML_InteractiveTiles.cpp +++ b/Tactical/XML_InteractiveTiles.cpp @@ -116,14 +116,18 @@ interactiveactionsEndElementHandle( void *userData, const XML_Char *name ) // for whatever reasons the game crashes in VS2008 Release builds when copying over the tilevector // this seems odd, as this works just fine in VS2010 and VS2013, and also works in VS205 debug builds // for now, copy over the content by hand - pData->curArray[pData->curIndex].tileindexvector = tileindexvector; - pData->curArray[pData->curIndex].gridnovector = gridnovector; + // check if the vector is empty because assigning an empty vector will crash VS2010 debug builds! + if ( !tileindexvector.empty() ) + { + pData->curArray[pData->curIndex].tileindexvector = tileindexvector; + tileindexvector.clear( ); + } - tileindexvector.clear( ); - tileindexvector.resize( 0 ); - - gridnovector.clear(); - gridnovector.resize( 0 ); + if ( !gridnovector.empty() ) + { + pData->curArray[pData->curIndex].gridnovector = gridnovector; + gridnovector.clear(); + } } pData->curIndex++;