mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- updated cities.xml handling code so now it is possible to control can player train militia in town or not.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@604 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+18
-26
@@ -49,7 +49,23 @@ INT16 gsUnpaidStrategicSector[ MAX_CHARACTER_COUNT ];
|
|||||||
// the selected list of mercs
|
// the selected list of mercs
|
||||||
extern BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
extern BOOLEAN fSelectedListOfMercsForMapScreen[ MAX_CHARACTER_COUNT ];
|
||||||
|
|
||||||
|
// towns with militia training allowed
|
||||||
|
BOOLEAN gfMilitiaAllowedInTown[NUM_TOWNS] =
|
||||||
|
{
|
||||||
|
0, // blank sector
|
||||||
|
0, // omerta
|
||||||
|
1, // drassen
|
||||||
|
1, // alma
|
||||||
|
1, // grumm
|
||||||
|
0, // tixa
|
||||||
|
1, // cambria
|
||||||
|
0, // san mona
|
||||||
|
0, // estoni
|
||||||
|
0, // orta
|
||||||
|
1, // balime
|
||||||
|
1, // meduna
|
||||||
|
1, // chitzena
|
||||||
|
};
|
||||||
|
|
||||||
// private prototypes
|
// private prototypes
|
||||||
void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue );
|
void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue );
|
||||||
@@ -1437,31 +1453,7 @@ BOOLEAN MilitiaTrainingAllowedInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSe
|
|||||||
|
|
||||||
BOOLEAN MilitiaTrainingAllowedInTown( INT8 bTownId )
|
BOOLEAN MilitiaTrainingAllowedInTown( INT8 bTownId )
|
||||||
{
|
{
|
||||||
switch ( bTownId )
|
return( gfMilitiaAllowedInTown[bTownId] );
|
||||||
{
|
|
||||||
case DRASSEN:
|
|
||||||
case ALMA:
|
|
||||||
case GRUMM:
|
|
||||||
case CAMBRIA:
|
|
||||||
case BALIME:
|
|
||||||
case MEDUNA:
|
|
||||||
case CHITZENA:
|
|
||||||
return(TRUE);
|
|
||||||
|
|
||||||
case OMERTA:
|
|
||||||
case ESTONI:
|
|
||||||
case SAN_MONA:
|
|
||||||
case TIXA:
|
|
||||||
case ORTA:
|
|
||||||
// can't keep militia in these towns
|
|
||||||
return(FALSE);
|
|
||||||
|
|
||||||
case BLANK_SECTOR:
|
|
||||||
default:
|
|
||||||
// not a town sector!
|
|
||||||
return(FALSE);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildMilitiaPromotionsString( UINT16 *str )
|
void BuildMilitiaPromotionsString( UINT16 *str )
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ void CrippledVersionFailureToLoadMapCheck();
|
|||||||
|
|
||||||
extern UINT8 gubTownRebelSentiment[ NUM_TOWNS ];
|
extern UINT8 gubTownRebelSentiment[ NUM_TOWNS ];
|
||||||
extern BOOLEAN gfTownUsesLoyalty[ NUM_TOWNS ];
|
extern BOOLEAN gfTownUsesLoyalty[ NUM_TOWNS ];
|
||||||
|
extern BOOLEAN gfMilitiaAllowedInTown[NUM_TOWNS];
|
||||||
|
|
||||||
#define MAX_CHAR_DATA_LENGTH 500
|
#define MAX_CHAR_DATA_LENGTH 500
|
||||||
|
|
||||||
@@ -369,7 +370,8 @@ typedef enum
|
|||||||
CITYTABLE_ELEMENT_TOWNPOINT_X,
|
CITYTABLE_ELEMENT_TOWNPOINT_X,
|
||||||
CITYTABLE_ELEMENT_TOWNPOINT_Y,
|
CITYTABLE_ELEMENT_TOWNPOINT_Y,
|
||||||
CITYTABLE_ELEMENT_USES_LOYALTY,
|
CITYTABLE_ELEMENT_USES_LOYALTY,
|
||||||
CITYTABLE_ELEMENT_REBEL_SENTIMENT
|
CITYTABLE_ELEMENT_REBEL_SENTIMENT,
|
||||||
|
CITYTABLE_ELEMENT_MILITIA
|
||||||
} CITYTABLE_PARSE_STAGE;
|
} CITYTABLE_PARSE_STAGE;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -380,6 +382,7 @@ typedef struct
|
|||||||
POINT townPoint;
|
POINT townPoint;
|
||||||
BOOLEAN townUsesLoyalty;
|
BOOLEAN townUsesLoyalty;
|
||||||
UINT8 townRebelSentiment;
|
UINT8 townRebelSentiment;
|
||||||
|
BOOLEAN townMilitiaAllowed;
|
||||||
CHAR8 cityName[MAX_TOWN_NAME_LENGHT];
|
CHAR8 cityName[MAX_TOWN_NAME_LENGHT];
|
||||||
} cityInfo;
|
} cityInfo;
|
||||||
|
|
||||||
@@ -467,6 +470,11 @@ citytableStartElementHandle(void *userData, const char *name, const char **atts)
|
|||||||
pData->curElement = CITYTABLE_ELEMENT_REBEL_SENTIMENT;
|
pData->curElement = CITYTABLE_ELEMENT_REBEL_SENTIMENT;
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
|
else if(strcmp(name, "townMilitiaAllowed") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY)
|
||||||
|
{
|
||||||
|
pData->curElement = CITYTABLE_ELEMENT_MILITIA;
|
||||||
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
|
}
|
||||||
else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY)
|
else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_CITY)
|
||||||
{
|
{
|
||||||
pData->curElement = CITYTABLE_ELEMENT_BASESECTOR;
|
pData->curElement = CITYTABLE_ELEMENT_BASESECTOR;
|
||||||
@@ -561,6 +569,7 @@ citytableEndElementHandle(void *userData, const char *name)
|
|||||||
pTownPoints [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townPoint;
|
pTownPoints [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townPoint;
|
||||||
gfTownUsesLoyalty [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townUsesLoyalty;
|
gfTownUsesLoyalty [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townUsesLoyalty;
|
||||||
gubTownRebelSentiment [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townRebelSentiment;
|
gubTownRebelSentiment [pData->curCityInfo.uiIndex ] = pData->curCityInfo.townRebelSentiment;
|
||||||
|
gfMilitiaAllowedInTown[pData->curCityInfo.uiIndex ] = pData->curCityInfo.townMilitiaAllowed;
|
||||||
|
|
||||||
mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT);
|
mbstowcs( pTownNames[pData->curCityInfo.uiIndex], pData->curCityInfo.cityName, MAX_TOWN_NAME_LENGHT);
|
||||||
}
|
}
|
||||||
@@ -595,6 +604,12 @@ citytableEndElementHandle(void *userData, const char *name)
|
|||||||
else if ( !pData->curCityInfo.townRebelSentiment )
|
else if ( !pData->curCityInfo.townRebelSentiment )
|
||||||
pData->curCityInfo.townRebelSentiment = 1;
|
pData->curCityInfo.townRebelSentiment = 1;
|
||||||
}
|
}
|
||||||
|
else if(strcmp(name, "townMilitiaAllowed") == 0 && pData->curElement == CITYTABLE_ELEMENT_MILITIA )
|
||||||
|
{
|
||||||
|
pData->curElement = CITYTABLE_ELEMENT_CITY;
|
||||||
|
|
||||||
|
pData->curCityInfo.townMilitiaAllowed = (BOOLEAN)atol(pData->szCharData);
|
||||||
|
}
|
||||||
else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_BASESECTOR)
|
else if(strcmp(name, "baseSector") == 0 && pData->curElement == CITYTABLE_ELEMENT_BASESECTOR)
|
||||||
{
|
{
|
||||||
pData->curElement = CITYTABLE_ELEMENT_CITY;
|
pData->curElement = CITYTABLE_ELEMENT_CITY;
|
||||||
@@ -660,6 +675,8 @@ BOOLEAN WriteInStrategicMapSectorTownNames(STR fileName)
|
|||||||
|
|
||||||
FilePrintf(hFile,"\t\t\t<townRebelSentiment>%d</townRebelSentiment>\r\n", gubTownRebelSentiment[cnt] );
|
FilePrintf(hFile,"\t\t\t<townRebelSentiment>%d</townRebelSentiment>\r\n", gubTownRebelSentiment[cnt] );
|
||||||
|
|
||||||
|
FilePrintf(hFile,"\t\t\t<townMilitiaAllowed>%d</townMilitiaAllowed>\r\n", gfMilitiaAllowedInTown[cnt] );
|
||||||
|
|
||||||
FilePrintf(hFile,"\t\t\t<baseSector>\r\n");
|
FilePrintf(hFile,"\t\t\t<baseSector>\r\n");
|
||||||
FilePrintf(hFile,"\t\t\t\t<x>%d</x>\r\n",(sBaseSectorList[cnt-1]%16)+1);
|
FilePrintf(hFile,"\t\t\t\t<x>%d</x>\r\n",(sBaseSectorList[cnt-1]%16)+1);
|
||||||
FilePrintf(hFile,"\t\t\t\t<y>%d</y>\r\n",(sBaseSectorList[cnt-1]/16)+1);
|
FilePrintf(hFile,"\t\t\t\t<y>%d</y>\r\n",(sBaseSectorList[cnt-1]/16)+1);
|
||||||
|
|||||||
Reference in New Issue
Block a user