From 9a46c2a9fc48d75eff76bf4dda31e3fdc3968f9f Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 17 Jan 2017 20:32:31 +0000 Subject: [PATCH] - The number of possible IMP voices is no lnger limited - If no IMP voices could be read, IMP creation is not allowed git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8368 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Laptop/IMP Confirm.h | 4 +--- Laptop/IMP HomePage.cpp | 7 +++++++ Laptop/IMP Voices.cpp | 8 ++++---- Laptop/XML_IMPVoices.cpp | 9 ++++----- Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + 12 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Laptop/IMP Confirm.h b/Laptop/IMP Confirm.h index 463b1058..7ce9f6a6 100644 --- a/Laptop/IMP Confirm.h +++ b/Laptop/IMP Confirm.h @@ -60,9 +60,7 @@ typedef struct BOOLEAN exists; // set upon reading the xml: this voice exists } IMP_VOICESET; -#define NUM_IMP_VOICESETS 100 - -extern IMP_VOICESET gIMPVoice[NUM_IMP_VOICESETS]; +extern std::vector gIMPVoice; BOOLEAN AddCharacterToPlayersTeam( void ); BOOLEAN LoadImpCharacter( STR fileName ); diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index da15a7a0..8689cf85 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -401,6 +401,13 @@ void ProcessPlayerInputActivationString( void ) return; } + // Flugente: don't proceed if there are no voices + if ( gIMPVoice.empty() ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[13], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + return; + } + if (CountFilledIMPSlots(-1) < gGameOptions.ubMaxIMPCharacters) { // Kaiden: Need to reset skills, attributes and personalities with the new UB Method. diff --git a/Laptop/IMP Voices.cpp b/Laptop/IMP Voices.cpp index 2d75253d..67de2bdd 100644 --- a/Laptop/IMP Voices.cpp +++ b/Laptop/IMP Voices.cpp @@ -55,7 +55,7 @@ void IMPPortraitRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason ); void EnterIMPVoices( void ) { // Set the initial voice - for ( int i = 0; i < NUM_IMP_VOICESETS; ++i ) + for ( int i = 0; i < gIMPVoice.size(); ++i ) { // MALE is 0, FEMALE is 1, thus the negation if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex ) @@ -124,7 +124,7 @@ void IncrementVoice() { ++iCurrentVoice; - for ( int i = iCurrentVoice; i < NUM_IMP_VOICESETS; ++i ) + for ( int i = iCurrentVoice; i < gIMPVoice.size( ); ++i ) { if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex ) { @@ -134,7 +134,7 @@ void IncrementVoice() } // still here? Start from the beginning then - for ( int i = 0; i < NUM_IMP_VOICESETS; ++i ) + for ( int i = 0; i < gIMPVoice.size( ); ++i ) { if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex ) { @@ -158,7 +158,7 @@ void DecrementVoice( void ) } // still here? Start from the beginning then - for ( int i = NUM_IMP_VOICESETS - 1; i > 0; --i ) + for ( int i = gIMPVoice.size( ) - 1; i > 0; --i ) { if ( gIMPVoice[i].exists && !fCharacterIsMale == gIMPVoice[i].bSex ) { diff --git a/Laptop/XML_IMPVoices.cpp b/Laptop/XML_IMPVoices.cpp index f337aee3..428e97ef 100644 --- a/Laptop/XML_IMPVoices.cpp +++ b/Laptop/XML_IMPVoices.cpp @@ -23,7 +23,7 @@ struct } typedef impVoiceParseData; -IMP_VOICESET gIMPVoice[NUM_IMP_VOICESETS]; +std::vector gIMPVoice; static void XMLCALL impVoicesStartElementHandle( void *userData, const XML_Char *name, const XML_Char **atts ) @@ -87,10 +87,9 @@ impVoicesEndElementHandle( void *userData, const XML_Char *name ) { pData->curElement = ELEMENT_LIST; - wcscpy( gIMPVoice[pData->curIndex].szVoiceSetName, pData->curIMPVoice.szVoiceSetName ); - gIMPVoice[pData->curIndex].voiceset = pData->curIMPVoice.voiceset; - gIMPVoice[pData->curIndex].bSex = pData->curIMPVoice.bSex; - gIMPVoice[pData->curIndex].exists = TRUE; + pData->curIMPVoice.exists = TRUE; + + gIMPVoice.push_back( pData->curIMPVoice ); ++pData->curIndex; } diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index cc0be15d..f9c288e0 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -4765,6 +4765,7 @@ STR16 pImpPopUpStrings[] = L"你无法支付此I.M.P.人物的费用。", // 10 L"新的I.M.P.人物加入了你的队伍。", L"你已经设置了最大数量的佣兵特性。", + L"No voicesets found.", // TODO.Translate }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index ea681332..f5f5f27c 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -4769,6 +4769,7 @@ STR16 pImpPopUpStrings[] = L"You cannot afford the I.M.P character.", // 10 L"The new I.M.P character has joined your team.", L"You have already selected the maximum number of traits.", // TODO.Translate + L"No voicesets found.", // TODO.Translate }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index da5918d0..1f686c23 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -4766,6 +4766,7 @@ STR16 pImpPopUpStrings[] = L"You cannot afford the I.M.P character.", // 10 L"The new I.M.P character has joined your team.", L"You have already selected the maximum number of traits.", + L"No voicesets found.", }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 31a22b06..4472c949 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -4774,6 +4774,7 @@ STR16 pImpPopUpStrings[] = L"Vous n'avez pas les moyens.", // 10 L"Le nouvel IMP a rejoint votre escouade.", L"Vous avez déjà sélectionné le maximal de traits de caractères.", + L"No voicesets found.", // TODO.Translate }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index f4171c31..d2086574 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -4727,6 +4727,7 @@ STR16 pImpPopUpStrings[] = L"Sie können sich den B.S.E.-Charakter nicht leisten.", // 10 L"Der neue B.S.E.-Charakter ist nun in ihrem Team.", L"You have already selected the maximum number of traits.", // TODO.Translate + L"No voicesets found.", // TODO.Translate }; // button labels used on the IMP site diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index beb506da..2b9caa23 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -4762,6 +4762,7 @@ STR16 pImpPopUpStrings[] = L"You cannot afford the I.M.P character.", // 10 L"The new I.M.P character has joined your team.", L"You have already selected the maximum number of traits.", // TODO.Translate + L"No voicesets found.", // TODO.Translate }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 166bb0d3..8fadb6c7 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -4775,6 +4775,7 @@ STR16 pImpPopUpStrings[] = L"Nie stać cię na postać I.M.P.", // 10 L"Nowa postać I.M.P. dołączyła do oddziału.", L"You have already selected the maximum number of traits.", // TODO.Translate + L"No voicesets found.", // TODO.Translate }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 1666dc6e..65d00cbc 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -4766,6 +4766,7 @@ STR16 pImpPopUpStrings[] = L"Вы не можете позволить себе такой I.M.P.-персонаж.", // 10 L"Новый I.M.P.-персонаж присоединился к команде.", L"Вы уже выбрали максимальное количество навыков.", + L"No voicesets found.", // TODO.Translate };