New feature: Diseaes affect your mercenaries. They can be contracted in varíous ways and have varying effects.

For more info, see http://www.ja-galaxy-forum.com/ubbthreads.php/topics/334918#Post334918

Requires GameDir >= r2099.

Does not break savegame compatibility.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7384 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-08-10 13:45:11 +00:00
parent 09244c2369
commit 36e9d15edc
96 changed files with 5569 additions and 1573 deletions
+94 -139
View File
@@ -27,17 +27,9 @@ extern SECTOR_EXT_DATA SectorExternalData[256][4];
//extern CHAR16 gzSectorUndergroundNames2[256][4][MAX_SECTOR_NAME_LENGTH];
//extern CHAR16 gzSectorUndergroundNames3[256][4][MAX_SECTOR_NAME_LENGTH];
typedef enum
{
SECTORNAME_ELEMENT_NONE = 0,
SECTORNAME_ELEMENT_SECTOR_NAMES,
SECTORNAME_ELEMENT_SECTOR,
SECTORNAME_ELEMENT,
} SECTORNAME_PARSE_STAGE;
typedef struct
{
SECTORNAME_PARSE_STAGE curElement;
PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT8 sCurSectorX;
UINT8 sCurSectorY;
@@ -45,15 +37,13 @@ typedef struct
CHAR16 szCurDetailedUnexploredName[MAX_SECTOR_NAME_LENGTH];
CHAR16 szCurExploredName[MAX_SECTOR_NAME_LENGTH];
CHAR16 szCurDetailedExploredName[MAX_SECTOR_NAME_LENGTH];
UINT8 sWaterType; // Food System
UINT16 usNaturalDirt; // Dirt System
UINT8 usCurfewValue; // Covert Ops
INT8 sRadioScanModifier; // Radio Operator
UINT16 usPrisonRoomNumber[MAX_PRISON_ROOMS]; // Prisoner System
SECTOR_EXT_DATA sectordata;
UINT8 curSupplyType;
UINT32 currentDepth;
UINT32 maxReadDepth;
} SectorNameParseData;
BOOLEAN SectorName_TextOnly;
INT8 Sector_Level;
@@ -67,9 +57,9 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
{
if(strcmp(name, "SECTOR_NAMES") == 0 && pData->curElement == SECTORNAME_ELEMENT_NONE)
if(strcmp(name, "SECTOR_NAMES") == 0 && pData->curElement == ELEMENT_NONE)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR_NAMES;
pData->curElement = ELEMENT_LIST;
pData->maxReadDepth++; //we are not skipping this element
// Initiate Array by setting first character to 0.
for (UINT16 x = 0; x < 256; x++)
@@ -104,40 +94,16 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
gzSectorNames[x][2][0]=0;
gzSectorNames[x][3][0]=0;
}
// moved to lua
//if (Sector_Level == 1 )
//{
// gzSectorUndergroundNames1[x][0][0]=0;
// gzSectorUndergroundNames1[x][1][0]=0;
// gzSectorUndergroundNames1[x][2][0]=0;
// gzSectorUndergroundNames1[x][3][0]=0;
//}
// if (Sector_Level == 2 )
//{
// gzSectorUndergroundNames2[x][0][0]=0;
// gzSectorUndergroundNames2[x][1][0]=0;
// gzSectorUndergroundNames2[x][2][0]=0;
// gzSectorUndergroundNames2[x][3][0]=0;
//}
//if (Sector_Level == 3 )
//{
// gzSectorUndergroundNames3[x][0][0]=0;
// gzSectorUndergroundNames3[x][1][0]=0;
// gzSectorUndergroundNames3[x][2][0]=0;
// gzSectorUndergroundNames3[x][3][0]=0;
//}
}
}
else if(strcmp(name, "SECTOR") == 0 && pData->curElement == SECTORNAME_ELEMENT_SECTOR_NAMES)
else if(strcmp(name, "SECTOR") == 0 && pData->curElement == ELEMENT_LIST)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
pData->maxReadDepth++; //we are not skipping this element
}
else if(pData->curElement == SECTORNAME_ELEMENT_SECTOR &&
else if(pData->curElement == ELEMENT &&
(strcmp(name, "SectorGrid") == 0 ||
strcmp(name, "szUnexploredName") == 0 ||
strcmp(name, "szDetailedUnexploredName") == 0 ||
@@ -162,9 +128,10 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
strcmp(name, "usPrisonRoomNumber12") == 0 ||
strcmp(name, "usPrisonRoomNumber13") == 0 ||
strcmp(name, "usPrisonRoomNumber14") == 0 ||
strcmp(name, "usPrisonRoomNumber15") == 0 ))
strcmp(name, "usPrisonRoomNumber15") == 0 ||
strcmp(name, "usCivilianPopulation") == 0 ))
{
pData->curElement = SECTORNAME_ELEMENT;
pData->curElement = ELEMENT_PROPERTY;
pData->maxReadDepth++; //we are not skipping this element
}
@@ -173,7 +140,6 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
}
pData->currentDepth++;
}
@@ -197,11 +163,11 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
{
if(strcmp(name, "SECTOR_NAMES") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_NONE;
pData->curElement = ELEMENT_NONE;
}
else if(strcmp(name, "SECTOR") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR_NAMES;
pData->curElement = ELEMENT_LIST;
UINT8 ubSectorId = SECTOR(pData->sCurSectorX, pData->sCurSectorY);
if (ubSectorId >= 0 && ubSectorId < 256)
@@ -247,70 +213,54 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
wcscpy(gzSectorNames[ubSectorId][2], pData->szCurExploredName);
wcscpy(gzSectorNames[ubSectorId][3], pData->szCurDetailedExploredName);
}
// moved to lua
//else if (Sector_Level == 1 )
//{
// wcscpy(gzSectorUndergroundNames1[ubSectorId][0], pData->szCurUnexploredName);
// wcscpy(gzSectorUndergroundNames1[ubSectorId][1], pData->szCurDetailedUnexploredName);
// wcscpy(gzSectorUndergroundNames1[ubSectorId][2], pData->szCurExploredName);
// wcscpy(gzSectorUndergroundNames1[ubSectorId][3], pData->szCurDetailedExploredName);
//}
//else if (Sector_Level == 2 )
//{
// wcscpy(gzSectorUndergroundNames2[ubSectorId][0], pData->szCurUnexploredName);
// wcscpy(gzSectorUndergroundNames2[ubSectorId][1], pData->szCurDetailedUnexploredName);
// wcscpy(gzSectorUndergroundNames2[ubSectorId][2], pData->szCurExploredName);
// wcscpy(gzSectorUndergroundNames2[ubSectorId][3], pData->szCurDetailedExploredName);
//}
//else if (Sector_Level == 3 )
//{
// wcscpy(gzSectorUndergroundNames3[ubSectorId][0], pData->szCurUnexploredName);
// wcscpy(gzSectorUndergroundNames3[ubSectorId][1], pData->szCurDetailedUnexploredName);
// wcscpy(gzSectorUndergroundNames3[ubSectorId][2], pData->szCurExploredName);
// wcscpy(gzSectorUndergroundNames3[ubSectorId][3], pData->szCurDetailedExploredName);
//}
}
SectorExternalData[ubSectorId][0].usWaterType = pData->sWaterType;
SectorExternalData[ubSectorId][1].usWaterType = pData->sWaterType;
SectorExternalData[ubSectorId][2].usWaterType = pData->sWaterType;
SectorExternalData[ubSectorId][3].usWaterType = pData->sWaterType;
SectorExternalData[ubSectorId][0].usWaterType = pData->sectordata.usWaterType;
SectorExternalData[ubSectorId][1].usWaterType = pData->sectordata.usWaterType;
SectorExternalData[ubSectorId][2].usWaterType = pData->sectordata.usWaterType;
SectorExternalData[ubSectorId][3].usWaterType = pData->sectordata.usWaterType;
SectorExternalData[ubSectorId][0].usNaturalDirt = pData->usNaturalDirt;
SectorExternalData[ubSectorId][1].usNaturalDirt = pData->usNaturalDirt;
SectorExternalData[ubSectorId][2].usNaturalDirt = pData->usNaturalDirt;
SectorExternalData[ubSectorId][3].usNaturalDirt = pData->usNaturalDirt;
SectorExternalData[ubSectorId][0].usNaturalDirt = pData->sectordata.usNaturalDirt;
SectorExternalData[ubSectorId][1].usNaturalDirt = pData->sectordata.usNaturalDirt;
SectorExternalData[ubSectorId][2].usNaturalDirt = pData->sectordata.usNaturalDirt;
SectorExternalData[ubSectorId][3].usNaturalDirt = pData->sectordata.usNaturalDirt;
SectorExternalData[ubSectorId][0].usCurfewValue = pData->usCurfewValue;
SectorExternalData[ubSectorId][1].usCurfewValue = pData->usCurfewValue;
SectorExternalData[ubSectorId][2].usCurfewValue = pData->usCurfewValue;
SectorExternalData[ubSectorId][3].usCurfewValue = pData->usCurfewValue;
SectorExternalData[ubSectorId][0].usCurfewValue = pData->sectordata.usCurfewValue;
SectorExternalData[ubSectorId][1].usCurfewValue = pData->sectordata.usCurfewValue;
SectorExternalData[ubSectorId][2].usCurfewValue = pData->sectordata.usCurfewValue;
SectorExternalData[ubSectorId][3].usCurfewValue = pData->sectordata.usCurfewValue;
INT8 radioscanmod = max(-3, pData->sRadioScanModifier);
radioscanmod = min(3, pData->sRadioScanModifier);
SectorExternalData[ubSectorId][0].sRadioScanModifier = pData->sRadioScanModifier;
SectorExternalData[ubSectorId][1].sRadioScanModifier = pData->sRadioScanModifier;
SectorExternalData[ubSectorId][2].sRadioScanModifier = pData->sRadioScanModifier;
SectorExternalData[ubSectorId][3].sRadioScanModifier = pData->sRadioScanModifier;
INT8 radioscanmod = max( -3, pData->sectordata.sRadioScanModifier );
radioscanmod = min( 3, pData->sectordata.sRadioScanModifier );
SectorExternalData[ubSectorId][0].sRadioScanModifier = pData->sectordata.sRadioScanModifier;
SectorExternalData[ubSectorId][1].sRadioScanModifier = pData->sectordata.sRadioScanModifier;
SectorExternalData[ubSectorId][2].sRadioScanModifier = pData->sectordata.sRadioScanModifier;
SectorExternalData[ubSectorId][3].sRadioScanModifier = pData->sectordata.sRadioScanModifier;
SectorExternalData[ubSectorId][0].usCivilianPopulation = pData->sectordata.usCivilianPopulation;
SectorExternalData[ubSectorId][1].usCivilianPopulation = pData->sectordata.usCivilianPopulation;
SectorExternalData[ubSectorId][2].usCivilianPopulation = pData->sectordata.usCivilianPopulation;
SectorExternalData[ubSectorId][3].usCivilianPopulation = pData->sectordata.usCivilianPopulation;
for(UINT8 i = 0; i <MAX_PRISON_ROOMS; ++i)
{
SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i] = pData->usPrisonRoomNumber[i];
pData->usPrisonRoomNumber[i] = 0;
SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i] = pData->sectordata.usPrisonRoomNumber[i];
pData->sectordata.usPrisonRoomNumber[i] = 0;
}
// clean up values afterwards
pData->sWaterType = 0;
pData->usNaturalDirt = 100;
pData->usCurfewValue = 0;
pData->sRadioScanModifier = 0;
pData->sectordata.usWaterType = 0;
pData->sectordata.usNaturalDirt = 100;
pData->sectordata.usCurfewValue = 0;
pData->sectordata.sRadioScanModifier = 0;
pData->sectordata.usCivilianPopulation = 0;
}
}
else if(strcmp(name, "SectorGrid") == 0 )
{
UINT8 x, y;
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
y = (UINT8)pData->szCharData[0] & 0x1F;
x = (UINT8)atol(&pData->szCharData[1]);
@@ -322,7 +272,7 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
}
else if(strcmp(name, "szUnexploredName") == 0 )
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->szCurUnexploredName, sizeof(pData->szCurUnexploredName)/sizeof(pData->szCurUnexploredName[0]) );
pData->szCurUnexploredName[sizeof(pData->szCurUnexploredName)/sizeof(pData->szCurUnexploredName[0]) - 1] = '\0';
@@ -330,7 +280,7 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "szDetailedUnexploredName") == 0 )
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->szCurDetailedUnexploredName, sizeof(pData->szCurDetailedUnexploredName)/sizeof(pData->szCurDetailedUnexploredName[0]) );
pData->szCurDetailedUnexploredName[sizeof(pData->szCurDetailedUnexploredName)/sizeof(pData->szCurDetailedUnexploredName[0]) - 1] = '\0';
@@ -338,7 +288,7 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "szExploredName") == 0 )
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->szCurExploredName, sizeof(pData->szCurExploredName)/sizeof(pData->szCurExploredName[0]) );
pData->szCurExploredName[sizeof(pData->szCurExploredName)/sizeof(pData->szCurExploredName[0]) - 1] = '\0';
@@ -346,7 +296,7 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "szDetailedExploredName") == 0 )
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->curElement = ELEMENT;
MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->szCurDetailedExploredName, sizeof(pData->szCurDetailedExploredName)/sizeof(pData->szCurDetailedExploredName[0]) );
pData->szCurDetailedExploredName[sizeof(pData->szCurDetailedExploredName)/sizeof(pData->szCurDetailedExploredName[0]) - 1] = '\0';
@@ -354,104 +304,109 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "sWaterType") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->sWaterType = (UINT8) atol(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usWaterType = (UINT8)atol( pData->szCharData );
}
else if(strcmp(name, "usNaturalDirt") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usNaturalDirt = (UINT16) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usNaturalDirt = (UINT16)atoi( pData->szCharData );
}
else if(strcmp(name, "usCurfewValue") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usCurfewValue = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usCurfewValue = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "sRadioScanModifier") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->sRadioScanModifier = (INT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.sRadioScanModifier = (INT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber00") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[0] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[0] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber01") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[1] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[1] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber02") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[2] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[2] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber03") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[3] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[3] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber04") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[4] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[4] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber05") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[5] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[5] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber06") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[6] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[6] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber07") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[7] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[7] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber08") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[8] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[8] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber09") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[9] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[9] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber10") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[10] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[10] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber11") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[11] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[11] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber12") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[12] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[12] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber13") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[13] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[13] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber14") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[14] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[14] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usPrisonRoomNumber15") == 0)
{
pData->curElement = SECTORNAME_ELEMENT_SECTOR;
pData->usPrisonRoomNumber[15] = (UINT8) atoi(pData->szCharData);
pData->curElement = ELEMENT;
pData->sectordata.usPrisonRoomNumber[15] = (UINT8)atoi( pData->szCharData );
}
else if(strcmp(name, "usCivilianPopulation") == 0)
{
pData->curElement = ELEMENT;
pData->sectordata.usCivilianPopulation = (UINT16)atoi( pData->szCharData );
}
pData->maxReadDepth--;