mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Disease: Added support for language specific Disease files (German.Disease.xml, French.Disease.xml, ...)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8077 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -371,7 +371,16 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
|
|||||||
|
|
||||||
strcpy( fileName, directoryName );
|
strcpy( fileName, directoryName );
|
||||||
strcat( fileName, DISEASEFILENAME );
|
strcat( fileName, DISEASEFILENAME );
|
||||||
SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName ), DISEASEFILENAME );
|
SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME );
|
||||||
|
|
||||||
|
#ifndef ENGLISH
|
||||||
|
AddLanguagePrefix(fileName);
|
||||||
|
if ( FileExists(fileName) )
|
||||||
|
{
|
||||||
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
|
||||||
|
SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
strcpy(fileName, directoryName);
|
strcpy(fileName, directoryName);
|
||||||
strcat(fileName, STRUCTUREDECONSTRUCTFILENAME);
|
strcat(fileName, STRUCTUREDECONSTRUCTFILENAME);
|
||||||
|
|||||||
+1
-1
@@ -331,7 +331,7 @@ extern BOOLEAN ReadInFoodOpinionStats(STR fileName);
|
|||||||
extern BOOLEAN WriteFoodOpinionStats();
|
extern BOOLEAN WriteFoodOpinionStats();
|
||||||
|
|
||||||
// Flugente: disease
|
// Flugente: disease
|
||||||
extern BOOLEAN ReadInDiseaseStats( STR fileName );
|
BOOLEAN ReadInDiseaseStats( STR fileName, BOOLEAN localizedVersion );
|
||||||
extern BOOLEAN WriteDiseaseStats( );
|
extern BOOLEAN WriteDiseaseStats( );
|
||||||
|
|
||||||
// Flugente: structure (de-)construct
|
// Flugente: structure (de-)construct
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ struct
|
|||||||
}
|
}
|
||||||
typedef parseData;
|
typedef parseData;
|
||||||
|
|
||||||
|
BOOLEAN localizedTextOnly_Disease;
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char **atts )
|
diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char **atts )
|
||||||
{
|
{
|
||||||
@@ -34,7 +36,8 @@ diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char
|
|||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_LIST;
|
pData->curElement = ELEMENT_LIST;
|
||||||
|
|
||||||
memset( pData->curArray, 0, sizeof(DISEASE)*pData->maxArraySize );
|
if ( !localizedTextOnly_Disease )
|
||||||
|
memset( pData->curArray, 0, sizeof(DISEASE)*pData->maxArraySize );
|
||||||
|
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
@@ -42,7 +45,8 @@ diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char
|
|||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
memset( &pData->curItem, 0, sizeof(DISEASE) );
|
if ( !localizedTextOnly_Disease )
|
||||||
|
memset( &pData->curItem, 0, sizeof(DISEASE) );
|
||||||
|
|
||||||
// default value
|
// default value
|
||||||
pData->curItem.moralemodifier = 1.0f;
|
pData->curItem.moralemodifier = 1.0f;
|
||||||
@@ -135,7 +139,16 @@ diseaseEndElementHandle( void *userData, const XML_Char *name )
|
|||||||
// we do NOT want to read the first entry -> move stuff by 1
|
// we do NOT want to read the first entry -> move stuff by 1
|
||||||
if ( pData->curItem.uiIndex < pData->maxArraySize )
|
if ( pData->curItem.uiIndex < pData->maxArraySize )
|
||||||
{
|
{
|
||||||
pData->curArray[pData->curItem.uiIndex] = pData->curItem; //write the food into the table
|
if (localizedTextOnly_Disease)
|
||||||
|
{
|
||||||
|
wcscpy(Disease[pData->curItem.uiIndex].szName, pData->curItem.szName);
|
||||||
|
wcscpy(Disease[pData->curItem.uiIndex].szFatName, pData->curItem.szFatName);
|
||||||
|
wcscpy(Disease[pData->curItem.uiIndex].szDescription, pData->curItem.szDescription);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pData->curArray[pData->curItem.uiIndex] = pData->curItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( strcmp( name, "uiIndex" ) == 0 )
|
else if ( strcmp( name, "uiIndex" ) == 0 )
|
||||||
@@ -362,7 +375,7 @@ diseaseEndElementHandle( void *userData, const XML_Char *name )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN ReadInDiseaseStats( STR fileName )
|
BOOLEAN ReadInDiseaseStats( STR fileName, BOOLEAN localizedVersion )
|
||||||
{
|
{
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
UINT32 uiBytesRead;
|
UINT32 uiBytesRead;
|
||||||
@@ -374,6 +387,8 @@ BOOLEAN ReadInDiseaseStats( STR fileName )
|
|||||||
|
|
||||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Loading Disease.xml" );
|
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Loading Disease.xml" );
|
||||||
|
|
||||||
|
localizedTextOnly_Disease = localizedVersion;
|
||||||
|
|
||||||
// Open foods file
|
// Open foods file
|
||||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||||
if ( !hFile )
|
if ( !hFile )
|
||||||
|
|||||||
Reference in New Issue
Block a user