diff --git a/GameVersion.cpp b/GameVersion.cpp index 0081ff7a8..39c96e263 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.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8005 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8005 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8005 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8005 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8005 (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.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8005 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8005 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.7966 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8005 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 15.08.12" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 15.12.14" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Tactical/Drugs And Alcohol.h b/Tactical/Drugs And Alcohol.h index 3a24b93d5..118ec4c65 100644 --- a/Tactical/Drugs And Alcohol.h +++ b/Tactical/Drugs And Alcohol.h @@ -3,14 +3,13 @@ #include "Soldier Control.h" -class DRUG_EFFECT +typedef struct { -public: UINT8 effect; UINT16 duration; INT16 size; UINT8 chance; -}; +} DRUG_EFFECT; typedef struct { diff --git a/Tactical/XML_Drugs.cpp b/Tactical/XML_Drugs.cpp index a3ec3430d..71fb92f18 100644 --- a/Tactical/XML_Drugs.cpp +++ b/Tactical/XML_Drugs.cpp @@ -14,7 +14,7 @@ struct PARSE_STAGE curElement; CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - DRUG curDrugs; + UINT8 uiIndex; DRUG * curArray; UINT32 maxArraySize; @@ -47,7 +47,7 @@ drugsStartElementHandle(void *userData, const XML_Char *name, const XML_Char **a { pData->curElement = ELEMENT; - memset( &pData->curDrugs, 0, sizeof(DRUG) ); + memset( &pData->uiIndex, 0, sizeof(UINT8) ); pData->maxReadDepth++; //we are not skipping this element } @@ -182,25 +182,29 @@ drugsEndElementHandle(void *userData, const XML_Char *name) { pData->curElement = ELEMENT_LIST; - pData->curArray[pData->curDrugs.uiIndex] = pData->curDrugs; //write the drugs into the table + // silversurfer: this led to crashes of the debug build at game start with "Vector Iterators Incompatible" error message as well as non-functional drugs in the release build. + // The data will now be assigned directly below instead of using the placeholder "curDrugs". I removed the placeholder from drugsParseData and instead added uiIndex to store the index only. + // Assigning vectors with "=" breaks them! + //pData->curArray[pData->curDrugs.uiIndex] = pData->curDrugs; //write the drugs into the table } else if(strcmp(name, "uiIndex") == 0) { pData->curElement = ELEMENT; - pData->curDrugs.uiIndex = (UINT8)atol( pData->szCharData ); + pData->uiIndex = (UINT8)atol( pData->szCharData ); + pData->curArray[pData->uiIndex].uiIndex = pData->uiIndex; } else if(strcmp(name, "szName") == 0) { pData->curElement = ELEMENT; // not needed, but its there for informational purposes - MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curDrugs.szName, sizeof(pData->curDrugs.szName) / sizeof(pData->curDrugs.szName[0]) ); - pData->curDrugs.szName[sizeof(pData->curDrugs.szName) / sizeof(pData->curDrugs.szName[0]) - 1] = '\0'; + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curArray[pData->uiIndex].szName, sizeof(pData->curArray[pData->uiIndex].szName) / sizeof(pData->curArray[pData->uiIndex].szName[0]) ); + pData->curArray[pData->uiIndex].szName[sizeof(pData->curArray[pData->uiIndex].szName) / sizeof(pData->curArray[pData->uiIndex].szName[0]) - 1] = '\0'; } else if(strcmp(name, "opinionevent") == 0) { pData->curElement = ELEMENT; - pData->curDrugs.opinionevent = (BOOLEAN)atol( pData->szCharData ); + pData->curArray[pData->uiIndex].opinionevent = (BOOLEAN)atol( pData->szCharData ); } // Close opened Tags. @@ -208,25 +212,25 @@ drugsEndElementHandle(void *userData, const XML_Char *name) { pData->curElement = ELEMENT; - pData->curDrugs.drug_effects.push_back( pData->drug_effects ); + pData->curArray[pData->uiIndex].drug_effects.push_back( pData->drug_effects ); } else if ( strcmp( name, "DISEASE_EFFECT" ) == 0 ) { pData->curElement = ELEMENT; - pData->curDrugs.disease_effects.push_back( pData->disease_effects ); + pData->curArray[pData->uiIndex].disease_effects.push_back( pData->disease_effects ); } else if ( strcmp( name, "DISABILITY_EFFECT" ) == 0 ) { pData->curElement = ELEMENT; - pData->curDrugs.disability_effects.push_back( pData->disability_effects ); + pData->curArray[pData->uiIndex].disability_effects.push_back( pData->disability_effects ); } else if ( strcmp( name, "PERSONALITY_EFFECT" ) == 0 ) { pData->curElement = ELEMENT; - pData->curDrugs.personality_effects.push_back( pData->personality_effects ); + pData->curArray[pData->uiIndex].personality_effects.push_back( pData->personality_effects ); } else if ( pData->curElement == ELEMENT_DRUG_EFFECT_PROPERTY )