mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Updated code to support language specific cities.xml.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2319 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -577,6 +577,15 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
if(!ReadInMapStructure(fileName, FALSE))
|
||||
return FALSE;
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInMapStructure(fileName, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef RUSSIAN
|
||||
AddLanguagePrefix( fileName, RUSSIAN_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
@@ -586,9 +595,44 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GERMAN
|
||||
AddLanguagePrefix( fileName, GERMAN_PREFIX);
|
||||
#ifdef DUTCH
|
||||
AddLanguagePrefix( fileName, DUTCH_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInMapStructure(fileName, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef POLISH
|
||||
AddLanguagePrefix( fileName, POLISH_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInMapStructure(fileName, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef FRENCH
|
||||
AddLanguagePrefix( fileName, FRENCH_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInMapStructure(fileName, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef ITALIAN
|
||||
AddLanguagePrefix( fileName, ITALIAN_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
if(!ReadInMapStructure(fileName, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
#ifdef TAIWANESE
|
||||
AddLanguagePrefix( fileName, TAIWANESE_PREFIX);
|
||||
if ( FileExists(fileName) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||
|
||||
+20
-17
@@ -198,7 +198,7 @@ INT8 gbMercIsNewInThisSector[ MAX_NUM_SOLDIERS ];
|
||||
// the amount of time that a soldier will wait to return to desired/old squad
|
||||
#define DESIRE_SQUAD_RESET_DELAY 12 * 60
|
||||
|
||||
|
||||
BOOLEAN localizedMapTextOnly;
|
||||
|
||||
|
||||
UINT8 ubSAMControlledSectors[ MAP_WORLD_Y ][ MAP_WORLD_X ];// = {
|
||||
@@ -293,7 +293,7 @@ STR8 pHortStrings[]={
|
||||
"17",
|
||||
};
|
||||
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName);
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName, BOOLEAN localizedVersion);
|
||||
|
||||
void DoneFadeOutAdjacentSector( void );
|
||||
void DoneFadeOutExitGridSector( void );
|
||||
@@ -314,9 +314,6 @@ extern STR16 pBullseyeStrings[];
|
||||
|
||||
extern void HandleRPCDescription( );
|
||||
|
||||
BOOLEAN locTextOnly;
|
||||
|
||||
|
||||
#ifdef CRIPPLED_VERSION
|
||||
void CrippledVersionFailureToLoadMapCallBack( UINT8 bExitValue );
|
||||
void CrippledVersionFailureToLoadMapCheck();
|
||||
@@ -860,11 +857,14 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
||||
{
|
||||
pData->curElement = CITYTABLE_ELEMENT_CITYLIST;
|
||||
|
||||
memset(sBaseSectorList,0,sizeof(sBaseSectorList));
|
||||
memset(pTownPoints,0,sizeof(pTownPoints));
|
||||
memset(gfTownUsesLoyalty,0,sizeof(gfTownUsesLoyalty));
|
||||
memset(gubTownRebelSentiment,0,sizeof(gubTownRebelSentiment));
|
||||
memset(gfMilitiaAllowedInTown,0,sizeof(gfMilitiaAllowedInTown));
|
||||
if ( !localizedMapTextOnly )
|
||||
{
|
||||
memset(sBaseSectorList,0,sizeof(sBaseSectorList));
|
||||
memset(pTownPoints,0,sizeof(pTownPoints));
|
||||
memset(gfTownUsesLoyalty,0,sizeof(gfTownUsesLoyalty));
|
||||
memset(gubTownRebelSentiment,0,sizeof(gubTownRebelSentiment));
|
||||
memset(gfMilitiaAllowedInTown,0,sizeof(gfMilitiaAllowedInTown));
|
||||
}
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
@@ -872,7 +872,8 @@ citytableStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
||||
{
|
||||
pData->curElement = CITYTABLE_ELEMENT_CITY;
|
||||
|
||||
memset(&pData->curCityInfo,0,sizeof(cityInfo));
|
||||
if ( !localizedMapTextOnly )
|
||||
memset(&pData->curCityInfo,0,sizeof(cityInfo));
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
@@ -993,7 +994,7 @@ citytableEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
pData->curElement = CITYTABLE_ELEMENT_CITYLIST;
|
||||
|
||||
if ( pData->curCityInfo.uiIndex != INVALID_TOWN_INDEX )
|
||||
if ( pData->curCityInfo.uiIndex != INVALID_TOWN_INDEX && !localizedMapTextOnly)
|
||||
{
|
||||
sBaseSectorList [pData->curCityInfo.uiIndex-1] = SECTOR(pData->curCityInfo.ubBaseX,pData->curCityInfo.ubBaseY);
|
||||
pTownPoints [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townPoint;
|
||||
@@ -1003,6 +1004,10 @@ citytableEndElementHandle(void *userData, const XML_Char *name)
|
||||
//mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT);
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->curCityInfo.cityName, -1, pTownNames[pData->curCityInfo.uiIndex], MAX_TOWN_NAME_LENGHT);
|
||||
}
|
||||
else if ( pData->curCityInfo.uiIndex != INVALID_TOWN_INDEX && localizedMapTextOnly)
|
||||
{
|
||||
MultiByteToWideChar( CP_UTF8, 0, pData->curCityInfo.cityName, -1, pTownNames[pData->curCityInfo.uiIndex], MAX_TOWN_NAME_LENGHT);
|
||||
}
|
||||
}
|
||||
else if(strcmp(name, "uiIndex") == 0 && pData->curElement == CITYTABLE_ELEMENT_INDEX)
|
||||
{
|
||||
@@ -1155,7 +1160,7 @@ BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName)
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName, BOOLEAN localizedVersion)
|
||||
{
|
||||
HWFILE hFile;
|
||||
UINT32 uiBytesRead;
|
||||
@@ -1165,7 +1170,7 @@ BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName)
|
||||
|
||||
citytableParseData pData;
|
||||
|
||||
|
||||
localizedMapTextOnly = localizedVersion;
|
||||
|
||||
// Open weapons file
|
||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||
@@ -1222,9 +1227,7 @@ BOOLEAN ReadInMapStructure(STR fileName, BOOLEAN localizedVersion)
|
||||
{
|
||||
memset(StrategicMap, 0, sizeof(StrategicMap));
|
||||
|
||||
locTextOnly = localizedVersion;
|
||||
|
||||
return ReadInStrategicMapSectorTownNames(fileName);
|
||||
return ReadInStrategicMapSectorTownNames(fileName,localizedVersion);
|
||||
}
|
||||
|
||||
UINT32 UndergroundTacticalTraversalTime( INT8 bExitDirection )
|
||||
|
||||
@@ -82,7 +82,7 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
void UpdateMercInSector( SOLDIERTYPE *pSoldier, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
|
||||
|
||||
BOOLEAN ReadInMapStructure(STR fileName, BOOLEAN localizedVersion);
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName);
|
||||
BOOLEAN ReadInStrategicMapSectorTownNames(STR fileName, BOOLEAN localizedVersion);
|
||||
BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName);
|
||||
|
||||
// get short sector name without town name
|
||||
|
||||
Reference in New Issue
Block a user