From bd7e2c5b8f5a1e2f17d94aa4cce6cb1919351906 Mon Sep 17 00:00:00 2001 From: Lesh Date: Mon, 9 Oct 2006 18:52:11 +0000 Subject: [PATCH] - enabled town names in cities.xml git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@597 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Strategic Town Loyalty.cpp | 2 +- Strategic/mapscreen.h | 6 ++++-- Strategic/strategicmap.cpp | 14 ++++++++++++++ Utils/Text.h | 3 ++- Utils/_DutchText.cpp | 2 +- Utils/_EnglishText.cpp | 2 +- Utils/_FrenchText.cpp | 2 +- Utils/_GermanText.cpp | 2 +- Utils/_ItalianText.cpp | 2 +- Utils/_PolishText.cpp | 2 +- Utils/_RussianText.cpp | 2 +- 11 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 181c7182..74cd637c 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -172,7 +172,7 @@ extern UINT32 guiNumWorldItems; // preprocess sector for mercs in it extern BOOLEAN fSectorsWithSoldiers[ MAP_WORLD_X * MAP_WORLD_X ][ 4 ]; -extern STR16 pTownNames[]; +extern CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT]; diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index d87c8069..38c64d3a 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -8,11 +8,12 @@ #define MAP_WORLD_X 18 #define MAP_WORLD_Y 18 +#define MAX_TOWN_NAME_LENGHT 32 // Sector name identifiers enum Towns { - BLANK_SECTOR=0, + BLANK_SECTOR=0, OMERTA, DRASSEN, ALMA, @@ -24,7 +25,8 @@ enum Towns ORTA, BALIME, MEDUNA, - CHITZENA, + CHITZENA, + NUM_TOWNS } ; diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 19fff3d5..aa263995 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -358,6 +358,7 @@ typedef enum CITYTABLE_ELEMENT_CITYLIST, CITYTABLE_ELEMENT_CITY, CITYTABLE_ELEMENT_INDEX, + CITYTABLE_ELEMENT_NAME, CITYTABLE_ELEMENT_BASESECTOR, CITYTABLE_ELEMENT_BASESECTOR_X, CITYTABLE_ELEMENT_BASESECTOR_Y, @@ -372,6 +373,7 @@ typedef struct UINT8 ubBaseX; UINT8 ubBaseY; POINT townPoint; + CHAR8 cityName[MAX_TOWN_NAME_LENGHT]; } cityInfo; typedef struct @@ -436,6 +438,11 @@ citytableStartElementHandle(void *userData, const char *name, const char **atts) pData->maxReadDepth++; //we are not skipping this element } + else if(strcmp(name, "cityName") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) + { + pData->curElement = CITYTABLE_ELEMENT_NAME; + pData->maxReadDepth++; //we are not skipping this element + } else if(strcmp(name, "uiIndex") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY) { pData->curElement = CITYTABLE_ELEMENT_INDEX; @@ -540,6 +547,13 @@ citytableEndElementHandle(void *userData, const char *name) pData->curCityInfo.uiIndex = atol(pData->szCharData); } + else if(strcmp(name, "cityName") == 0 && pData->curElement == CITYTABLE_ELEMENT_NAME) + { + // Copy this string into the pTownNames array + mbstowcs(pTownNames[pData->curCityInfo.uiIndex], (const char *) pData->szCharData, MAX_TOWN_NAME_LENGHT); + pTownNames[pData->curCityInfo.uiIndex][MAX_TOWN_NAME_LENGHT - 1] = 0; + pData->curElement = CITYTABLE_ELEMENT_CITY; + } else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_BASESECTOR) { pData->curElement = CITYTABLE_ELEMENT_CITY; diff --git a/Utils/Text.h b/Utils/Text.h index abc2ec36..dfd9192e 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -3,6 +3,7 @@ #include "items.h" #include "types.h" +#include "mapscreen.h" #define STRING_LENGTH 255 @@ -26,7 +27,7 @@ extern STR16 pLongAttributeStrings[]; extern STR16 pContractStrings[]; extern STR16 pAssignmentStrings[]; extern STR16 pConditionStrings[]; -extern STR16 pTownNames[]; +extern CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT]; // Lesh: look mapscreen.h for definitions extern STR16 pPersonnelScreenStrings[]; extern STR16 pPersonnelTitle[]; extern STR16 pUpperLeftMapScreenStrings[]; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index ed438eba..ebb38bf4 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -290,7 +290,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 2bc6771c..550bcc63 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -305,7 +305,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 95aa1dba..7732ef37 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -296,7 +296,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 778e8351..27ba0f34 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -295,7 +295,7 @@ UINT16 Message[][STRING_LENGTH] = L"kein Einzelschuss", }; -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 9544d763..3cb70e44 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -289,7 +289,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index ae83f804..19ef4ebd 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -290,7 +290,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Omerta", diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 98121867..d8158066 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -297,7 +297,7 @@ UINT16 Message[][STRING_LENGTH] = // the names of the towns in the game -STR16 pTownNames[] = +CHAR16 pTownNames[NUM_TOWNS][MAX_TOWN_NAME_LENGHT] = { L"", L"Îìåðòà",