From a205b41ba5f7b0578af9118f7c4129c472f61792 Mon Sep 17 00:00:00 2001 From: Wanne Date: Wed, 20 Aug 2014 04:26:31 +0000 Subject: [PATCH] Merged from revision: 7397 Externalized History Log texts (by Jazz) - see TableData\History.xml - added support for language specific history (German.History.xml, French.History.xml, ...) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7399 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Init.cpp | 15 +++ Laptop/Laptop_VS2005.vcproj | 20 +-- Laptop/Laptop_VS2008.vcproj | 18 ++- Laptop/Laptop_VS2010.vcxproj | 1 + Laptop/Laptop_VS2010.vcxproj.filters | 3 + Laptop/Laptop_VS2013.vcxproj | 1 + Laptop/Laptop_VS2013.vcxproj.filters | 3 + Laptop/XML_History.cpp | 188 +++++++++++++++++++++++++++ Laptop/history.cpp | 83 ++++++++---- Laptop/history.h | 8 ++ Tactical/XML.h | 4 + Utils/ExportStrings.cpp | 2 +- Utils/Text.h | 2 +- Utils/_ChineseText.cpp | 3 + Utils/_DutchText.cpp | 3 + Utils/_EnglishText.cpp | 3 + Utils/_FrenchText.cpp | 3 + Utils/_GermanText.cpp | 3 + Utils/_ItalianText.cpp | 3 + Utils/_PolishText.cpp | 3 + Utils/_RussianText.cpp | 3 + 21 files changed, 327 insertions(+), 45 deletions(-) create mode 100644 Laptop/XML_History.cpp diff --git a/Init.cpp b/Init.cpp index 55ddd4b6..5c83cd48 100644 --- a/Init.cpp +++ b/Init.cpp @@ -1113,6 +1113,21 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) GetFileClose(&FileInfo); } } + + //History by Jazz + strcpy(fileName, directoryName); + strcat(fileName, HISTORYNAMEFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME); + +#ifndef ENGLISH + AddLanguagePrefix(fileName); + if ( FileExists(fileName) ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName); + } +#endif // IMP Portraits List by Jazz strcpy(fileName, directoryName); diff --git a/Laptop/Laptop_VS2005.vcproj b/Laptop/Laptop_VS2005.vcproj index da45b9a9..e12323eb 100644 --- a/Laptop/Laptop_VS2005.vcproj +++ b/Laptop/Laptop_VS2005.vcproj @@ -417,7 +417,11 @@ - + + + @@ -426,14 +430,10 @@ RelativePath=".\CampaignHistoryMain.h" > - - - + @@ -757,11 +757,11 @@ > + + diff --git a/Laptop/Laptop_VS2008.vcproj b/Laptop/Laptop_VS2008.vcproj index c142804f..cd1cba1d 100644 --- a/Laptop/Laptop_VS2008.vcproj +++ b/Laptop/Laptop_VS2008.vcproj @@ -1,7 +1,7 @@ + + @@ -426,10 +430,6 @@ RelativePath="CampaignHistoryMain.h" > - - @@ -747,11 +747,11 @@ > + + diff --git a/Laptop/Laptop_VS2010.vcxproj b/Laptop/Laptop_VS2010.vcxproj index aa845bb8..a82a8606 100644 --- a/Laptop/Laptop_VS2010.vcxproj +++ b/Laptop/Laptop_VS2010.vcxproj @@ -194,6 +194,7 @@ + diff --git a/Laptop/Laptop_VS2010.vcxproj.filters b/Laptop/Laptop_VS2010.vcxproj.filters index 086b6fe9..df9800c4 100644 --- a/Laptop/Laptop_VS2010.vcxproj.filters +++ b/Laptop/Laptop_VS2010.vcxproj.filters @@ -527,5 +527,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/Laptop/Laptop_VS2013.vcxproj b/Laptop/Laptop_VS2013.vcxproj index 0f870f41..48872100 100644 --- a/Laptop/Laptop_VS2013.vcxproj +++ b/Laptop/Laptop_VS2013.vcxproj @@ -194,6 +194,7 @@ + diff --git a/Laptop/Laptop_VS2013.vcxproj.filters b/Laptop/Laptop_VS2013.vcxproj.filters index db1ffffb..d3134a23 100644 --- a/Laptop/Laptop_VS2013.vcxproj.filters +++ b/Laptop/Laptop_VS2013.vcxproj.filters @@ -526,6 +526,9 @@ Source Files + + + Source Files \ No newline at end of file diff --git a/Laptop/XML_History.cpp b/Laptop/XML_History.cpp new file mode 100644 index 00000000..8d182cd4 --- /dev/null +++ b/Laptop/XML_History.cpp @@ -0,0 +1,188 @@ +#ifdef PRECOMPILEDHEADERS + #include "Tactical All.h" +#else + #include "sgp.h" + #include "Debug Control.h" + #include "expat.h" + #include "XML.h" + #include "Interface.h" + #include "Soldier Profile.h" + #include "Text.h" + #include "history.h" +#endif + +struct +{ + PARSE_STAGE curElement; + + CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; + HISTORY_VALUES curMercHistorys; + HISTORY_VALUES * curArray; + + UINT32 maxArraySize; + UINT32 curIndex; + UINT32 currentDepth; + UINT32 maxReadDepth; + //CHAR16 gzMercNames[MAX_ENEMY_NAMES_CHARS]; +} +typedef mercHistoryParseData; + +BOOLEAN MercHistory_TextOnly; + +static void XMLCALL +mercHistoryStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) +{ + mercHistoryParseData * pData = (mercHistoryParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? + { + if(strcmp(name, "STRINGS") == 0 && pData->curElement == ELEMENT_NONE) + { + pData->curElement = ELEMENT_LIST; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(strcmp(name, "TEXT") == 0 && pData->curElement == ELEMENT_LIST) + { + pData->curElement = ELEMENT; + + pData->maxReadDepth++; //we are not skipping this element + } + else if(pData->curElement == ELEMENT && + (strcmp(name, "uiIndex") == 0 || + strcmp(name, "sHistory") == 0 + )) + { + pData->curElement = ELEMENT_PROPERTY; + + pData->maxReadDepth++; //we are not skipping this element + } + + pData->szCharData[0] = '\0'; + } + + pData->currentDepth++; + +} + +static void XMLCALL +mercHistoryCharacterDataHandle(void *userData, const XML_Char *str, int len) +{ + mercHistoryParseData * pData = (mercHistoryParseData *)userData; + + if( (pData->currentDepth <= pData->maxReadDepth) && + (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) + ){ + strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); + } +} + + +static void XMLCALL +mercHistoryEndElementHandle(void *userData, const XML_Char *name) +{ + mercHistoryParseData * pData = (mercHistoryParseData *)userData; + + if(pData->currentDepth <= pData->maxReadDepth) + { + if(strcmp(name, "STRINGS") == 0) + { + pData->curElement = ELEMENT_NONE; + } + else if(strcmp(name, "TEXT") == 0) + { + pData->curElement = ELEMENT_LIST; + + if (!MercHistory_TextOnly) + { + wcscpy(HistoryName[pData->curMercHistorys.uiIndex].sHistory, pData->curMercHistorys.sHistory); + //wcscpy(pHistoryStrings[pData->curMercHistorys.uiIndex], pData->curMercHistorys.sHistory); + } + else + { + wcscpy(HistoryName[pData->curMercHistorys.uiIndex].sHistory, pData->curMercHistorys.sHistory); + //wcscpy(pHistoryStrings[pData->curMercHistorys.uiIndex], pData->curMercHistorys.sHistory); + } + + } + else if(strcmp(name, "uiIndex") == 0) + { + pData->curElement = ELEMENT; + pData->curMercHistorys.uiIndex = (UINT16) atol(pData->szCharData); + } + else if(strcmp(name, "sHistory") == 0) + { + pData->curElement = ELEMENT; + + MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curMercHistorys.sHistory, sizeof(pData->curMercHistorys.sHistory)/sizeof(pData->curMercHistorys.sHistory[0]) ); + pData->curMercHistorys.sHistory[sizeof(pData->curMercHistorys.sHistory)/sizeof(pData->curMercHistorys.sHistory[0]) - 1] = '\0'; + } + pData->maxReadDepth--; + } + pData->currentDepth--; +} + + + + +BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT32 uiFSize; + CHAR8 * lpcBuffer; + XML_Parser parser = XML_ParserCreate(NULL); + + mercHistoryParseData pData; + + DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading History.xml" ); + + MercHistory_TextOnly = localizedVersion; + + // Open file + hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); + if ( !hFile ) + return( localizedVersion ); + + uiFSize = FileGetSize(hFile); + lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); + + //Read in block + if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) + { + MemFree(lpcBuffer); + return( FALSE ); + } + + lpcBuffer[uiFSize] = 0; //add a null terminator + + FileClose( hFile ); + + + XML_SetElementHandler(parser, mercHistoryStartElementHandle, mercHistoryEndElementHandle); + XML_SetCharacterDataHandler(parser, mercHistoryCharacterDataHandle); + + + memset(&pData,0,sizeof(pData)); + XML_SetUserData(parser, &pData); + + + if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) + { + CHAR8 errorBuf[511]; + + sprintf(errorBuf, "XML Parser Error in History.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); + LiveMessage(errorBuf); + + MemFree(lpcBuffer); + return FALSE; + } + + MemFree(lpcBuffer); + + + XML_ParserFree(parser); + + + return( TRUE ); +} diff --git a/Laptop/history.cpp b/Laptop/history.cpp index f002617f..03d421e6 100644 --- a/Laptop/history.cpp +++ b/Laptop/history.cpp @@ -81,7 +81,7 @@ enum{ LAST_PAGE_BUTTON, }; - +HISTORY_VALUES HistoryName[500]; // the page flipping buttons INT32 giHistoryButton[4]; @@ -1082,65 +1082,81 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) switch( pHistory->ubCode) { case HISTORY_ENTERED_HISTORY_MODE: - swprintf(pString, pHistoryStrings[ HISTORY_ENTERED_HISTORY_MODE ]); + //swprintf(pString, pHistoryStrings[ HISTORY_ENTERED_HISTORY_MODE ]); + swprintf(pString, HistoryName[ HISTORY_ENTERED_HISTORY_MODE ].sHistory); break; case HISTORY_HIRED_MERC_FROM_AIM: - swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_AIM ], gMercProfiles[pHistory->ubSecondCode].zName ); + //swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_AIM ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf(pString, HistoryName[ HISTORY_HIRED_MERC_FROM_AIM ].sHistory, gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_MERC_KILLED: if( pHistory->ubSecondCode != NO_PROFILE ) - swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], gMercProfiles[pHistory->ubSecondCode].zName ); + //swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf(pString, HistoryName[ HISTORY_MERC_KILLED ].sHistory, gMercProfiles[pHistory->ubSecondCode].zName ); #ifdef JA2BETAVERSION else { - swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], L"ERROR!!! NO_PROFILE" ); + //swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], L"ERROR!!! NO_PROFILE" ); + swprintf(pString, HistoryName[ HISTORY_MERC_KILLED ].sHistory, L"ERROR!!! NO_PROFILE" ); } #endif break; case HISTORY_HIRED_MERC_FROM_MERC: - swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_MERC ], gMercProfiles[pHistory->ubSecondCode].zName ); + //swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_MERC ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf(pString, HistoryName[ HISTORY_HIRED_MERC_FROM_MERC ].sHistory, gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_SETTLED_ACCOUNTS_AT_MERC: - swprintf(pString, pHistoryStrings[ HISTORY_SETTLED_ACCOUNTS_AT_MERC ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_SETTLED_ACCOUNTS_AT_MERC ] ); + swprintf(pString, HistoryName[ HISTORY_SETTLED_ACCOUNTS_AT_MERC ].sHistory ); break; case HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO: - swprintf(pString, pHistoryStrings[ HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO ] ); + swprintf(pString, HistoryName[ HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO ].sHistory); break; case( HISTORY_CHARACTER_GENERATED ): - swprintf(pString, pHistoryStrings[ HISTORY_CHARACTER_GENERATED ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_CHARACTER_GENERATED ] ); + swprintf(pString, HistoryName[ HISTORY_CHARACTER_GENERATED ].sHistory ); break; case( HISTORY_PURCHASED_INSURANCE ): - swprintf(pString, pHistoryStrings[ HISTORY_PURCHASED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_PURCHASED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_PURCHASED_INSURANCE ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case( HISTORY_CANCELLED_INSURANCE ): - swprintf(pString, pHistoryStrings[ HISTORY_CANCELLED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_CANCELLED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_CANCELLED_INSURANCE ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case( HISTORY_INSURANCE_CLAIM_PAYOUT ): - swprintf(pString, pHistoryStrings[ HISTORY_INSURANCE_CLAIM_PAYOUT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_INSURANCE_CLAIM_PAYOUT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_INSURANCE_CLAIM_PAYOUT ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case HISTORY_EXTENDED_CONTRACT_1_DAY: - swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_DAY ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_DAY ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_EXTENDED_CONTRACT_1_DAY ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case HISTORY_EXTENDED_CONTRACT_1_WEEK: - swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_EXTENDED_CONTRACT_1_WEEK ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case HISTORY_EXTENDED_CONTRACT_2_WEEK: - swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_2_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_2_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_EXTENDED_CONTRACT_2_WEEK ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case( HISTORY_MERC_FIRED ): - swprintf(pString, pHistoryStrings[ HISTORY_MERC_FIRED ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_MERC_FIRED ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_MERC_FIRED ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case( HISTORY_MERC_QUIT ): - swprintf(pString, pHistoryStrings[ HISTORY_MERC_QUIT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf(pString, pHistoryStrings[ HISTORY_MERC_QUIT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf(pString, HistoryName[ HISTORY_MERC_QUIT ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case( HISTORY_QUEST_STARTED ): @@ -1154,42 +1170,52 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) break; case( HISTORY_TALKED_TO_MINER ): - swprintf(pString, pHistoryStrings[ HISTORY_TALKED_TO_MINER ], pTownNames[ pHistory->ubSecondCode ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_TALKED_TO_MINER ], pTownNames[ pHistory->ubSecondCode ] ); + swprintf(pString, HistoryName[ HISTORY_TALKED_TO_MINER ].sHistory, pTownNames[ pHistory->ubSecondCode ] ); break; case( HISTORY_LIBERATED_TOWN ): - swprintf(pString, pHistoryStrings[ HISTORY_LIBERATED_TOWN ], pTownNames[ pHistory->ubSecondCode ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_LIBERATED_TOWN ], pTownNames[ pHistory->ubSecondCode ] ); + swprintf(pString, HistoryName[ HISTORY_LIBERATED_TOWN ].sHistory, pTownNames[ pHistory->ubSecondCode ] ); break; case( HISTORY_CHEAT_ENABLED ): - swprintf(pString, pHistoryStrings[ HISTORY_CHEAT_ENABLED ] ); + //swprintf(pString, pHistoryStrings[ HISTORY_CHEAT_ENABLED ] ); + swprintf(pString, HistoryName[ HISTORY_CHEAT_ENABLED ].sHistory ); break; case HISTORY_TALKED_TO_FATHER_WALKER: - swprintf( pString, pHistoryStrings[ HISTORY_TALKED_TO_FATHER_WALKER ] ); + //swprintf( pString, pHistoryStrings[ HISTORY_TALKED_TO_FATHER_WALKER ] ); + swprintf( pString, HistoryName[ HISTORY_TALKED_TO_FATHER_WALKER ].sHistory ); break; case HISTORY_MERC_MARRIED_OFF: - swprintf( pString, pHistoryStrings[ HISTORY_MERC_MARRIED_OFF ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf( pString, pHistoryStrings[ HISTORY_MERC_MARRIED_OFF ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf( pString, HistoryName[ HISTORY_MERC_MARRIED_OFF ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; case HISTORY_MERC_CONTRACT_EXPIRED: - swprintf( pString, pHistoryStrings[ HISTORY_MERC_CONTRACT_EXPIRED ], gMercProfiles[pHistory->ubSecondCode].zName ); + //swprintf( pString, pHistoryStrings[ HISTORY_MERC_CONTRACT_EXPIRED ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf( pString, HistoryName[ HISTORY_MERC_CONTRACT_EXPIRED ].sHistory, gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_RPC_JOINED_TEAM: - swprintf( pString, pHistoryStrings[ HISTORY_RPC_JOINED_TEAM ], gMercProfiles[pHistory->ubSecondCode].zName ); + //swprintf( pString, pHistoryStrings[ HISTORY_RPC_JOINED_TEAM ], gMercProfiles[pHistory->ubSecondCode].zName ); + swprintf( pString, HistoryName[ HISTORY_RPC_JOINED_TEAM ].sHistory, gMercProfiles[pHistory->ubSecondCode].zName ); break; case HISTORY_ENRICO_COMPLAINED: - swprintf( pString, pHistoryStrings[ HISTORY_ENRICO_COMPLAINED ] ); + //swprintf( pString, pHistoryStrings[ HISTORY_ENRICO_COMPLAINED ] ); + swprintf( pString, HistoryName[ HISTORY_ENRICO_COMPLAINED ].sHistory ); break; case HISTORY_MINE_RUNNING_OUT: case HISTORY_MINE_RAN_OUT: case HISTORY_MINE_SHUTDOWN: case HISTORY_MINE_REOPENED: // all the same format - swprintf(pString, pHistoryStrings[ pHistory->ubCode ], pTownNames[ pHistory->ubSecondCode ] ); + //swprintf(pString, pHistoryStrings[ pHistory->ubCode ], pTownNames[ pHistory->ubSecondCode ] ); + swprintf(pString, HistoryName[ pHistory->ubCode ].sHistory, pTownNames[ pHistory->ubSecondCode ] ); break; case HISTORY_LOST_BOXING: case HISTORY_WON_BOXING: case HISTORY_DISQUALIFIED_BOXING: case HISTORY_NPC_KILLED: case HISTORY_MERC_KILLED_CHARACTER: - swprintf( pString, pHistoryStrings[ pHistory->ubCode ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + //swprintf( pString, pHistoryStrings[ pHistory->ubCode ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + swprintf( pString, HistoryName[ pHistory->ubCode ].sHistory, gMercProfiles[pHistory->ubSecondCode].zNickname ); break; // ALL SIMPLE HISTORY LOG MSGS, NO PARAMS @@ -1240,7 +1266,8 @@ void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) case HISTORY_SLAY_MYSTERIOUSLY_LEFT: case HISTORY_WALDO: case HISTORY_HELICOPTER_REPAIR_STARTED: - swprintf( pString, pHistoryStrings[ pHistory->ubCode ], pHistory->ubSecondCode ); + //swprintf( pString, pHistoryStrings[ pHistory->ubCode ], pHistory->ubSecondCode ); + swprintf( pString, HistoryName[ pHistory->ubCode ].sHistory, pHistory->ubSecondCode ); break; } diff --git a/Laptop/history.h b/Laptop/history.h index 8f0be18b..6fecf8d2 100644 --- a/Laptop/history.h +++ b/Laptop/history.h @@ -23,6 +23,14 @@ struct history{ struct history *Next; // next unit in the list }; +typedef struct +{ + UINT32 uiIndex; + CHAR16 sHistory[128]; + +} HISTORY_VALUES; + +extern HISTORY_VALUES HistoryName[500]; enum{ HISTORY_ENTERED_HISTORY_MODE=0, diff --git a/Tactical/XML.h b/Tactical/XML.h index 4999e430..e79de7fb 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -255,6 +255,8 @@ typedef PARSE_STAGE; #define MILITIA_REGULAR_PROFILE_FILENAME "Profiles\\SoldierProfileMilitiaRegular.xml" #define MILITIA_VETERAN_PROFILE_FILENAME "Profiles\\SoldierProfileMilitiaVeteran.xml" +#define HISTORYNAMEFILENAME "History.xml" + extern BOOLEAN ReadInItemStats(STR fileName, BOOLEAN localizedVersion); extern BOOLEAN WriteItemStats(); @@ -549,4 +551,6 @@ extern void InitNewVehicles (); extern BOOLEAN ReadInLanguageLocation(STR fileName, BOOLEAN localizedVersion, LANGUAGE_LOCATION *Lang, UINT32 FileType2 ); extern BOOLEAN ReadInAimOldArchive(STR fileName, BOOLEAN localizedVersion); + +extern BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion ); #endif diff --git a/Utils/ExportStrings.cpp b/Utils/ExportStrings.cpp index 104dd9c3..b79841b9 100644 --- a/Utils/ExportStrings.cpp +++ b/Utils/ExportStrings.cpp @@ -240,7 +240,7 @@ bool Loc::ExportStrings() ExportSection(props, L"FilesSender", Loc::pFilesSenderList, 0, 7); ExportSection(props, L"HistoryTitle", Loc::pHistoryTitle, 0, 1); ExportSection(props, L"HistoryHeader", Loc::pHistoryHeaders, 0, 5); - ExportSection(props, L"History", Loc::pHistoryStrings, 0, TEXT_NUM_HISTORY); + //ExportSection(props, L"History", Loc::pHistoryStrings, 0, TEXT_NUM_HISTORY); ExportSection(props, L"HistoryLocation", Loc::pHistoryLocations, 0, 1); ExportSection(props, L"LaptopIcon", Loc::pLaptopIcons, 0, 8); diff --git a/Utils/Text.h b/Utils/Text.h index f38ff386..31ba076a 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -273,7 +273,7 @@ extern STR16 pFilesTitle[]; extern STR16 pFilesSenderList[]; extern STR16 pHistoryLocations[]; //extern STR16 pHistoryAlternateStrings[]; -extern STR16 pHistoryStrings[]; +//extern STR16 pHistoryStrings[]; // Externalized to "TableData\History.xml" extern STR16 pHistoryHeaders[]; extern STR16 pHistoryTitle[]; extern STR16 pShowBookmarkString[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 12f8a9a9..b13b88a7 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -4196,6 +4196,8 @@ STR16 pHistoryHeaders[] = L"事件", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4301,6 +4303,7 @@ STR16 pHistoryStrings[] = L"碰到了 Waldo - 飞机机械师。",//L"Met Waldo - aircraft mechanic.", L"直升机维修开始. 预计时间: %d 小时(s)。",//L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 952084af..7bf7f668 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -4198,6 +4198,8 @@ STR16 pHistoryHeaders[] = L"Geb.", // the event label }; +/* +// Externalized to "TableData\History.xml" // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4303,6 +4305,7 @@ STR16 pHistoryStrings[] = L"Met Waldo - aircraft mechanic.", L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 30a0a6ef..a3a39404 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -4195,6 +4195,8 @@ STR16 pHistoryHeaders[] = L"Event", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4300,6 +4302,7 @@ STR16 pHistoryStrings[] = L"Met Waldo - aircraft mechanic.", L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index c329518b..fc9907bc 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -4208,6 +4208,8 @@ STR16 pHistoryHeaders[] = L"Événement", // the event label }; +/* +// Externalized to "TableData\History.xml" // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4313,6 +4315,7 @@ STR16 pHistoryStrings[] = L"Rencontre avec Waldo, mécanicien aéronautique.", L"Réparations de l'hélico ont débuté, temps estimé : %d h.", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index ca9fbdad..762e9595 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -4151,6 +4151,8 @@ STR16 pHistoryHeaders[] = L"Ereignis", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4256,6 +4258,7 @@ STR16 pHistoryStrings[] = L"Met Waldo - aircraft mechanic.", L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 4fe8d805..2917550a 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -4189,6 +4189,8 @@ STR16 pHistoryHeaders[] = L"Evento", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4294,6 +4296,7 @@ STR16 pHistoryStrings[] = L"Met Waldo - aircraft mechanic.", L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index b36d7bad..a7783e32 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -4205,6 +4205,8 @@ STR16 pHistoryHeaders[] = L"Zdarzenie", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4310,6 +4312,7 @@ STR16 pHistoryStrings[] = L"Spotkanie z Waldo - mechanikiem lotniczym.", L"Rozpoczęto naprawę helikoptera. Szacowany czas: %d godzin(y).", }; +*/ STR16 pHistoryLocations[] = { diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 2ebb7900..ac1f531c 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -4196,6 +4196,8 @@ STR16 pHistoryHeaders[] = L"Событие", // the event label }; +// Externalized to "TableData\History.xml" +/* // various history events // THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED. // PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS @@ -4301,6 +4303,7 @@ STR16 pHistoryStrings[] = L"Met Waldo - aircraft mechanic.", L"Helicopter repairs started. Estimated time: %d hour(s).", }; +*/ STR16 pHistoryLocations[] = {