From 7e3d9e368c591da1848873f4bf19fe4f7bceb5cb Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 24 Mar 2016 23:16:52 +0000 Subject: [PATCH] externalised maximum number of mortars per AI team to DifficultySettings.xml git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8120 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameInitOptionsScreen.h | 2 ++ Tactical/Inventory Choosing.cpp | 11 ++++------- XML_DifficultySettings.cpp | 11 +++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/GameInitOptionsScreen.h b/GameInitOptionsScreen.h index 3bb23f07..3f297d62 100644 --- a/GameInitOptionsScreen.h +++ b/GameInitOptionsScreen.h @@ -92,6 +92,8 @@ typedef struct FLOAT NewDifficultySettingsAIM_DIFFICULTY; BOOLEAN bEnemyMoraleWorried; + + UINT8 usMaxMortarsPerTeam; } DIFFICULTY_SETTINGS_VALUES; extern UINT8 MaxDifficultySettingsValues; diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 2c8aa7fd..d7d16839 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -47,9 +47,6 @@ UINT16 itemGrenadeLauncher; UINT16 itemLAW; UINT16 itemRPG; -#define MAX_MORTARS_PER_TEAM 1 // one team can't randomly roll more than this many mortars per sector - - UINT32 guiMortarsRolledByTeam = 0; // @@ -544,7 +541,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 case 6: // one per team maximum! - if ( ( pp->bExpLevel >= 5 ) && ( guiMortarsRolledByTeam < MAX_MORTARS_PER_TEAM ) ) + if ( (pp->bExpLevel >= 5) && (guiMortarsRolledByTeam < zDiffSetting[gGameOptions.ubDifficultyLevel].usMaxMortarsPerTeam) ) { //mortar fMortar = TRUE; @@ -747,11 +744,11 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 break; case 6: // one per team maximum! - if ( guiMortarsRolledByTeam < MAX_MORTARS_PER_TEAM ) + if ( guiMortarsRolledByTeam < zDiffSetting[gGameOptions.ubDifficultyLevel].usMaxMortarsPerTeam ) { //mortar fMortar = TRUE; - guiMortarsRolledByTeam++; + ++guiMortarsRolledByTeam; // the grenades will actually represent mortar shells in this case bGrenades = 3 + (INT8)(Random( 5 )); //3-7 @@ -840,7 +837,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 break; case 4: // one per team maximum! - if ( guiMortarsRolledByTeam < MAX_MORTARS_PER_TEAM ) + if ( guiMortarsRolledByTeam < zDiffSetting[gGameOptions.ubDifficultyLevel].usMaxMortarsPerTeam ) { //mortar fMortar = TRUE; diff --git a/XML_DifficultySettings.cpp b/XML_DifficultySettings.cpp index b1580f85..8796d918 100644 --- a/XML_DifficultySettings.cpp +++ b/XML_DifficultySettings.cpp @@ -107,6 +107,7 @@ DifficultySettingsParseDataStartElementHandle(void *userData, const XML_Char *na strcmp(name, "RadioSightings") == 0 || strcmp(name, "RadioSightings2") == 0 || strcmp(name, "EnemyMoraleWorried") == 0 || + strcmp(name, "MaxMortarsPerTeam" ) == 0 || strcmp(name, "CthConstantsAimDifficulty") == 0 || strcmp(name, "CthConstantsBaseDifficulty") == 0 )) @@ -230,7 +231,8 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name) zDiffSetting[pData->curDifficultySettings.uiIndex].NewDifficultySettingsBASE_DIFFICULTY = pData->curDifficultySettings.NewDifficultySettingsBASE_DIFFICULTY; zDiffSetting[pData->curDifficultySettings.uiIndex].bEnemyMoraleWorried = pData->curDifficultySettings.bEnemyMoraleWorried; - + + zDiffSetting[pData->curDifficultySettings.uiIndex].usMaxMortarsPerTeam = pData->curDifficultySettings.usMaxMortarsPerTeam; } else { @@ -549,7 +551,12 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name) { pData->curElement = ELEMENT; pData->curDifficultySettings.bEnemyMoraleWorried = (BOOLEAN) atol(pData->szCharData); - } + } + else if ( strcmp( name, "MaxMortarsPerTeam" ) == 0 ) + { + pData->curElement = ELEMENT; + pData->curDifficultySettings.usMaxMortarsPerTeam = (UINT8)atol( pData->szCharData ); + } else if(strcmp(name, "CthConstantsAimDifficulty") == 0) { pData->curElement = ELEMENT;