From c0d77f79c7d0615fb8bd9a0c529581d090c97f54 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 10 Mar 2018 15:31:11 +0000 Subject: [PATCH] Deleted 'mobile militia feature', as 'militia strategic command' offered better ways to move militia. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23649&goto=352592&#msg_352592 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8542 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 71 +- GameSettings.h | 58 +- GameVersion.cpp | 18 +- Init.cpp | 16 +- SaveLoadGame.cpp | 30 +- Strategic/Assignments.cpp | 870 +---------- Strategic/Assignments.h | 6 +- Strategic/Auto Resolve.cpp | 4 - Strategic/Campaign Types.h | 9 +- Strategic/Facilities.cpp | 28 +- Strategic/Game Init.cpp | 9 +- Strategic/Map Screen Interface Border.cpp | 260 +--- Strategic/Map Screen Interface Border.h | 15 - Strategic/Map Screen Interface Map.cpp | 30 +- .../Map Screen Interface TownMine Info.cpp | 44 +- Strategic/Map Screen Interface.cpp | 111 +- Strategic/Map Screen Interface.h | 3 +- Strategic/MilitiaSquads.cpp | 1356 +---------------- Strategic/MilitiaSquads.h | 32 - Strategic/Quests.h | 4 +- Strategic/Strategic Merc Handler.cpp | 8 +- Strategic/Strategic Town Loyalty.cpp | 8 +- Strategic/Strategic_VS2005.vcproj | 8 - Strategic/Strategic_VS2008.vcproj | 8 - Strategic/Strategic_VS2010.vcxproj | 2 - Strategic/Strategic_VS2010.vcxproj.filters | 6 - Strategic/Strategic_VS2013.vcxproj | 2 - Strategic/Strategic_VS2013.vcxproj.filters | 6 - Strategic/Strategic_VS2017.vcxproj | 2 - Strategic/Town Militia.cpp | 601 +------- Strategic/Town Militia.h | 8 +- Strategic/XML_DynamicRestrictions.cpp | 223 --- Strategic/XML_FacilityTypes.cpp | 24 +- Strategic/XML_Roaming.cpp | 179 --- Strategic/mapscreen.cpp | 56 +- Strategic/mapscreen.h | 10 - Strategic/strategic.cpp | 98 +- Strategic/strategic.h | 2 - Tactical/Campaign.cpp | 2 +- Tactical/Faces.cpp | 3 - Tactical/Militia Control.cpp | 2 - Tactical/XML.h | 8 - Tactical/XML_Profiles.cpp | 57 + Utils/_ChineseText.cpp | 18 +- Utils/_DutchText.cpp | 18 +- Utils/_EnglishText.cpp | 18 +- Utils/_FrenchText.cpp | 18 +- Utils/_GermanText.cpp | 20 +- Utils/_ItalianText.cpp | 20 +- Utils/_PolishText.cpp | 18 +- Utils/_RussianText.cpp | 18 +- 51 files changed, 307 insertions(+), 4138 deletions(-) delete mode 100644 Strategic/XML_DynamicRestrictions.cpp delete mode 100644 Strategic/XML_Roaming.cpp diff --git a/GameSettings.cpp b/GameSettings.cpp index 20deff30..b0060f21 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -899,15 +899,11 @@ void LoadGameExternalOptions() gGameExternalOptions.iMilitiaTrainingCost = iniReader.ReadInteger("Financial Settings","MILITIA_BASE_TRAINING_COST",750, 10, 10000); gGameExternalOptions.iRegularCostModifier = iniReader.ReadInteger("Financial Settings","MILITIA_COST_MULTIPLIER_REGULAR",1, 1, 10); gGameExternalOptions.iVeteranCostModifier = iniReader.ReadInteger("Financial Settings","MILITIA_COST_MULTIPLIER_ELITE",2, 1, 10); - gGameExternalOptions.iMilitiaCostModifier = iniReader.ReadInteger("Financial Settings","MILITIA_COST_MULTIPLIER_MOBILE",3, 1, 10); // HEADROCK HAM 3.6: Daily upkeep costs for militia gGameExternalOptions.usDailyCostTown[GREEN_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_TOWN_GREEN", 0, 0, 10000 ); gGameExternalOptions.usDailyCostTown[REGULAR_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_TOWN_REGULAR", 0, 0, 10000 ); gGameExternalOptions.usDailyCostTown[ELITE_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_TOWN_ELITE", 0, 0, 10000 ); - gGameExternalOptions.usDailyCostMobile[GREEN_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_MOBILE_GREEN", 0, 0, 10000 ); - gGameExternalOptions.usDailyCostMobile[REGULAR_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_MOBILE_REGULAR", 0, 0, 10000 ); - gGameExternalOptions.usDailyCostMobile[ELITE_MILITIA] = iniReader.ReadInteger( "Financial Settings", "DAILY_MILITIA_UPKEEP_MOBILE_ELITE", 0, 0, 10000 ); // HEADROCK HAM 3.5: Helicopter - Base cost per sector. GREEN = Free airspace, RED = Enemy-controlled airspace. gGameExternalOptions.usHelicopterBaseCostPerGreenTile = iniReader.ReadInteger("Financial Settings","HELICOPTER_BASE_COST_PER_GREEN_TILE", 100, 0, 60000); @@ -2126,75 +2122,10 @@ void LoadGameExternalOptions() gGameExternalOptions.dMilitiaVolunteerGainFactorHourly = iniReader.ReadFloat( "Militia Volunteer Pool Settings", "MILITIA_VOLUNTEER_POOL_GAINFACTOR_HOURLY", 0.001f, 0.0f, 1.0f ); gGameExternalOptions.dMilitiaVolunteerGainFactorLiberation = iniReader.ReadFloat( "Militia Volunteer Pool Settings", "MILITIA_VOLUNTEER_POOL_GAINFACTOR_LIBERATION", 0.2f, 0.0f, 1.0f ); gGameExternalOptions.dMilitiaVolunteerMultiplierFarm = iniReader.ReadFloat( "Militia Volunteer Pool Settings", "MILITIA_VOLUNTEER_POOL_MULTIPLIER_FARM", 0.05f, 0.0f, 1.0f ); - - //################# Mobile Militia Training Settings ################## - - gGameExternalOptions.gfAllowMilitiaGroups = iniReader.ReadBoolean("Mobile Militia Training Settings","ALLOW_MOBILE_MILITIA",FALSE); - gGameExternalOptions.guiAllowMilitiaGroupsDelay = iniReader.ReadInteger("Mobile Militia Training Settings","MOBILE_MILITIA_TRAINING_DELAY",1, 0, 30); - - gGameExternalOptions.guiNumMobileMilitiaTrained = iniReader.ReadInteger("Mobile Militia Training Settings","NUM_MOBILE_MILITIA_TRAINED_PER_SESSION",4, 1, 100); - - gGameExternalOptions.gfmusttrainroaming = iniReader.ReadBoolean("Mobile Militia Training Settings","MUST_TRAIN_MOBILE_MILITIA",FALSE); - - //Moa: Mode to determine maximum allowed mobile militia for training / deserting. - gGameExternalOptions.gbMobileMilitiaMaxActiveMode = (UINT8) iniReader.ReadInteger("Mobile Militia Training Settings","MOBILE_MILITIA_MAX_ACTIVE_MODE",0,0,255); - //Moa: modifier for the maximum (make sure this is read after iMaxMilitiaPerSector) - gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier = iniReader.ReadFloat("Mobile Militia Training Settings","MOBILE_MILITIA_MAX_ACTIVE_MODIFIER", 0.5, 0.01f, 10.0f) * gGameExternalOptions.iMaxMilitiaPerSector; - - gGameExternalOptions.guiCreateEachNHours = iniReader.ReadInteger("Mobile Militia Training Settings","CREATE_MOBILE_MILITIA_SQUAD_EACH_N_HOURS",24, 1, 96); - - // HEADROCK HAM 3.3: New militia feature, Minimum Leadership required to train Roaming Militia - gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia = iniReader.ReadInteger("Mobile Militia Training Settings","MIN_LEADERSHIP_TO_TRAIN_MOBILE_MILITIA", 0, 0, 100); - - // HEADROCK HAM 3.3: If enabled, the trainer's "effective" leadership skill determines HOW MANY Mobile Militia he/she creates per session. - gGameExternalOptions.fLeadershipAffectsMobileMilitiaQuantity = iniReader.ReadBoolean("Mobile Militia Training Settings","LEADERSHIP_AFFECTS_MOBILE_MILITIA_QUANTITY", FALSE); - - // HEADROCK HAM 3.3: If "LEADERSHIP_AFFECTS_MILITIA_QUANTITY" is true, this value determines the lowest leadership required to train a full (default size 5) squad of Mobile Militia in one training session. - gGameExternalOptions.ubReqLeadershipForFullMobileTraining = iniReader.ReadInteger("Mobile Militia Training Settings","REQ_LEADERSHIP_FOR_MAX_MOBILE_MILITIA", 1, 1, 100); - - // HEADROCK HAM 3.5: Does leadership affect the Quality of new Mobile Militia groups? - gGameExternalOptions.fLeadershipAffectsMobileMilitiaQuality = iniReader.ReadBoolean("Mobile Militia Training Settings","LEADERSHIP_AFFECTS_MOBILE_MILITIA_QUALITY", FALSE); - - // HEADROCK HAM 3.4: What percentage of a new Mobile Militia group will be made of Elites? If >0, then at least one of every new group will be an Elite. 100 = All Elites. - gGameExternalOptions.ubPercentRoamingMilitiaElites = iniReader.ReadInteger("Mobile Militia Training Settings","PERCENT_MOBILE_MILITIA_ELITES", 100, 0, 100); - - // HEADROCK HAM 3.4: What percentage of a new Mobile Militia group will be made of Regulars? If >0, then at least one of every new group will be a Regular. 100 = All Regulars. - gGameExternalOptions.ubPercentRoamingMilitiaRegulars = iniReader.ReadInteger("Mobile Militia Training Settings","PERCENT_MOBILE_MILITIA_REGULARS", 0, 0, 100); - - - //################# Mobile Militia Movement Settings ################## - - gGameExternalOptions.gflimitedRoaming = iniReader.ReadBoolean("Mobile Militia Movement Settings","RESTRICT_ROAMING",FALSE); - - // HEADROCK HAM B1: Allow restricted militia to move through visited sectors? - gGameExternalOptions.fUnrestrictVisited = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MILITIA_MOVEMENT_THROUGH_EXPLORED_SECTORS", FALSE); - - // HEADROCK HAM B1: Allow dynamic restrictions? - gGameExternalOptions.fDynamicRestrictRoaming = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_DYNAMIC_RESTRICTED_ROAMING", TRUE); - - // HEADROCK HAM B2.7: Augmented Roaming Militia code - turn this to TRUE to allow militia free travel through San Mona, Tixa, Orta, Omerta, and Estoni. - gGameExternalOptions.fAllowMilitiaMoveThroughMinorCities = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MILITIA_MOVEMENT_THROUGH_MINOR_CITIES", FALSE); - - // HEADROCK HAM 3.3: If enabled, Roaming Militia can automatically reinforce city garrisons. - gGameExternalOptions.fAllowMobileReinforceCities = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MOBILE_MILITIA_REINFORCE_TOWN_GARRISONS", FALSE); - - // HEADROCK HAM 3.3: If enabled, Roaming Militia can automatically reinforce city garrisons. - gGameExternalOptions.fAllowMobileReinforceSAM = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MOBILE_MILITIA_REINFORCE_SAM_GARRISONS", FALSE); - - // Moa: If enabled militia will follow player (default HAM behavier), set to FALSE if they should do what they want. - gGameExternalOptions.gfAllowMilitiaFollowPlayer = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MILITIA_FOLLOW_PLAYER", TRUE); - - // Moa: If enabled militia will spread (default HAM behavier) or set to FALSE to fill up the destination group to maximum. - gGameExternalOptions.gfAllowMilitiaSpread = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MILITIA_SPREAD", TRUE); - - // Moa: If enabled militia will spread when following or set to FALSE to fill up the destination group to maximum. - gGameExternalOptions.gfAllowMilitiaSpreadWhenFollowing = iniReader.ReadBoolean("Mobile Militia Movement Settings","ALLOW_MILITIA_SPREAD_WHEN_FOLLOWING", FALSE); - //################# Militia Strategic Movement Settings ################## gGameExternalOptions.fMilitiaStrategicCommand = iniReader.ReadBoolean("Militia Strategic Movement Settings", "ALLOW_MILITIA_STRATEGIC_COMMAND", FALSE ); - - + // SANDRO - added several bonuses for militia //################# Militia Strength Settings ################## diff --git a/GameSettings.h b/GameSettings.h index c0245f2e..083ab14a 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -309,7 +309,6 @@ typedef struct INT32 iMaxMilitiaPerSector; INT32 iTrainingSquadSize; INT32 iMilitiaTrainingCost; - INT32 iMilitiaCostModifier; INT32 iRegularCostModifier; INT32 iVeteranCostModifier; INT32 iMinLoyaltyToTrain; @@ -476,14 +475,6 @@ typedef struct // Militia Settings BOOLEAN fAllowTacticalMilitiaCommand; BOOLEAN gfTrainVeteranMilitia; - BOOLEAN gfAllowMilitiaGroups; - BOOLEAN gfmusttrainroaming; - BOOLEAN gflimitedRoaming; - BOOLEAN gfAllowMilitiaFollowPlayer; //Moa: TRUE try to follow, FALSE do what they want - BOOLEAN gfAllowMilitiaSpreadWhenFollowing; //Moa: TRUE spread normal, FALSE dont spread when following - BOOLEAN gfAllowMilitiaSpread; //Moa: TRUE spread normal, FALSE fill up to max - UINT8 gbMobileMilitiaMaxActiveMode; //Moa: Used to check if the maximum of mobile militia is reached (for training/deserting). THIS IS A MODE - FLOAT gfpMobileMilitiaMaxActiveModifier; //Moa: const multiplier for the mode used (precalculated with MOBILE_MILITIA_MAX_ACTIVE_MODIFIER * MAX_MILITIA_PER_SECTOR). // Flugente: militia movement BOOLEAN fMilitiaStrategicCommand; @@ -491,14 +482,7 @@ typedef struct BOOLEAN gfAllowReinforcements; BOOLEAN gfAllowReinforcementsOnlyInCity; - UINT32 guiAllowMilitiaGroupsDelay; UINT32 guiTrainVeteranMilitiaDelay; - UINT32 guiCreateEachNHours; - UINT32 guiNumMobileMilitiaTrained; - // HEADROCK HAM 3.6: These settings are REDUNDANT. - //UINT32 guiMinMilitiaSquadSize; - //UINT32 guiMaxMilitiaSquadSize; - //UINT32 guiMaxMilitiaSquadSizeBattle; // SANDRO - added some variables INT16 sGreenMilitiaAutoresolveStrength; @@ -971,13 +955,7 @@ typedef struct // HEADROCK HAM B1: Allows reducing the chance of scoring a hit fractionally, if CTH = Minimum CTH UINT16 usMinimumCTHDivisor; - - // HEADROCK HAM B1: Allows Restricted Roaming Militia to move through previously visited sectors. - BOOLEAN fUnrestrictVisited; - - // HEADROCK HAM B1: Allows the capture of towns to dynamically alter roaming restrictions - BOOLEAN fDynamicRestrictRoaming; - + // HEADROCK HAM B2.1: This controls how effective suppression is, by increasing the number of ubSuppressionPoints accumulated by combatants (percentage); INT16 sSuppressionEffectiveness; @@ -1073,9 +1051,6 @@ typedef struct // HEADROCK HAM B2.7: When turned on, this will give a CTH approximation instead of an exact value, on CTH Bars and "F" key feedback. BOOLEAN fApproximateCTH; - // HEADROCK HAM B2.7: Augmented Roaming Militia code - turn this to TRUE to allow militia free travel through San Mona, Tixa, Orta, Omerta, and Estoni. - BOOLEAN fAllowMilitiaMoveThroughMinorCities; - // HEADROCK HAM B2.8: These are new cowering penalty divisors that help us determine how effective cowering is in different stances and when the shooter is targetting different bodyparts UINT8 ubCoweringPenaltyDivisorProne; UINT8 ubCoweringPenaltyDivisorCrouchedHead; @@ -1175,37 +1150,13 @@ typedef struct // HEADROCK HAM 3.3: Increases tolerance while moving. UINT8 ubTilesMovedPerBonusTolerancePoint; - - // HEADROCK HAM 3.3: New militia feature, Minimum Leadership required to train Roaming Militia - UINT8 ubMinimumLeadershipToTrainMobileMilitia; - - // HEADROCK HAM 3.3: If enabled, the trainer's "effective" leadership skill determines HOW MANY militia he/she creates per session. - BOOLEAN fLeadershipAffectsMobileMilitiaQuantity; - - // HEADROCK HAM 3.3: If "LEADERSHIP_AFFECTS_MILITIA_QUANTITY" is true, this value determines the lowest leadership required to train a full (default size 10) squad of town militia in one training session. - UINT8 ubReqLeadershipForFullMobileTraining; - + // HEADROCK HAM 3.3: Minimum distance (in METERS) at which character suffer from friendly suppression. UINT16 usMinDistanceFriendlySuppression; - - // HEADROCK HAM 3.3: If enabled, Roaming Militia can automatically reinforce city garrisons. - BOOLEAN fAllowMobileReinforceCities; - - // HEADROCK HAM 3.3: If enabled, Roaming Militia can automatically reinforce city garrisons. - BOOLEAN fAllowMobileReinforceSAM; - + // HEADROCK HAM 3.4: This controls the intensity of Hiding the Bullet Count during combat. The higher it is, the more intense the effect. Negative values reduce the effect. UINT16 usBulletHideIntensity; - - // HEADROCK HAM 3.4: What percentage of a new Mobile Militia group will be made of Elites? If >0, then at least one of every group will be an Elite. 100 = All Elites. - UINT8 ubPercentRoamingMilitiaElites; - - // HEADROCK HAM 3.4: What percentage of a new Mobile Militia group will be made of Elites? If >0, then at least one of every group will be an Elite. 100 = All Elites. - UINT8 ubPercentRoamingMilitiaRegulars; - - // HEADROCK HAM 3.5: Does leadership affect the Quality of new Mobile Militia groups? - BOOLEAN fLeadershipAffectsMobileMilitiaQuality; - + // HEADROCK HAM 3.5: Explosive Suppression Effectiveness alters the amount of Suppression Points you get from nearby blasts. UINT16 usExplosionSuppressionEffect; @@ -1252,7 +1203,6 @@ typedef struct // HEADROCK HAM 3.6: Daily upkeep costs for militia UINT16 usDailyCostTown[MAX_MILITIA_LEVELS]; - UINT16 usDailyCostMobile[MAX_MILITIA_LEVELS]; // HEADROCK HAM 3.6: Non-Combat Bodytypes can't become hostile BOOLEAN fCanTrueCiviliansBecomeHostile; diff --git a/GameVersion.cpp b/GameVersion.cpp index 2a226583..7d64c0ea 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -15,9 +15,9 @@ #ifdef JA2EDITOR #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8542 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8542 (Development Build)" }; #endif // ------------------------------ @@ -27,11 +27,11 @@ //DEBUG BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8542 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8542 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8542 (Development Build)" }; #endif #elif defined CRIPPLED_VERSION @@ -46,16 +46,16 @@ //RELEASE BUILD VERSION #ifdef JA2UB - CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8542 (Development Build)" }; #elif defined (JA113DEMO) - CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8542 (Development Build)" }; #else - CHAR16 zVersionLabel[256] = { L"Release v1.13.8541 (Development Build)" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.8542 (Development Build)" }; #endif #endif -CHAR8 czVersionNumber[16] = { "Build 18.03.08" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 18.03.10" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Init.cpp b/Init.cpp index 9fc9db45..f16a3845 100644 --- a/Init.cpp +++ b/Init.cpp @@ -744,13 +744,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcpy(fileName, directoryName); strcat(fileName, EXPLOSIONDATAFILENAME); SGP_THROW_IFFALSE(ReadInExplosionDataStats(fileName),EXPLOSIONDATAFILENAME); - - // Kaiden: Read in Restricted Sectors for Mobile Militia - strcpy(fileName, directoryName); - strcat(fileName, ROAMINGMILITIAFILENAME); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); - SGP_THROW_IFFALSE(ReadInRoamingInfo(fileName),ROAMINGMILITIAFILENAME); - + // Dealtar: Read in shipping destinations and delivery methods strcpy(fileName, directoryName); strcat(fileName, SHIPPINGDESTINATIONSFILENAME); @@ -791,13 +785,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName) strcat(fileName, SECTORFACILITIESFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorFacilities(fileName), SECTORFACILITIESFILENAME); - - // HEADROCK HAM 3.4: Read in dynamic roaming restrictions - strcpy(fileName, directoryName); - strcat(fileName, DYNAMICROAMINGFILENAME); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); - SGP_THROW_IFFALSE(ReadInDynamicRoamingRestrictions(fileName), DYNAMICROAMINGFILENAME); - + // HEADROCK HAM 3.6: Read in customized sector names strcpy(fileName, directoryName); strcat(fileName, SECTORNAMESFILENAME); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 28f95e15..ed9f1b6e 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -482,8 +482,8 @@ typedef struct #endif - // HEADROCK HAM 4: Added manual restrictions - UINT8 ubManualRestrictMilitia[256]; + // Flugente: was mobile restriction, now it's just a filler + UINT8 ubFiller1[256]; BOOLEAN HiddenNames[500]; //legion by Jazz @@ -6622,13 +6622,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) // fix squads CheckSquadMovementGroups(); - // HEADROCK HAM B1: Re-Adjust Dynamic Roaming Militia restrictions - if (gGameExternalOptions.fDynamicRestrictRoaming) - { - // HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. - AdjustRoamingRestrictions( TRUE ); - } - + // HEADROCK HAM 3.5: Tells the rest of the program whether we've got mercs working on detecting enemy units. UpdateStrategicDetectionLevel( ); @@ -8567,11 +8561,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) sGeneralInfo.fMorrisShouldSayHi = gfMorrisShouldSayHi; sGeneralInfo.fFirstTimeInGameHeliCrash = gfFirstTimeInGameHeliCrash; #endif - - // HEADROCK HAM 4: Save global array for Manual Mobile Militia Restrictions - // testing for loop - memcpy(sGeneralInfo.ubManualRestrictMilitia, gubManualRestrictMilitia, sizeof( UINT8 )*256); - + for (int i=0;i<500;++i) { sGeneralInfo.HiddenNames[i] = !zHiddenNames[i].Hidden; //legion2 @@ -8838,8 +8828,9 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller4, sizeof(sGeneralInfo.ubFiller4), sizeof(INT8), numBytesRead); #endif - if ( guiCurrentSaveGameVersion >= NEW_GENERAL_SAVE_INFO_DATA ){ - numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubManualRestrictMilitia, sizeof(sGeneralInfo.ubManualRestrictMilitia), sizeof(UINT8), numBytesRead); + if ( guiCurrentSaveGameVersion >= NEW_GENERAL_SAVE_INFO_DATA ) + { + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller1, sizeof( sGeneralInfo.ubFiller1 ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.HiddenNames, sizeof(sGeneralInfo.HiddenNames), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubHelicopterHoursToRepair, sizeof(sGeneralInfo.ubHelicopterHoursToRepair), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubHelicopterBasicRepairsSoFar, sizeof(sGeneralInfo.ubHelicopterBasicRepairsSoFar), sizeof(UINT8), numBytesRead); @@ -8851,7 +8842,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) } else { numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.HiddenNames, sizeof(sGeneralInfo.HiddenNames), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubFiller, sizeof(sGeneralInfo.ubFiller), sizeof(UINT8), numBytesRead); - for(UINT32 count = 0; count < sizeof(sGeneralInfo.ubManualRestrictMilitia); count++) + for(UINT32 count = 0; count < 256; ++count) numBytesRead = ReadFieldByField(hFile, &filler, sizeof(filler), sizeof(UINT8), numBytesRead); } //CHRISL: GENERAL_SAVE_INFO is only 1586 but we have to read in DWORD lengths so we need to read additional filler bits from the save game file @@ -9142,10 +9133,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gfMorrisShouldSayHi = sGeneralInfo.fMorrisShouldSayHi; gfFirstTimeInGameHeliCrash = sGeneralInfo.fFirstTimeInGameHeliCrash; #endif - - // HEADROCK HAM 4: Load Manual Mobile Militia Restrictions - memcpy(gubManualRestrictMilitia, sGeneralInfo.ubManualRestrictMilitia, sizeof(UINT8) * 256); - + for (int i=0;i<500;++i) { zHiddenNames[i].Hidden = !sGeneralInfo.HiddenNames[i]; diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 351e21ff..e27925be 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -655,7 +655,6 @@ BOOLEAN CanCharacterRepairAnotherSoldiersStuff( SOLDIERTYPE *pSoldier, SOLDIERTY // can this character EVER train militia? BOOLEAN BasicCanCharacterTrainMilitia( SOLDIERTYPE *pCharacter ); BOOLEAN BasicCanCharacterDrillMilitia( SOLDIERTYPE *pSoldier ); -BOOLEAN BasicCanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier ); // Can this character EVER work in any facility? BOOLEAN BasicCanCharacterFacility( SOLDIERTYPE *pSoldier ); @@ -1950,12 +1949,11 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier, UINT8 ubMilitiaType ) { - INT8 bLoop; INT8 bCount = 0; AssertNotNIL(pSoldier); - for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + for ( UINT8 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) { SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->stats.bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) @@ -1965,10 +1963,6 @@ INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier, UINT8 ubMilit { ++bCount; } - else if (ubMilitiaType == MOBILE_MILITIA && pOtherSoldier->bAssignment == TRAIN_MOBILE ) - { - ++bCount; - } } } @@ -2858,10 +2852,6 @@ void UpdateAssignments() { for( bZ = 0; bZ < 4; ++bZ ) { - // handle militia squads movings and creating (not an assignment) - if(!bZ && sX < 17 && sY < 17 && sX > 0 && sY > 0) - UpdateMilitiaSquads( sX, sY ); - // is there anyone in this sector? if( fSectorsWithSoldiers[ sX + sY * MAP_WORLD_X ][ bZ ] == TRUE ) { @@ -2968,20 +2958,6 @@ void VerifyTownTrainingIsPaidFor( void ) break; } } - - if ( pSoldier->bActive && ( pSoldier->bAssignment == TRAIN_MOBILE ) ) - { - // make sure that sector is paid up! - if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - // NOPE! We've got a bug somewhere - StopTimeCompression(); - // report the error - DoScreenIndependantMessageBox( L"ERROR: Unpaid militia training. Describe *how* you're re-assigning mercs, how many/where/when! Send *prior* save!", MSG_BOX_FLAG_OK, NULL ); - // avoid repeating this - break; - } - } } } #endif @@ -5975,8 +5951,7 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) { if( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ ) ) { - // HEADROCK HAM 3.6: TRAIN_MOBILE also possible now. Handled the same way. - if( ( pTrainer->bAssignment == TRAIN_TOWN || pTrainer->bAssignment == TRAIN_MOBILE ) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) + if( ( pTrainer->bAssignment == TRAIN_TOWN ) && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) { sTownTrainingPts = GetTownTrainPtsForCharacter( pTrainer, &usMaxPts ); @@ -6024,11 +5999,10 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) if ( gGameExternalOptions.fIndividualMilitia ) { FLOAT drillpoints = 0; - for ( uiCnt = 0, pTrainer = MercPtrs[uiCnt]; uiCnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiCnt, pTrainer++ ) + for ( uiCnt = 0, pTrainer = MercPtrs[uiCnt]; uiCnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiCnt, ++pTrainer ) { if ( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ ) ) { - // HEADROCK HAM 3.6: TRAIN_MOBILE also possible now. Handled the same way. if ( pTrainer->bAssignment == DRILL_MILITIA && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) { drillpoints += GetTownTrainPtsForCharacter( pTrainer, &usMaxPts ); @@ -6036,46 +6010,49 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ) } } - // a normal militia training session requires 10000 points. - // such a session would allow promoting gGameExternalOptions.iTrainingSquadSize - // a green militia requires gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular to promote - // it thus follows that one point of militia experience is worth (10000 / gGameExternalOptions.iTrainingSquadSize) / gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular training points - - drillpoints *= ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular / 10000.0 ); - - // we also need to pay for training we applied (otherwise promoting via normal training would - // a normal training session costs gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier - // it promotes gGameExternalOptions.iTrainingSquadSize militia with gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular points each - // thus a point costs gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier / ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular) points - FLOAT costperpoint = ( FLOAT)(gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier / ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular )); - - FLOAT totalcost = drillpoints * costperpoint; - - if ( totalcost > 0 && LaptopSaveInfo.iCurrentBalance < totalcost ) + if ( drillpoints > 0 ) { - drillpoints *= LaptopSaveInfo.iCurrentBalance / totalcost; - } + // a normal militia training session requires 10000 points. + // such a session would allow promoting gGameExternalOptions.iTrainingSquadSize + // a green militia requires gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular to promote + // it thus follows that one point of militia experience is worth (10000 / gGameExternalOptions.iTrainingSquadSize) / gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular training points - FLOAT drillpoints_used = PromoteIndividualMilitiaInSector( SECTOR( sMapX, sMapY ), drillpoints ); + drillpoints *= ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular / 10000.0 ); - if ( drillpoints_used > 0 ) - { - for ( uiCnt = 0, pTrainer = MercPtrs[uiCnt]; uiCnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiCnt, ++pTrainer ) + // we also need to pay for training we applied (otherwise promoting via normal training would + // a normal training session costs gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier + // it promotes gGameExternalOptions.iTrainingSquadSize militia with gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular points each + // thus a point costs gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier / ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular) points + FLOAT costperpoint = (FLOAT)( gGameExternalOptions.iMilitiaTrainingCost * gGameExternalOptions.iRegularCostModifier / ( gGameExternalOptions.iTrainingSquadSize * gGameExternalOptions.usIndividualMilitia_PromotionPoints_To_Regular ) ); + + FLOAT totalcost = drillpoints * costperpoint; + + if ( totalcost > 0 && LaptopSaveInfo.iCurrentBalance < totalcost ) { - if ( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ ) ) - { - if ( pTrainer->bAssignment == DRILL_MILITIA && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) - { - INT16 personaldrillpoints = GetTownTrainPtsForCharacter( pTrainer, &usMaxPts ); - - // trainer gains leadership - training argument is FALSE, because the trainer is not the one training! - StatChange( pTrainer, LDRAMT, (UINT16)( 1 + ( ( personaldrillpoints * drillpoints_used / drillpoints ) / 200 ) ), FALSE ); - StatChange( pTrainer, WISDOMAMT, (UINT16)( 1 + ( ( personaldrillpoints * drillpoints_used / drillpoints ) / 400 ) ), FALSE ); - } - } + drillpoints *= LaptopSaveInfo.iCurrentBalance / totalcost; } - AddTransactionToPlayersBook( PROMOTE_MILITIA, SECTOR( sMapX, sMapY ), GetWorldTotalMin(), -( drillpoints_used * costperpoint ) ); + FLOAT drillpoints_used = PromoteIndividualMilitiaInSector( SECTOR( sMapX, sMapY ), drillpoints ); + + if ( drillpoints_used > 0 ) + { + for ( uiCnt = 0, pTrainer = MercPtrs[uiCnt]; uiCnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiCnt, ++pTrainer ) + { + if ( pTrainer->bActive && ( pTrainer->sSectorX == sMapX ) && ( pTrainer->sSectorY == sMapY ) && ( pTrainer->bSectorZ == bZ ) ) + { + if ( pTrainer->bAssignment == DRILL_MILITIA && ( EnoughTimeOnAssignment( pTrainer ) ) && ( pTrainer->flags.fMercAsleep == FALSE ) ) + { + INT16 personaldrillpoints = GetTownTrainPtsForCharacter( pTrainer, &usMaxPts ); + + // trainer gains leadership - training argument is FALSE, because the trainer is not the one training! + StatChange( pTrainer, LDRAMT, (UINT16)( 1 + ( ( personaldrillpoints * drillpoints_used / drillpoints ) / 200 ) ), FALSE ); + StatChange( pTrainer, WISDOMAMT, (UINT16)( 1 + ( ( personaldrillpoints * drillpoints_used / drillpoints ) / 400 ) ), FALSE ); + } + } + } + + AddTransactionToPlayersBook( PROMOTE_MILITIA, SECTOR( sMapX, sMapY ), GetWorldTotalMin(), -( drillpoints_used * costperpoint ) ); + } } } } @@ -7267,46 +7244,7 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1 return( TRUE ); } } - else if (pTrainer->bAssignment == TRAIN_MOBILE) - { - pSectorInfo->ubMobileMilitiaTrainingPercentDone += (sTrainingPts / 100); - pSectorInfo->ubMobileMilitiaTrainingHundredths += (sTrainingPts % 100); - - if (pSectorInfo->ubMobileMilitiaTrainingHundredths >= 100) - { - pSectorInfo->ubMobileMilitiaTrainingPercentDone++; - pSectorInfo->ubMobileMilitiaTrainingHundredths -= 100; - } - - // NOTE: Leave this at 100, change TOWN_TRAINING_RATE if necessary. This value gets reported to player as a %age! - if( pSectorInfo->ubMobileMilitiaTrainingPercentDone >= 100 ) - { - // Flugente: carry over training progress instead of losing it - if ( gGameExternalOptions.gfMilitiaTrainingCarryOver ) - { - pSectorInfo->ubMobileMilitiaTrainingPercentDone -= 100; - } - else - { - // zero out training completion - there's no carryover to the next training session - pSectorInfo->ubMobileMilitiaTrainingPercentDone = 0; - pSectorInfo->ubMobileMilitiaTrainingHundredths = 0; - } - - // Flugente: this check is now necessary, as we might complete multiple militia session in one hour (theoretically) - if ( pSectorInfo->fMobileMilitiaTrainingPaid ) - { - // make the player pay again next time he wants to train here - pSectorInfo->fMobileMilitiaTrainingPaid = FALSE; - - TownMilitiaTrainingCompleted( pTrainer, sMapX, sMapY ); - } - - // training done - return( TRUE ); - } - } - + return ( FALSE ); } @@ -7421,7 +7359,7 @@ void DoInterrogation( INT16 sMapX, INT16 sMapY, FLOAT aChanceModifier, INT16 aPr CHAR16 wString[64]; swprintf( wString, L"" ); //AddMonoString( &hStringHandle, wString ); - swprintf( wString, pwTownInfoStrings[15 + i], aPrisoners[i] ); + swprintf( wString, pwTownInfoStrings[14 + i], aPrisoners[i] ); //strcat( sText, wString ); @@ -8493,10 +8431,6 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) { sTrainingBonus += (100 - gFacilityTypes[cnt].usMilitiaTraining); } - else if (pTrainer->bAssignment == TRAIN_MOBILE) - { - sTrainingBonus += (100 - gFacilityTypes[cnt].usMobileMilitiaTraining); - } } } } @@ -8619,7 +8553,7 @@ void AssignmentDone( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote, BOOLEAN fMeToo ) if ( fSayQuote ) { // HEADROCK HAM 3.6: Separated Militia Training - if ( ( fMeToo == FALSE ) && (pSoldier->bAssignment == TRAIN_TOWN || pSoldier->bAssignment == TRAIN_MOBILE || pSoldier->bAssignment == DRILL_MILITIA ) ) + if ( ( fMeToo == FALSE ) && (pSoldier->bAssignment == TRAIN_TOWN || pSoldier->bAssignment == DRILL_MILITIA ) ) { TacticalCharacterDialogue( pSoldier, QUOTE_ASSIGNMENT_COMPLETE ); @@ -12473,65 +12407,7 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) DetermineBoxPositions( ); break; - - // HEADROCK HAM 3.6: New separate Mobile Militia training. - case( TRAIN_MENU_MOBILE ): - - // Full test of Character and Sector to see if this training is possible at the moment. - if( !BasicCanCharacterTrainMobileMilitia(pSoldier) ) - { - // No feedback. The menu options should be greyed out, anyway. - break; - } - // Check for specific errors why this merc should not be able to train, - // and display a specific error message if one is encountered. - if( !CanCharacterTrainMobileMilitiaWithErrorReport(pSoldier) ) - { - // Error found. Breaking. Note that the above function DOES display feedback if an error is - // encountered at all. - break; - } - - // PASSED BOTH TESTS - ALLOW SOLDIER TO TRAIN MILITIA HERE - - pSoldier->bOldAssignment = pSoldier->bAssignment; - - if( ( pSoldier->bAssignment != TRAIN_MOBILE ) ) - { - SetTimeOfAssignmentChangeForMerc( pSoldier ); - } - - MakeSoldiersTacticalAnimationReflectAssignment( pSoldier ); - - // stop showing menu - fShowAssignmentMenu = FALSE; - giAssignHighLine = -1; - - // remove from squad - - if( pSoldier->bOldAssignment == VEHICLE ) - { - TakeSoldierOutOfVehicle( pSoldier ); - } - RemoveCharacterFromSquads( pSoldier ); - - ChangeSoldiersAssignment( pSoldier, TRAIN_MOBILE ); - - // assign to a movement group - AssignMercToAMovementGroup( pSoldier ); - if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - // show a message to confirm player wants to charge cost - HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); - } - else - { - SetAssignmentForList( TRAIN_MOBILE, 0 ); - } - gfRenderPBInterface = TRUE; - break; - case TRAIN_MENU_WORKERS: // Check for specific errors why this merc should not be able to train, @@ -15937,53 +15813,9 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam gfRenderPBInterface = TRUE; } break; - // HEADROCK HAM 3.6: Training mobiles is now a separate assignment. - case( TRAIN_MOBILE ): - if( CanCharacterTrainMobileMilitia( pSoldier ) ) - { - // train mobile militia - pSoldier->bOldAssignment = pSoldier->bAssignment; - - // set dirty flag - fTeamPanelDirty = TRUE; - fMapScreenBottomDirty = TRUE; - - // remove from squad - RemoveCharacterFromSquads( pSoldier ); - - // remove from any vehicle - if( pSoldier->bOldAssignment == VEHICLE ) - { - TakeSoldierOutOfVehicle( pSoldier ); - } - - if( ( pSoldier->bAssignment != TRAIN_MOBILE ) ) - { - SetTimeOfAssignmentChangeForMerc( pSoldier ); - } - - ChangeSoldiersAssignment( pSoldier, TRAIN_MOBILE ); - - if( pMilitiaTrainerSoldier == NULL ) - { - if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - // show a message to confirm player wants to charge cost - HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); - } - } - - AssignMercToAMovementGroup( pSoldier ); - // set dirty flag - fTeamPanelDirty = TRUE; - fMapScreenBottomDirty = TRUE; - gfRenderPBInterface = TRUE; - } - break; - + case TRAIN_WORKERS: { - // train mobile militia pSoldier->bOldAssignment = pSoldier->bAssignment; // set dirty flag @@ -16008,11 +15840,8 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam if( pMilitiaTrainerSoldier == NULL ) { - if( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - // show a message to confirm player wants to charge cost - HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); - } + // show a message to confirm player wants to charge cost + HandleInterfaceMessageForCostOfTrainingMilitia( pSoldier ); } AssignMercToAMovementGroup( pSoldier ); @@ -16771,31 +16600,7 @@ void HandleShadingOfLinesForTrainingMenu( void ) { UnShadeStringInBox( ghTrainingBox, TRAIN_MENU_SELF ); } - - // HEADROCK HAM 3.6: Training Mobile Militia. - // can character EVER train Mobile Militia? - if( BasicCanCharacterTrainMobileMilitia( pSoldier ) ) - { - // can he train here, now? - if( CanCharacterTrainMobileMilitia( pSoldier ) ) - { - // unshade train militia line - UnShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - UnSecondaryShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - } - else - { - UnShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - SecondaryShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - } - } - else - { - UnSecondaryShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - // shade train militia line - ShadeStringInBox( ghTrainingBox, TRAIN_MENU_MOBILE ); - } - + if( CanCharacterTrainWorkers( pSoldier ) ) { // unshade train militia line @@ -17611,12 +17416,7 @@ void ReEvaluateEveryonesNothingToDo( BOOLEAN aDoExtensiveCheck ) case TRAIN_TOWN: fNothingToDo = !CanCharacterTrainMilitia( pSoldier ); break; - - // HEADROCK HAM 3.6: Mobile Militia Training - case TRAIN_MOBILE: - fNothingToDo = !CanCharacterTrainMobileMilitia( pSoldier ); - break; - + case TRAIN_WORKERS: fNothingToDo = !CanCharacterTrainWorkers( pSoldier ); break; @@ -17851,14 +17651,6 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) fItWorked = TRUE; } break; - case( TRAIN_MOBILE ): - if( CanCharacterTrainMobileMilitia( pSoldier ) ) - { - pSoldier->bOldAssignment = pSoldier->bAssignment; - SetSoldierAssignment( pSoldier, bAssignment, 0, 0, 0 ); - fItWorked = TRUE; - } - break; case TRAIN_WORKERS: if( CanCharacterTrainWorkers( pSoldier ) ) { @@ -19045,311 +18837,6 @@ BOOLEAN FindAnyAwakeTrainees( SOLDIERTYPE *pTrainer ) return(!fAllTraineesAsleep); } -// HEADROCK HAM 3.6: A new set of functions (this & next) to determine whether a character can train Mobile Militia. -// This function tests character statistics. - -BOOLEAN BasicCanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier ) -{ - ///////////////////////////////////////////////////// - // Tests whether character can do assignments at all! - - AssertNotNIL(pSoldier); - - if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) ) - { - return( FALSE ); - } - - // Mobile Training allowed by INI settings? - if (!gGameExternalOptions.gfmusttrainroaming || // Mobiles turned off? - GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay || !gGameExternalOptions.gfAllowMilitiaGroups) // Mobiles not yet available? - { - // No Mobile Militia training allowed! - return ( FALSE ); - } - - // Flugente: not allowed if we can move militia in strategic, as this then becomes pointless - if ( gGameExternalOptions.fMilitiaStrategicCommand ) - return FALSE; - - // Is character dead or unconscious? - if( pSoldier->stats.bLife < OKLIFE ) - { - // dead or unconscious... - return ( FALSE ); - } - - // Is character underground? - if( pSoldier->bSectorZ != 0 ) - { - // underground training is not allowed (code doesn't support and it's a reasonable enough limitation) - return( FALSE ); - } - - // Is character on the way into/out of Arulco? - if( IsCharacterInTransit( pSoldier ) == TRUE ) - { - return ( FALSE ); - } - - // Is character travelling between sectors? - if( CharacterIsBetweenSectors( pSoldier ) ) - { - return( FALSE ); - } - - // Is character an Escortee? - if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC ) - { - // epcs can't do this - return( FALSE ); - } - - // Is character a Vehicle or Robot? - if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || AM_A_ROBOT( pSoldier ) ) - { - return( FALSE ); - } - - // IS character inside a helicopter over a hostile sector? - if( pSoldier->bAssignment == VEHICLE ) - { - if( ( iHelicopterVehicleId != -1 ) && ( pSoldier->iVehicleId == iHelicopterVehicleId ) ) - { - // enemies in sector - if ( NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ) > 0 ) - { - return( FALSE ); - } - } - } - - //////////////////////////////////////////////////////////////////////// - // Tests to see whether this sector allows training militia for ANYBODY. - - // is there a city in the character's current sector? - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - if (!bTownId) - { - // No city? No Mobiles. - return ( FALSE ); - } - else - { - // There's a city here. Does it allow training militia? - if (!MilitiaTrainingAllowedInTown( bTownId )) - { - // City does not allow militia training at all. - return ( FALSE ); - } - } - - // HEADROCK HAM 3.5: Only facilities allow militia training, and determine how many trainers can work here. - // Does sector have at least one facility that allows training? - // HEADROCK HAM 3.5: Only facilities allow militia training, and determine how many trainers can work here. - // Does sector have at least one facility that allows training? - BOOLEAN fMobileMilitiaTrainingAllowed = FALSE; - for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; cnt++) - { - // Is this facility here? - if (gFacilityLocations[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][cnt].fFacilityHere) - { - // Does it allow training militia? - if (gFacilityTypes[cnt].ubMobileMilitiaTrainersAllowed) - { - // Cool. - fMobileMilitiaTrainingAllowed = TRUE; - } - } - } - - return fMobileMilitiaTrainingAllowed; -} - -// HEADROCK HAM 3.6: A new set of functions (this & previous) to determine whether a character can train Mobile Militia. -// This function tests location. - -BOOLEAN CanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier ) -{ - AssertNotNIL(pSoldier); - - // Make sure the basic sector/merc variables are still applicable. This is simply a fail-safe. - if( !BasicCanCharacterTrainMobileMilitia( pSoldier ) ) - { - // Soldier/Sector have somehow failed the basic test. Character automatically fails this test as well. - return( FALSE ); - } - - if( NumEnemiesInAnySector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) - { - return( FALSE ); - } - - // Has leadership skill? - if( pSoldier->stats.bLeadership <= 0 ) - { - // no skill whatsoever - return ( FALSE ); - } - - // Sector Loyalty above minimum? - if( !DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) ) - { - // Not enough Loyalty... - return ( FALSE ); - } - - // HEADROCK HAM 3: When "Minimum Leadership for Militia Training" is enforced, this value holds the - // merc's effective leadership, after the "TEACHER" trait is taken into account. - UINT16 usEffectiveLeadership; - - // HEADROCK HAM 3: Determine whether the merc has enough leadership to train militia. The teacher trait may - // increase or decrease the effective skill. - if( gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia > 0 ) - { - // Read BASE leadership - usEffectiveLeadership = pSoldier->stats.bLeadership; - - // Apply modifier for TEACHER trait, if that feature is activated - if ( gGameExternalOptions.usTeacherTraitEffectOnLeadership > 0 && gGameExternalOptions.usTeacherTraitEffectOnLeadership != 100 ) - { - // Read BASE leadership - usEffectiveLeadership = pSoldier->stats.bLeadership; - - if ( gGameOptions.fNewTraitSystem ) // SANDRO - old/new traits - { - if (HAS_SKILL_TRAIT( pSoldier, TEACHING_NT )) - { - // bonus from Teaching trait - usEffectiveLeadership = (usEffectiveLeadership * (100 + gSkillTraitValues.ubTGEffectiveLDRToTrainMilitia) / 100 ); - } - } - else - { - // Modifier applied once for each TEACHING level. - for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pSoldier, TEACHING_OT ); i++ ) - { - // This is a percentage modifier. - usEffectiveLeadership = (usEffectiveLeadership * gGameExternalOptions.usTeacherTraitEffectOnLeadership)/100; - } - } - } - - usEffectiveLeadership = __min(100,usEffectiveLeadership); - - // Is leadership too low to proceed? - if (usEffectiveLeadership < gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia) - { - return ( FALSE ); - } - } - - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR(pSoldier->sSectorX, pSoldier->sSectorY) ] ); - - //////////////////////////////////////////////// - // Check whether controlled town sectors already have full militia - - // HEADROCK HAM 4: This check is no longer required. We can manually restrict mobiles from entering a city - // after being created, so we should be able to train them if we need them straight away. - - /* - - INT32 iCounter = 0; - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR(pSoldier->sSectorX, pSoldier->sSectorY) ] ); - BOOLEAN fUnfullSectorFound = FALSE; - - if ( CountMilitia( pSectorInfo ) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - fUnfullSectorFound = TRUE; - } - else - { - iCounter = 0; - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - INT16 sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - INT16 sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] ); - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. This sector cannot generate militia anyway. - iCounter++; - continue; - } - else - { - if (CountMilitia(pSectorInfo) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - // Found a controlled city sector that does not yet have a full garrison - fUnfullSectorFound = TRUE; - } - } - } - iCounter++; - } - } - if (fUnfullSectorFound) - { - // At least one city sector is controlled but not full of garrison militia. Can't train mobiles! - return (FALSE); - } - */ - - ////////////////////////////////////////////// - // HEADROCK HAM 3.5: Militia Training Facility - // - - // Militia training is enabled in the sector only if there is a facility that allows this here. - // If one or more facilities are found, positive values are summed up and presented as the number - // of trainers allowed in the sector. Values are read from XML, and can be set to mimic JA2 - // defaults. This renders the INI setting "MAX_MILITIA_TRAINERS.." obsolete. - - // HEADROCK HAM 3.5: Only facilities allow militia training, and determine how many trainers can work here. - // Does sector have at least one facility that allows training? - UINT8 ubFacilityTrainersAllowed = 0; - for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt) - { - // Is this facility here? - if (gFacilityLocations[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][cnt].fFacilityHere) - { - // Increase tally - ubFacilityTrainersAllowed += gFacilityTypes[cnt].ubMobileMilitiaTrainersAllowed; - } - } - - // Count number of trainers already operating here - if ( CountMilitiaTrainersInSoldiersSector( pSoldier, MOBILE_MILITIA ) >= ubFacilityTrainersAllowed ) - { - // Too many trainers in sector. - return (FALSE); - } - - // This will be replaced with an appropriate check to see if we have militia presence in this city at all. - // For now, Mobile Militia training is allowed regardless of how many troopers you have here. - // - // Is town full of Elites? - //if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )) - //{ - // // Town is full of Elites. No further training required. - // // Also note that this takes care of Regulars as well, if Elite training is disabled. - // return( FALSE ); - //} - - if ( 100 <= GetMobileMilitiaQuota( FALSE ) ) - return ( FALSE ); - - // If we've reached this, then all is well. - return( TRUE ); -} - BOOLEAN CanCharacterTrainWorkers( SOLDIERTYPE *pSoldier ) { AssertNotNIL(pSoldier); @@ -19425,9 +18912,6 @@ BOOLEAN CanCharacterTrainMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ) } } - if ( 100 <= GetMobileMilitiaQuota( TRUE ) ) - return ( FALSE ); - /////////////////////////////// // Test for required Leadership @@ -19498,18 +18982,6 @@ BOOLEAN CanCharacterTrainMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ) } } - // HEADROCK HAM 3.6: To be moved into the Mobile Militia training routine.... - // Kaiden: Roaming Militia Training: - //if(IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, ELITE_MILITIA )) - // if (!gGameExternalOptions.gfmusttrainroaming) - // fCanTrainMilitia = FALSE; - // else if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay) - // fCanTrainMilitia = FALSE; - // else if (IsThisSectorASAMSector(pSoldier->sSectorX,pSoldier->sSectorY,0 )) - // fCanTrainMilitia = FALSE; - // else - // fCanTrainMilitia = TRUE; - //////////////////////////////// // Test for Militia Capacity @@ -19566,235 +19038,6 @@ BOOLEAN CanCharacterTrainMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ) return (TRUE); } -BOOLEAN CanCharacterTrainMobileMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ) -{ - // Temp string. - CHAR16 sString[ 256 ]; - INT32 iCounter = 0; - - // Enemies present? - if( NumEnemiesInAnySector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) - { - // Report "Enemies present!" - DoScreenIndependantMessageBox( New113HAMMessage[5], MSG_BOX_FLAG_OK, NULL ); - return( FALSE ); - } - - if ( 100 <= GetMobileMilitiaQuota( TRUE ) ) - return ( FALSE ); - - /////////////////////////////// - // Test for required Leadership - - UINT16 usEffectiveLeadership = pSoldier->stats.bLeadership; // Basic leadership score - BOOLEAN fSufficientLeadership = TRUE; // Result of check - - // Apply modifier for TEACHER trait, if that feature is activated - if ( gGameExternalOptions.usTeacherTraitEffectOnLeadership > 0 && gGameExternalOptions.usTeacherTraitEffectOnLeadership != 100 ) - { - if ( gGameOptions.fNewTraitSystem ) // SANDRO - old/new traits - { - if (HAS_SKILL_TRAIT( pSoldier, TEACHING_NT )) - { - // bonus from Teaching trait - usEffectiveLeadership = (usEffectiveLeadership * (100 + gSkillTraitValues.ubTGEffectiveLDRToTrainMilitia) / 100 ); - } - } - else - { - // Modifier applied once for each TEACHING level. - for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pSoldier, TEACHING_OT ); i++ ) - { - // This is a percentage modifier. - usEffectiveLeadership = (usEffectiveLeadership * gGameExternalOptions.usTeacherTraitEffectOnLeadership)/100; - } - } - - usEffectiveLeadership = __min(100,usEffectiveLeadership); - } - - // Is there an INI-set requirement? - if (gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia) - { - // Does he fail the requirement? - if (usEffectiveLeadership < gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia) - { - fSufficientLeadership = FALSE; - } - } - // If there is no requirement, does the soldier have ANY leadership skill? - else if (usEffectiveLeadership <= 0) - { - fSufficientLeadership = FALSE; - } - - // Failed above leadership tests? - if( !fSufficientLeadership ) - { - // Report "Insufficient Leadership Skill" - swprintf(sString, New113HAMMessage[6], pSoldier->GetName()); - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); - return ( FALSE ); - } - - ///////////////////////////////////////// - // Town loyalty test - // is the current loyalty high enough to train militia at all? - if( DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) == FALSE ) - { - // Report "Not enough loyalty!" - DoScreenIndependantMessageBox( zMarksMapScreenText[ 20 ], MSG_BOX_FLAG_OK, NULL ); - return (FALSE); - } - - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR(pSoldier->sSectorX, pSoldier->sSectorY) ] ); - - //////////////////////////////////////////////// - // Check whether controlled town sectors already have full militia - - // HEADROCK HAM 4: This check is no longer necessary. We can manually restrict mobiles from moving into a city - // in-game, so you can train mobiles straight away if you need them. - /* - - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR(pSoldier->sSectorX, pSoldier->sSectorY) ] ); - UINT8 ubUnfullSectorsFound = 0; - - if ( CountMilitia( pSectorInfo ) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - ubUnfullSectorsFound++; - } - else - { - iCounter = 0; - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - INT16 sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - INT16 sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] ); - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. This sector cannot generate militia anyway. - iCounter++; - continue; - } - else - { - if (CountMilitia(pSectorInfo) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - // Found a controlled city sector that does not yet have a full garrison - ubUnfullSectorsFound++; - } - } - } - iCounter++; - } - } - if (ubUnfullSectorsFound) - { - // At least one city sector is controlled but not full of garrison militia. Can't train mobiles! - swprintf(sString, New113HAMMessage[9], gGameExternalOptions.iMaxMilitiaPerSector, pTownNames[bTownId]); - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); - return (FALSE); - } - - */ - - ////////////////////////////////////////// - // Capacity and Garrison checks in nearby sectors - UINT16 pMoveDir[4][3]; - UINT8 uiDirNumber = 0; - BOOLEAN fFoundValidSector = FALSE; - - GenerateDirectionInfosForTraining( pSoldier->sSectorX, pSoldier->sSectorY, &uiDirNumber, pMoveDir ); - // Found at least one suitable place to put Mobiles? - if (uiDirNumber) - { - fFoundValidSector = TRUE; - } - // Try entire city. Only the HAM Smart Militia Generator can handle this. - else - { - iCounter = 0; - // Go through each city in the game - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - INT16 sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - INT16 sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. This sector cannot generate militia anyway. - ++iCounter; - continue; - } - - // Find out if any adjacent sectors have room in them. - GenerateDirectionInfosForTraining( sCurrentX, sCurrentY, &uiDirNumber, pMoveDir ); - - if(uiDirNumber) - { - fFoundValidSector = TRUE; - break; - } - } - - ++iCounter; - } - } - - // Couldn't find at least one sector to place Mobiles. Report "No room!" - if (!fFoundValidSector) - { - swprintf(sString, New113HAMMessage[8], pTownNames[ bTownId ]); - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); - return (FALSE); - } - - ////////////////////////////////////////////// - // HEADROCK HAM 3.5: Militia Training Facility - // - // Militia training is enabled in the sector only if there is a facility that allows this here. - // If one or more facilities are found, positive values are summed up and presented as the number - // of trainers allowed in the sector. Values are read from XML, and can be set to mimic JA2 - // defaults. This renders the INI setting "MAX_MILITIA_TRAINERS.." obsolete. - - UINT8 ubFacilityTrainersAllowed = 0; - for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt) - { - // Is this facility here? - if (gFacilityLocations[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)][cnt].fFacilityHere) - { - // Increase tally - ubFacilityTrainersAllowed += gFacilityTypes[cnt].ubMobileMilitiaTrainersAllowed; - } - } - // If we are here, then TrainersAllowed > 0. - // Otherwise we'd have failed the BasicCanTrain check - if ( CountMilitiaTrainersInSoldiersSector( pSoldier, MOBILE_MILITIA ) >= ubFacilityTrainersAllowed ) - { - swprintf( sString, New113HAMMessage[ 7 ], ubFacilityTrainersAllowed ); - // Report "Too many Militia Trainers!" - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL ); - return (FALSE); - } - - // No errors to report. Character can perform this assignment. - return (TRUE); -} - // HEADROCK HAM 3.6: This function determines whether a character can use facilities at all, or whether the sector has // any "useable" facilities at all. BOOLEAN BasicCanCharacterFacility( SOLDIERTYPE *pSoldier ) @@ -21799,7 +21042,7 @@ BOOLEAN MakeAutomaticSurgery( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pDoctor ) } // SANDRO - added a function to write down to our records, how many militia we trained -void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilitiaTrained, BOOLEAN fMobile ) +void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilitiaTrained ) { UINT16 cnt = 0; SOLDIERTYPE * pTrainer; @@ -21809,8 +21052,7 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit // First, get total leadership value of all trainers for ( pTrainer = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pTrainer++) { - if (pTrainer->bActive && pTrainer->stats.bLife >= OKLIFE && pTrainer->sSectorX == sX && pTrainer->sSectorY == sY && pTrainer->bSectorZ == bZ && - ( (!fMobile && pTrainer->bAssignment == TRAIN_TOWN) || (fMobile && pTrainer->bAssignment == TRAIN_MOBILE) ) ) + if (pTrainer->bActive && pTrainer->stats.bLife >= OKLIFE && pTrainer->sSectorX == sX && pTrainer->sSectorY == sY && pTrainer->bSectorZ == bZ && pTrainer->bAssignment == TRAIN_TOWN ) { usTrainerEffectiveLeadership = EffectiveLeadership( pTrainer ); @@ -21828,7 +21070,7 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit // Effective leadership is modified by an INI-based percentage, once for every TEACHING trait level. else if ( gGameExternalOptions.usTeacherTraitEffectOnLeadership > 0 && gGameExternalOptions.usTeacherTraitEffectOnLeadership != 100 ) { - for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pTrainer, TEACHING_OT ); i++ ) + for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pTrainer, TEACHING_OT ); ++i ) { // percentage-based. usTrainerEffectiveLeadership = __min(100,((usTrainerEffectiveLeadership * gGameExternalOptions.usTeacherTraitEffectOnLeadership)/100)); @@ -21853,8 +21095,7 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit cnt = 0; for ( pTrainer = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pTrainer++) { - if (pTrainer->bActive && pTrainer->stats.bLife >= OKLIFE && pTrainer->sSectorX == sX && pTrainer->sSectorY == sY && pTrainer->bSectorZ == bZ && - ( (!fMobile && pTrainer->bAssignment == TRAIN_TOWN) || (fMobile && pTrainer->bAssignment == TRAIN_MOBILE) ) ) + if (pTrainer->bActive && pTrainer->stats.bLife >= OKLIFE && pTrainer->sSectorX == sX && pTrainer->sSectorY == sY && pTrainer->bSectorZ == bZ && pTrainer->bAssignment == TRAIN_TOWN ) { usTrainerEffectiveLeadership = EffectiveLeadership( pTrainer ); @@ -21872,7 +21113,7 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit // Effective leadership is modified by an INI-based percentage, once for every TEACHING trait level. else if ( gGameExternalOptions.usTeacherTraitEffectOnLeadership > 0 && gGameExternalOptions.usTeacherTraitEffectOnLeadership != 100 ) { - for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pTrainer, TEACHING_OT ); i++ ) + for (UINT8 i = 0; i < NUM_SKILL_TRAITS( pTrainer, TEACHING_OT ); ++i ) { // percentage-based. usTrainerEffectiveLeadership = __min(100,((usTrainerEffectiveLeadership * gGameExternalOptions.usTeacherTraitEffectOnLeadership)/100)); @@ -21900,11 +21141,6 @@ void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 bZ, UINT8 ubMilit BOOLEAN CanMercBeAllowedToLeaveTeam( SOLDIERTYPE *pSoldier ) { -/* - //if we are in sector... J14_1 && K14_1 - if( gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_J && gbWorldSectorZ == 1 || - gWorldSectorX == 14 && gWorldSectorY == MAP_ROW_K && gbWorldSectorZ == 1 ) -*/ //if we are in, or passed the tunnels if( pSoldier->sSectorX >= 14 ) { diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 98ad6514..e5611e4d 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -65,7 +65,7 @@ enum RADIO_SCAN, // added by Flugente: a radio operators scans for enemy patrols in nearby sectors TRAIN_SELF, TRAIN_TOWN, - TRAIN_MOBILE, // HEADROCK HAM 3.6: Training mobile militia. + ASSIGNMENT_UNUSED, // Flugente: this was formerly TRAIN_MOBILE TRAIN_TEAMMATE, TRAIN_BY_OTHER, MOVE_EQUIPMENT, // added by Flugente: move items from one city sector to another @@ -196,7 +196,6 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pCharacter ); // can character train militia? BOOLEAN CanCharacterDrillMilitia( SOLDIERTYPE *pSoldier, BOOLEAN aErrorReport = FALSE ); BOOLEAN CanCharacterTrainMilitia( SOLDIERTYPE *pCharacter ); -BOOLEAN CanCharacterTrainMobileMilitia( SOLDIERTYPE *pSoldier ); BOOLEAN CanCharacterTrainWorkers( SOLDIERTYPE *pSoldier ); @@ -534,7 +533,6 @@ BOOLEAN FindAnyAwakeTrainees( SOLDIERTYPE *pTrainer ); // HEADROCK HAM 3.6: Functions for testing and reporting reasons why character can't train here. BOOLEAN CanCharacterTrainMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ); -BOOLEAN CanCharacterTrainMobileMilitiaWithErrorReport( SOLDIERTYPE *pSoldier ); // HEADROCK HAM 3.6: Function for testing and reporting reasons why character can't staff a facility. BOOLEAN CanCharacterFacilityWithErrorReport( SOLDIERTYPE *pSoldier, UINT8 ubFacilityType, UINT8 ubAssignmentType ); void HandleInterfaceMessageForCostOfOperatingFacility( SOLDIERTYPE *pSoldier, UINT8 ubAssignmentType ); @@ -547,7 +545,7 @@ extern UINT8 gubFacilityLineForSubmenu; extern SOLDIERTYPE *gpFacilityStaffer; // SANDRO - function to award record points for militia training -void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 sZ, UINT8 ubMilitiaTrained, BOOLEAN fMobile ); +void RecordNumMilitiaTrainedForMercs( INT16 sX, INT16 sY, INT8 sZ, UINT8 ubMilitiaTrained ); // anv: decrease town loyalty hits UINT32 HandlePropagandaBlockingBadNewsInTown( INT8 bTownId, UINT32 uiLoyaltyDecrease ); diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 89904183..90a17d11 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -325,10 +325,6 @@ void RenderSoldierCellHealth( SOLDIERCELL *pCell ); void RenderSoldierCell( SOLDIERCELL *pCell ); void RenderSoldierCellBars( SOLDIERCELL *pCell ); -// HEADROCK HAM 3.4: New argument configuration to make use of revamped movement controls -void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3], BOOLEAN fForTraining, BOOLEAN fForBattle ); - - //Dynamic globals -- to conserve memory, all global variables are allocated upon entry //and deleted before we leave. AUTORESOLVE_STRUCT *gpAR = NULL; diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 46f2c8f2..e8ca7aee 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -296,9 +296,7 @@ typedef struct FACILITYTYPE UINT8 ubTotalStaffLimit; // Total number of people who can work here simultaneously UINT8 ubMilitiaTrainersAllowed; // Number of Militia trainers allowed simultaneously - UINT8 ubMobileMilitiaTrainersAllowed; // Number of Mobile Militia trainers allowed simultaneously UINT16 usMilitiaTraining; // Percentage effectiveness of Militia training (100 = normal) - UINT16 usMobileMilitiaTraining; // Percentage effectiveness of Mobile Militia training (100 = normal) UINT32 usFacilityFlags; // flagmask for various facility properties @@ -306,7 +304,6 @@ typedef struct FACILITYTYPE } FACILITYTYPE; - // HEADROCK HAM 3.5: Maximum number of different facility types #define MAX_NUM_FACILITY_TYPES 255 // HEADROCK HAM 3.5: Number of facilities placed on the map @@ -487,9 +484,9 @@ typedef struct SECTORINFO //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE // HEADROCK HAM 3.6: Adding separate training percentage for MOBILES. - UINT8 ubMobileMilitiaTrainingPercentDone; - UINT8 ubMobileMilitiaTrainingHundredths; - BOOLEAN fMobileMilitiaTrainingPaid; + UINT8 usFiller3; + UINT8 usFiller1; + BOOLEAN fFiller2; // Replacing these variables with the ones above. They really are unused. //UINT16 usUNUSEDMilitiaLevels; // unused (ARM) //UINT8 ubUNUSEDNumberOfJoeBlowCivilians; // unused (ARM) diff --git a/Strategic/Facilities.cpp b/Strategic/Facilities.cpp index d3f4e296..c318a0e8 100644 --- a/Strategic/Facilities.cpp +++ b/Strategic/Facilities.cpp @@ -397,17 +397,7 @@ void UpdateStrategicDetectionLevel( ) ///////////////////////////////////////////////////////// // Begin testing for facility detection bonuses. - - // Does game allow Dynamic Roaming Militia? - if (gGameExternalOptions.fDynamicRestrictRoaming) - { - // Does facility allow Dynamic Detection? - if (GetFacilityModifier(FACILITY_DETECT_DYNAMIC, ubFacilityType, ubAssignmentType)) - { - ubStrategicDetectionLevel |= (1 << DETECT_ENEMIES_DYNAMIC); - } - } - + // Does facility allow Long-Range Detection? if (GetFacilityModifier(FACILITY_DETECT_LONGRANGE, ubFacilityType, ubAssignmentType)) { @@ -461,24 +451,16 @@ void UpdateStrategicDetectionLevel( ) } } } - ubCounter++; + ++ubCounter; } + // Some flags have been set. Run through all sectors and apply this. - for (UINT16 X = 0; X < 256; X++) + for (UINT16 X = 0; X < 256; ++X) { // Reset detection level first // sevenfm: this will disable enemy detection using facility, and detection levels are already zeroed in this function //SectorInfo[X].ubDetectionLevel = 0; - - if (ubStrategicDetectionLevel & (1< 0 ) - { - // found at least one - return( 2 ); - } - } - } - } - - // Militia are allowed, but none have been found. - return( 1 ); -} - - void CommonBtnCallbackBtnDownChecks( void ) { if( IsMapScreenHelpTextUp() ) @@ -1453,8 +1233,6 @@ void CommonBtnCallbackBtnDownChecks( void ) } } - - void InitMapScreenFlags( void ) { fShowTownFlag = TRUE; @@ -1468,8 +1246,6 @@ void InitMapScreenFlags( void ) gusMapDisplayColourMode = MAP_DISPLAY_NORMAL; } - - void MapBorderButtonOff( UINT8 ubBorderButtonIndex ) { Assert( ubBorderButtonIndex < NUM_MAP_BORDER_BTNS ); @@ -1490,7 +1266,6 @@ void MapBorderButtonOff( UINT8 ubBorderButtonIndex ) ButtonList[ giMapBorderButtons[ ubBorderButtonIndex ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); } - void MapBorderButtonOn( UINT8 ubBorderButtonIndex ) { Assert( ubBorderButtonIndex < NUM_MAP_BORDER_BTNS ); @@ -1528,8 +1303,6 @@ void InitMapBorderButtonCoordinates() MAP_BORDER_ITEM_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); MAP_BORDER_MILITIA_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) - 23; MAP_BORDER_MILITIA_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - MAP_BORDER_MOBILE_BTN_X = xResSize; - MAP_BORDER_MOBILE_BTN_Y = 0; MAP_BORDER_DISEASE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 190; MAP_BORDER_DISEASE_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); MAP_BORDER_WEATHER_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 233; @@ -1538,18 +1311,5 @@ void InitMapBorderButtonCoordinates() MAP_LEVEL_MARKER_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 114; MAP_LEVEL_MARKER_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); MAP_LEVEL_MARKER_DELTA = 8; - MAP_LEVEL_MARKER_WIDTH = 55; - - if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand ) - { - // Mobile button appears next to Militia button. - MAP_BORDER_MOBILE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 16; - MAP_BORDER_MOBILE_BTN_Y = (SCREEN_HEIGHT - yResOffset - buttonOffset); - - // Airspace, Items, ZLevel buttons all moved to the right (+22px, +22px, +10px). - MAP_BORDER_AIRSPACE_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 42; - MAP_BORDER_ITEM_BTN_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 85; - - MAP_LEVEL_MARKER_X = xResOffset + MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset) / 2) + 124; - } + MAP_LEVEL_MARKER_WIDTH = 55; } diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index 50c62630..dfc86a4a 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -6,9 +6,6 @@ //#define MAP_BORDER_START_X 261 //#define MAP_BORDER_START_Y 0 - - - // scroll directions enum{ ZOOM_MAP_SCROLL_UP =0, @@ -30,13 +27,11 @@ enum{ MAP_BORDER_AIRSPACE_BTN, MAP_BORDER_ITEM_BTN, MAP_BORDER_MILITIA_BTN, - MAP_BORDER_MOBILE_BTN, // HEADROCK HAM 4: Mobile Militia Restrictions button MAP_BORDER_DISEASE_BTN, // Flugente: toggle disease views MAP_BORDER_WEATHER_BTN, // Flugente: toggle weather display NUM_MAP_BORDER_BTNS, // end enumeration marker }; - // HEADROCK HAM 4: Turned these into EXTERNS to allow dynamic modification //#define MAP_LEVEL_MARKER_X (MAP_BORDER_X + ((SCREEN_WIDTH - MAP_BORDER_X) / 2 + 114)) //MAP_BORDER_X + MAP_BORDER_X_OFFSET + 384 //(SCREEN_WIDTH - 75) //565 extern UINT16 MAP_LEVEL_MARKER_X; @@ -44,7 +39,6 @@ extern UINT16 MAP_LEVEL_MARKER_Y; extern UINT16 MAP_LEVEL_MARKER_DELTA; extern UINT16 MAP_LEVEL_MARKER_WIDTH; - extern BOOLEAN fShowTownFlag; extern BOOLEAN fShowMineFlag; extern BOOLEAN fShowTeamFlag; @@ -57,7 +51,6 @@ enum MAP_DISPLAY_NORMAL, MAP_DISPLAY_AIRSPACE, MAP_DISPLAY_AIRSPACE_COLOURED_SAMS, - MAP_DISPLAY_MOBILEMILITIARESTRICTIONS, MAP_DISPLAY_DISEASE, MAP_DISPLAY_WEATHER, }; @@ -71,8 +64,6 @@ extern INT32 giScrollButtonState; BOOLEAN LoadMapBorderGraphics( void ); void DeleteMapBorderGraphics( void ); void RenderMapBorder( void ); -//void ShowDestinationOfPlottedPath( STR16 pLoc ); -//void ResetAircraftButton( void ); void ToggleShowTownsMode( void ); void ToggleShowMinesMode( void ); @@ -80,8 +71,6 @@ void ToggleShowMilitiaMode( void ); void ToggleShowTeamsMode( void ); void ToggleAirspaceMode( void ); void ToggleItemsFilter( void ); -// HEADROCK HAM 4: Toggle Mobile Militia Restrictions Filter -void ToggleMobileFilter( void ); // Flugente: disease void ToggleDiseaseFilter( ); @@ -92,8 +81,6 @@ void ToggleWeatherFilter( ); void TurnOnShowTeamsMode( void ); void TurnOnAirSpaceMode( void ); void TurnOnItemFilterMode( void ); -// HEADROCK HAM 4: Turn on Mobile Militia Restrictions Filter -void TurnOnMobileFilterMode( void ); // Flugente: disease void TurnOnDiseaseFilterMode(); @@ -108,8 +95,6 @@ BOOLEAN CreateButtonsForMapBorder( void ); // render the pop up for eta in path plotting in map screen void RenderMapBorderEtaPopUp( void ); BOOLEAN DoesPlayerHaveAnyMilitia( void ); -// HEADROCK HAM 4: Same with Mobiles. -UINT8 DoesPlayerHaveAnyMobileMilitia( void ); // create mouse regions for level markers void CreateMouseRegionsForLevelMarkers( void ); diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 5f1cf7f2..4e14f759 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -842,33 +842,7 @@ UINT32 DrawMap( void ) mprintf( usXPos, usYPos, sString ); } break; - - case MAP_DISPLAY_MOBILEMILITIARESTRICTIONS: - { - // HEADROCK HAM 4: Show Manual Mobile Militia Restrictions - UINT8 ubManualMobileMovementAllowed = ManualMobileMovementAllowed( SECTOR( cnt, cnt2 ) ); - switch ( ubManualMobileMovementAllowed ) - { - case 0: - // Mobiles not allowed here at all. - ShadeMapElem( cnt, cnt2, MAP_SHADE_DK_GREY ); - break; - case 1: - // Mobiles forbidden by player - ShadeMapElem( cnt, cnt2, MAP_SHADE_MD_RED ); - break; - case 2: - // Mobiles can enter but not leave - ShadeMapElem( cnt, cnt2, MAP_SHADE_LT_YELLOW ); - break; - case 3: - // Mobiles can enter - ShadeMapElem( cnt, cnt2, MAP_SHADE_LT_GREEN ); - break; - } - } - break; - + case MAP_DISPLAY_DISEASE: ShadeMapElem( cnt, cnt2, GetMapColour( cnt, cnt2, 0 ) ); break; @@ -2335,7 +2309,7 @@ INT16 GetLastSectorOfHelicoptersPath( void ) INT16 GetLastSectorOfMilitiaPath( void ) { // will return the last sector of the helicopter's current path - INT16 sLastSector = gMilitiaPlotStartSector;//pVehicleList[iHelicopterVehicleId].sSectorX + pVehicleList[iHelicopterVehicleId].sSectorY * MAP_WORLD_X; + INT16 sLastSector = gMilitiaPlotStartSector; PathStPtr pNode = NULL; pNode = gMilitiaPath[gMilitiaGroupId].path; diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index be7dd7d2..d7038cf5 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -468,9 +468,9 @@ void AddTextToTownBox( void ) } // prisoners - swprintf( wString, L"%s:", pwTownInfoStrings[ 13 ] ); + swprintf( wString, L"%s:", pwTownInfoStrings[ 12 ] ); AddMonoString( &hStringHandle, wString ); - swprintf( wString, pwTownInfoStrings[14], numprisoners, capacity ); + swprintf( wString, pwTownInfoStrings[13], numprisoners, capacity ); AddSecondColumnMonoString( &hStringHandle, wString ); for ( int i = 0; i < PRISONER_MAX; ++i ) @@ -479,7 +479,7 @@ void AddTextToTownBox( void ) { swprintf( wString, L"" ); AddMonoString( &hStringHandle, wString ); - swprintf( wString, pwTownInfoStrings[15 + i], aPrisoners[i] ); + swprintf( wString, pwTownInfoStrings[14 + i], aPrisoners[i] ); AddSecondColumnMonoString( &hStringHandle, wString ); } } @@ -817,8 +817,7 @@ void AddCommonInfoToBox(void) // No/Yes swprintf( wString, L"%s", pwMiscSectorStrings[ ( StrategicMap[ CALCULATE_STRATEGIC_INDEX( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ].fEnemyControlled ) ? 6 : 5 ] ); AddSecondColumnMonoString( &hStringHandle, wString ); - - + // militia - is there any? swprintf( wString, L"%s:", pwTownInfoStrings[ 11 ] ); AddMonoString( &hStringHandle, wString ); @@ -842,23 +841,25 @@ void AddCommonInfoToBox(void) // HEADROCK HAM 3.6: Only show these for sectors that have a training facility BOOLEAN fMilitiaTrainingAllowed = FALSE; - BOOLEAN fMobileTrainingAllowed = FALSE; // percentage of current militia squad training completed swprintf( wString, L"%s:", pwTownInfoStrings[ 10 ] ); AddMonoString( &hStringHandle, wString ); // Sector contains Militia training facility? - for (UINT8 ubCounter = 0; ubCounter < MAX_NUM_FACILITY_TYPES; ubCounter++) + for (UINT8 ubCounter = 0; ubCounter < MAX_NUM_FACILITY_TYPES; ++ubCounter) { if (gFacilityLocations[usSectorValue][ubCounter].fFacilityHere) { if (gFacilityTypes[ubCounter].ubMilitiaTrainersAllowed) { fMilitiaTrainingAllowed = TRUE; + + break; } } } + if (fMilitiaTrainingAllowed) { // Show percent completed @@ -870,37 +871,8 @@ void AddCommonInfoToBox(void) // Show N/A AddSecondColumnMonoString( &hStringHandle, New113HAMMessage[19] ); } - - // HEADROCK HAM 3.6: percentage of current Mobile Militia squad training completed - swprintf( wString, L"%s:", pwTownInfoStrings[ 12 ] ); - AddMonoString( &hStringHandle, wString ); - - // Sector contains Mobile training facility? - for (UINT8 ubCounter = 0; ubCounter < MAX_NUM_FACILITY_TYPES; ubCounter++) - { - if (gFacilityLocations[usSectorValue][ubCounter].fFacilityHere) - { - if (gFacilityTypes[ubCounter].ubMobileMilitiaTrainersAllowed) - { - fMobileTrainingAllowed = TRUE; - } - } - } - - if (fMobileTrainingAllowed) - { - // Show percentage completed - swprintf( wString, L"%d%%%%", SectorInfo[ usSectorValue ].ubMobileMilitiaTrainingPercentDone ); - AddSecondColumnMonoString( &hStringHandle, wString ); - } - else - { - // Show N/A - AddSecondColumnMonoString( &hStringHandle, New113HAMMessage[19] ); - } } - // enemy forces swprintf( wString, L"%s:", pwMiscSectorStrings[ 0 ] ); AddMonoString( &hStringHandle, wString ); diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 6096c448..2b3275ca 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -444,25 +444,18 @@ BOOLEAN ValidSelectableCharForNextOrPrev( INT32 iNewCharSlot ); extern void ResumeOldAssignment( SOLDIERTYPE *pSoldier ); - - void InitalizeVehicleAndCharacterList( void ) { // will init the vehicle and character lists to zero memset(&gCharactersList, 0, sizeof( gCharactersList )); - - return; } - void SetEntryInSelectedCharacterList( INT8 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); // set this entry to selected - fSelectedListOfMercsForMapScreen[ bEntry ] = TRUE ; - - return; + fSelectedListOfMercsForMapScreen[ bEntry ] = TRUE; } void ResetEntryForSelectedList( INT8 bEntry ) @@ -471,8 +464,6 @@ void ResetEntryForSelectedList( INT8 bEntry ) // set this entry to selected fSelectedListOfMercsForMapScreen[ bEntry ] = FALSE; - - return; } void ResetSelectedListForMapScreen( void ) @@ -487,11 +478,8 @@ void ResetSelectedListForMapScreen( void ) // then keep him selected SetEntryInSelectedCharacterList( bSelectedInfoChar ); } - - return; } - BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -499,18 +487,14 @@ BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ) // is this entry in the selected list set? return( fSelectedListOfMercsForMapScreen[ bEntry ] ); - } - void ToggleEntryInSelectedList( INT8 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); // toggle the value in the selected list fSelectedListOfMercsForMapScreen[ bEntry ] = !( fSelectedListOfMercsForMapScreen[ bEntry ] ); - - return; } void BuildSelectedListFromAToB( INT8 bA, INT8 bB ) @@ -532,47 +516,33 @@ void BuildSelectedListFromAToB( INT8 bA, INT8 bB ) // run through list and set all intermediaries to true - for( bStart; bStart <= bEnd; bStart++ ) + for( bStart; bStart <= bEnd; ++bStart ) { SetEntryInSelectedCharacterList( bStart ); } - - return; } - BOOLEAN MultipleCharacterListEntriesSelected( void ) { UINT8 ubSelectedCnt = 0; - INT32 iCounter = 0; // check if more than one person is selected in the selected list - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { if( fSelectedListOfMercsForMapScreen[iCounter] == TRUE ) { - ubSelectedCnt++; + ++ubSelectedCnt; } } - if( ubSelectedCnt > 1 ) - { - return( TRUE ); - } - else - { - return( FALSE ); - } + return ( ubSelectedCnt > 1 ); } - - void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( UINT8 ubMilitiaType ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { // valid character? if( gCharactersList[ iCounter ].fValid == FALSE ) @@ -598,26 +568,15 @@ void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( UINT8 ubMiliti } } } - else if (ubMilitiaType == MOBILE_MILITIA) - { - if( pSoldier->bAssignment == TRAIN_MOBILE ) - { - if ( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - ResumeOldAssignment( pSoldier ); - } - } - } } } // HEADROCK HAM 3.6: Added argument for Militia Type void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubMilitiaType ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { // valid character? if( gCharactersList[ iCounter ].fValid == FALSE ) @@ -643,47 +602,16 @@ void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX, } } } - else if (ubMilitiaType == MOBILE_MILITIA ) - { - if( pSoldier->bAssignment == TRAIN_MOBILE ) - { - if( ( pSoldier->sSectorX == sSectorX ) && ( pSoldier->sSectorY == sSectorY ) && ( pSoldier->bSectorZ == 0 ) ) - { - ResumeOldAssignment( pSoldier ); - } - } - } } } - - -/* -void PlotPathForSelectedCharacterList( INT16 sX, INT16 sY ) -{ - INT32 iCounter = 0; - // run through list and build paths for each character - for( iCounter = 0; iCounter < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) - { - if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE )&&( bSelectedDestChar != iCounter ) ) - { - // character is valid.. do this for every one not the bSelectedDestChar - PlotPathForCharacter( &Menptr[ gCharactersList[ iCounter ].usSolID ], sX, sY, FALSE ); - } - } -} -*/ - - // check if the members of the selected list move with this guy... are they in the same mvt group? void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier2 = NULL; - - + // deselect any other selected mercs that can't travel together with pSoldier - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { @@ -696,8 +624,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) { continue; } - - + // NOTE ABOUT THE VEHICLE TESTS BELOW: // Vehicles and foot squads can't plot movement together! // The ETAs are different, and unlike squads, vehicles can't travel everywhere! @@ -766,19 +693,13 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) } } } - - return; } - - void SelectUnselectedMercsWhoMustMoveWithThisGuy( void ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - - - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { @@ -802,15 +723,11 @@ void SelectUnselectedMercsWhoMustMoveWithThisGuy( void ) } } - - BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier2 = NULL; - - - for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) + + for( INT32 iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 8d9fba53..82de7734 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -177,7 +177,6 @@ enum { // training assignment menu defines enum { TRAIN_MENU_SELF, - TRAIN_MENU_MOBILE, TRAIN_MENU_WORKERS, TRAIN_MENU_TEAMMATES, TRAIN_MENU_TRAIN_BY_OTHER, @@ -261,10 +260,10 @@ enum{ STOP_YELLOW_SECTOR_LOCATOR, }; +// Flugente: somewhat pointless since mobile militia has been removed, but perhaps there will be other kinds of militia at some point, so keep this for now // HEADROCK HAM 3.6: Enums for Militia Training Types enum{ TOWN_MILITIA = 0, - MOBILE_MILITIA, NUM_MILITIA_TRAINING_TYPES }; diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 2f020ff3..e1c31e57 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -27,6 +27,9 @@ #include "Tactical Save.h" #include "Campaign.h" #include "message.h" + #include "mapscreen.h" + #include "Strategic Pathing.h" + #include "GameVersion.h" #endif #include "connect.h" @@ -71,18 +74,6 @@ #define DIR_SOUTH 2 #define DIR_WEST 3 -INT32 iRestrictedSectorArraySize; -UINT32 gRestrictMilitia[256]; -// HEADROCK HAM 4: Yet ANOTHER array, this one holds player-set restrictions. -UINT8 gubManualRestrictMilitia[ 256 ]; -// HEADROCK HAM B1: Alternate array keeps track of dynamically unrestricted sectors -BOOLEAN gDynamicRestrictMilitia[ 256 ]; -// HEADROCK HAM B1: Function that dynamically unrestricts sectors as we take over towns. -// HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. -extern void AdjustRoamingRestrictions( BOOLEAN fRecheck ); - -DYNAMICRESTRICTIONS gDynamicRestrictions[5001]; - UINT8 gpAttackDirs[5][4]; // 0. Green Militia 1. Regular Militia 2. Elite Militia 3. Insertion code UINT8 guiDirNumber = 0; BOOLEAN gfMSBattle = FALSE; @@ -93,7 +84,6 @@ extern UINT8 GetTraversability( INT16 sStartSector, INT16 sEndSector ); extern void TriggerPrebattleInterface( UINT8 ubResult ); extern BOOLEAN gfEnterAutoResolveMode; - //Counts the number of live mercs in any given sector. BOOLEAN PlayerMercsInSector_MSE( UINT8 ubSectorX, UINT8 ubSectorY, BOOLEAN fDontConsiderNextSector ) { @@ -148,345 +138,6 @@ UINT8 GetEnemyGroupIdInSector( INT16 sMapX, INT16 sMapY, UINT8 usTeam ) return ubRes; } - -// Creates militia at destination sector. The type and amount of militia depends on current sector's miltia type and amount -// HEADROCK HAM 3.4: Added Leadership argument. -void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, UINT8 ubBestLeadership ) -{ - ////////////////////////////////////////////////////////////////////////////////////// - // HEADROCK HAM 3.3: Introduced considerable changes here on top of HAM 2 code. You can replace - // the entire function with this new code. - // Mostly, the changes are geared towards variable militia QUANTITY due to variable trainer Leadership. - // Also introduced minimum required leadership for training mobile militia, and minimum required - // leadership for training a full squad. - ////////////////////////////////////////////////////////////////////////////////////// - - SECTORINFO *pSourceSector = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); - SECTORINFO *pTargetSector = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); - - //HEADROCK HAM B2.7: Track the number of militia at the source. - UINT16 usTotalMilitiaAtTarget = NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ); - // Desired number of Greens, Regulars and Elites to create. - UINT8 ubTargetGreen, ubTargetRegular, ubTargetElite; - // Calculate default number of militia to place in Target Sector. - UINT8 ubMilitiaToTrain = gGameExternalOptions.guiNumMobileMilitiaTrained; - // Percentage of troops that should be of any one type: - UINT8 ubTargetElitePercent = 0; - UINT8 ubTargetRegularPercent = 0; - UINT8 ubTempLeadership = ubBestLeadership; - - UINT8 trained = 0; - UINT8 promoted = 0; - UINT8 promotionstodo = 0; - - INT16 numcreated[MAX_MILITIA_LEVELS] = {0}; - - // Does trainer have enough leadership to train a squad? - if ( ubBestLeadership < gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia ) - { - // This is punishment, basically. The merc still gets the benefit of improving his leadership through the training - // session, but a lot of money has basically gone to waste. This is something to watch out for, shall we say? - ubMilitiaToTrain = 0; - } - else - { - // HEADROCK HAM 3.6: New function to do Quantity Calculation based on leadership - ubMilitiaToTrain = CalcNumMilitiaTrained(ubBestLeadership, TRUE); - } - - // Flugente: our pool of volunteers limits how many militia can be created - // if we can't train as many militia as we should due to lack of volunteers, the excess training goes into promoting militia - UINT8 promotionsfromvolunteers = ubMilitiaToTrain; - ubMilitiaToTrain = min( ubMilitiaToTrain, GetVolunteerPool( ) ); - promotionsfromvolunteers -= ubMilitiaToTrain; - - // HEADROCK HAM 3.4: Composition of new Mobile Militia groups is now dictated by two INI settings controlling - // the percentage of Elites and Regulars within the group. If the percentage for either is above 0, at least - // one militia of that type will be created every time. Green militia are created based on whatever remains. - - // HEADROCK HAM 3.5: Base percentages off the trainer's Leadership... - if ( gGameExternalOptions.fLeadershipAffectsMobileMilitiaQuality && - (ubBestLeadership >= gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia) ) - { - // Find out how far between the minimum and maximum our character is. - INT8 bRange = gGameExternalOptions.ubReqLeadershipForFullMobileTraining - gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia; - ubBestLeadership = __min(ubBestLeadership, gGameExternalOptions.ubReqLeadershipForFullMobileTraining); - ubBestLeadership -= gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia; - - UINT8 ubBestLeadershipPercentage = 0; - if (bRange > 0) - ubBestLeadershipPercentage = (ubBestLeadership * 100) / bRange; - else - bRange = 0; - - // There are five "grades", which in practice actually give a smooth transition from All-Green to All-Elite. - // Please note that if elite training is disabled, all elites will later be converted to Regulars. In that case, - // a character needs to have at least 60% of the total leadership range to train a full squad of regulars. - if (ubBestLeadershipPercentage >= 0 && ubBestLeadershipPercentage < 20) // First step, Greens - { - ubTargetElitePercent = 0; // No elites - ubTargetRegularPercent = 0; // No regulars - // All green. - } - else if (ubBestLeadershipPercentage >= 20 && ubBestLeadershipPercentage < 40) - { - ubTargetElitePercent = 0; // No elites - ubTargetRegularPercent = __max(1,(((ubBestLeadershipPercentage-19) * 50) / 20)); // Up to 50% regulars - // Green is 100%-ubTargetRegularPercent. So it's between 0/0/100 and 0/50/50 - } - else if (ubBestLeadershipPercentage >= 40 && ubBestLeadershipPercentage < 60) - { - ubTargetElitePercent = __max(1,(((ubBestLeadershipPercentage-39) * 33) / 20)); // Up to 33% elites - ubTargetRegularPercent = __max(1,(100 - ubTargetElitePercent)/2); // Half of what's left is regulars - // And half is green. This gives anywhere between 1/49/49 and 33/33/33. - } - else if (ubBestLeadershipPercentage >= 60 && ubBestLeadershipPercentage < 80) - { - UINT8 ubTargetGreenPercent = __max(1, (((20 - (ubBestLeadershipPercentage-60))*33) / 20)); - ubTargetElitePercent = (100-ubTargetGreenPercent)/2; - ubTargetRegularPercent = ubTargetElitePercent; - // Green percent drops as your leadership goes up, while Elite and Regular are equal. - // This gives anywhere between 33/33/33 and 49/49/1 - } - else if (ubBestLeadershipPercentage >= 80 && ubBestLeadershipPercentage < 100) - { - ubTargetElitePercent = 50 + (((ubBestLeadershipPercentage-80) * 50) / 20); - ubTargetRegularPercent = 100 - ubTargetElitePercent; - // Elites increase from 50% to 100% while regulars drop to 0%. No greens. - } - else // Best possible leadership = Full Elites - { - ubTargetElitePercent = 100; - ubTargetRegularPercent = 0; - // All elites. - } - } - else - // INI-defined percentages - { - ubTargetElitePercent = gGameExternalOptions.ubPercentRoamingMilitiaElites; - ubTargetRegularPercent = gGameExternalOptions.ubPercentRoamingMilitiaRegulars; - } - - ubTargetElite = (ubMilitiaToTrain * ubTargetElitePercent) / 100; - if (ubTargetElitePercent) // If percentage is positive - ubTargetElite = __max(1, ubTargetElite); // Create at least one. - - ubTargetRegular = (ubMilitiaToTrain * ubTargetRegularPercent) / 100; - if (ubTargetRegularPercent) // If percentage is positive - ubTargetRegular = __max(1, ubTargetRegular); // Create at least one. - - // Greens are created based on what's left of the MilitiaToTrain that has not already - // been allocated to Regulars or Elites. - ubTargetGreen = ubMilitiaToTrain - (ubTargetRegular + ubTargetElite); - if (ubTargetRegularPercent+ubTargetElitePercent < 100) // If there's also a remainder, percentage-wise - ubTargetGreen = __max(1, ubTargetGreen); // Create at least one. - - // Is Elite Militia allowed at all? - if (!gGameExternalOptions.gfTrainVeteranMilitia || - GetWorldDay( ) < gGameExternalOptions.guiTrainVeteranMilitiaDelay) - { - // Convert all Elites to Regulars - ubTargetRegular += ubTargetElite; - ubTargetElite = 0; - } - - // Make sure we're not training more militia than we're allowed. This kicks in when the number of militia - // to train is lower than 3, for any reason (particularly, not meeting the minimum required leadership). - while (ubTargetRegular+ubTargetElite+ubTargetGreen > ubMilitiaToTrain) - { - // Reduce target elite count first. - if (ubTargetElite > 0) - { - --ubTargetElite; - continue; - } - - // If no more elites but still over the allowed value, then reduce one regular. - if (ubTargetRegular > 0) - { - --ubTargetRegular; - continue; - } - - // No elites/regulars - reduce target green! - --ubTargetGreen; - } - - // Flugente: resources limit our training - if ( gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory ) - { - FLOAT val_gun, val_armour, val_misc; - GetResources( val_gun, val_armour, val_misc ); - - while ( ubTargetElite > (INT32)val_misc ) - { - --ubTargetElite; - ++ubTargetRegular; - } - - while ( 2 * ubTargetElite + ubTargetRegular > (INT32)val_armour ) - { - if ( ubTargetElite ) - { - --ubTargetElite; - ++ubTargetRegular; - } - else - { - --ubTargetRegular; - ++ubTargetGreen; - } - } - - while ( 3 * ubTargetElite + 2 * ubTargetRegular + ubTargetGreen > (INT32)val_gun ) - { - if ( ubTargetElite ) - { - --ubTargetElite; - ++ubTargetRegular; - } - else if ( ubTargetRegular ) - { - --ubTargetRegular; - ++ubTargetGreen; - } - else - --ubTargetGreen; - } - } - - while ( trained + promotionstodo < ubMilitiaToTrain ) - { - //////////////////////////////// - // Create Heterogenous Group - // - // As of HAM 3.4, homogenous groups are not treated any differently than these. - //////////////////////////////// - - BOOLEAN fFoundOne = FALSE; - - // Do we have room in the target sector? - if ( usTotalMilitiaAtTarget + trained < gGameExternalOptions.iMaxMilitiaPerSector ) - { - if (ubTargetElite > 0) - { - // Add elite. - ++numcreated[ELITE_MILITIA]; - --ubTargetElite; - - ++trained; - fFoundOne = TRUE; - } - else if (ubTargetRegular > 0) - { - // Add regular. - ++numcreated[REGULAR_MILITIA]; - --ubTargetRegular; - - ++trained; - fFoundOne = TRUE; - } - else if (ubTargetGreen > 0) - { - // Add green. - ++numcreated[GREEN_MILITIA]; - --ubTargetGreen; - - ++trained; - fFoundOne = TRUE; - } - } - - // Full militia group? See if you can upgrade some. - if( !fFoundOne ) - { - // we need to promote militia then - ++promotionstodo; - - fFoundOne = TRUE; - } - } - - StrategicAddMilitiaToSector( sTMapX, sTMapY, ELITE_MILITIA, numcreated[ELITE_MILITIA] ); - StrategicAddMilitiaToSector( sTMapX, sTMapY, REGULAR_MILITIA, numcreated[REGULAR_MILITIA] ); - StrategicAddMilitiaToSector( sTMapX, sTMapY, GREEN_MILITIA, numcreated[GREEN_MILITIA] ); - - MoveMilitiaEquipment( sMapX, sMapY, sTMapX, sTMapY, numcreated[ELITE_MILITIA], numcreated[REGULAR_MILITIA], numcreated[GREEN_MILITIA] ); - - // we have to remove the resources for trained militia before we do promotions, in order to remove these resource - if ( gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory ) - { - // use up resources for new militia - AddResources( -numcreated[GREEN_MILITIA] - numcreated[REGULAR_MILITIA] - numcreated[ELITE_MILITIA], -numcreated[REGULAR_MILITIA] - numcreated[ELITE_MILITIA], -numcreated[ELITE_MILITIA] ); - } - - // Flugente: we need to create profiles fro individual militia here, as they might immediately be promoted afterwards in rare cases - // Flugente: create individual militia - for ( int i = 0; i < numcreated[GREEN_MILITIA]; ++i ) - CreateNewIndividualMilitia( GREEN_MILITIA, MO_ARULCO, SECTOR( sTMapX, sTMapY ) ); - - for ( int i = 0; i < numcreated[REGULAR_MILITIA]; ++i ) - CreateNewIndividualMilitia( REGULAR_MILITIA, MO_ARULCO, SECTOR( sTMapX, sTMapY ) ); - - for ( int i = 0; i < numcreated[ELITE_MILITIA]; ++i ) - CreateNewIndividualMilitia( ELITE_MILITIA, MO_ARULCO, SECTOR( sTMapX, sTMapY ) ); - - // handle promotions - UINT8 promotions = 0; - UINT8 promotedto = 0; - UINT8 promotedto_regular = 0; - UINT8 promotedto_elite = 0; - while ( promotions < promotionstodo + promotionsfromvolunteers && TownMilitiaTrainingPromotion( sTMapX, sTMapY, promotedto ) ) - { - ++promotions; - - if ( promotedto == SOLDIER_CLASS_REG_MILITIA ) - ++promotedto_regular; - else - ++promotedto_elite; - } - - // SANDRO - merc records (num militia trained) - if ( trained > 0 ) - { - RecordNumMilitiaTrainedForMercs( sMapX, sMapY, 0, trained, TRUE ); - - // Flugente: substract volunteers - AddVolunteers( -trained ); - } - - if ( gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory ) - { - // promotion resources - AddResources( - promotedto_regular - promotedto_elite, - promotedto_regular - promotedto_elite, - promotedto_elite ); - } - - // This reduces the group back to "maximum" size. It starts by eliminating extra greens, then regulars, then elites. - // That produces a group of max size, with only the best troops remaining. - while ( NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) > gGameExternalOptions.iMaxMilitiaPerSector ) - { - if(pTargetSector->ubNumberOfCivsAtLevel[GREEN_MILITIA]) - { - --pTargetSector->ubNumberOfCivsAtLevel[GREEN_MILITIA]; - } - else if(pTargetSector->ubNumberOfCivsAtLevel[REGULAR_MILITIA]) - { - --pTargetSector->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; - } - else if(pTargetSector->ubNumberOfCivsAtLevel[ELITE_MILITIA]) - { - --pTargetSector->ubNumberOfCivsAtLevel[ELITE_MILITIA]; - } - } - - // Update the militia if the current sector is affected - if (gfStrategicMilitiaChangesMade) - { - ResetMilitia(); - } -} - // Creates militia at destination sector and removes it from starting sector void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOLEAN fAlternativeMax, BOOLEAN fSkipSpreading ) { @@ -582,25 +233,8 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL // Target sector is empty, source group is not full. Do not spread out. ubChanceToSpreadOut = 0; } - - // HEADROCK HAM 4: Groups moving into a NO_LEAVE sector will always reinforce it. - // this ignores any of the possible options above. - if (gubManualRestrictMilitia[ SECTOR(sTMapX, sTMapY) ] == MANUAL_MOBILE_NO_LEAVE ) - { - ubChanceToSpreadOut = 0; - } - - if (!gGameExternalOptions.gfAllowMilitiaSpread ) - { - // Spreading is not allowed by user. Let them fill up the target sector. - ubChanceToSpreadOut = 0; - } - else if ( !gGameExternalOptions.gfAllowMilitiaSpreadWhenFollowing && PlayerMercsInSector_MSE( (UINT8) sTMapX, (UINT8) sTMapY, FALSE ) ) - { - // There is a Player in targetsector or about to arrive, but spreading is not allowed by user. - // Let them fill up the target sector - ubChanceToSpreadOut = 0; - } + + ubChanceToSpreadOut = 0; } } @@ -1068,13 +702,7 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) else iRes = 0; } - - // HEADROCK HAM 4: Increase desire to move into a NO-LEAVE sector (Player-Set restrictions system) - if (gubManualRestrictMilitia[ SECTOR(sDMapX, sDMapY) ] == MANUAL_MOBILE_NO_LEAVE ) - { - iRes = (INT32)((FLOAT)iRes * 1.5); - } - + // Test for player mercs in target sector. if( PlayerMercsInSector_MSE( (UINT8)sDMapX, (UINT8)sDMapY, FALSE )) { @@ -1161,28 +789,7 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s fReadyForBattle = TRUE; } - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // Check player-set restrictions. These are read from XML, and can be (but not always) influenced by - // which cities we've already liberated, and which sectors we've already explored. This is handled - // by a separate function. - if( gGameExternalOptions.gflimitedRoaming && !IsSectorRoamingAllowed( SECTOR(sMapX, sMapY) ) ) - { - // HEADROCK HAM 3.6: Training mobiles will also not take restrictions into account. - if ( (fForBattle && fReadyForBattle) || - fForTraining ) - { - // Allow movement into restricted sectors ONLY if they are for battle! - fRoamingAllowed = TRUE; - } - else - { - fRoamingAllowed = FALSE; - } - } - else - { - fRoamingAllowed = TRUE; - } + fRoamingAllowed = TRUE; ///////////////////////////////////////////////////////////////////////////////////////////////////// // Movement into and out of city/sam sectors is more complicated to check. @@ -1295,55 +902,13 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s return FALSE; } } - // Else, if we are doing a "peaceful" movement. else if ( !fForBattle ) { - // Are we trying to bolster a local garrison? if (fTargetIsSamSite || fTargetIsMajorTown) { - // Flags to store INI option settings. - - BOOLEAN fAllowReinforceCities = (gGameExternalOptions.fAllowMobileReinforceCities && gGameExternalOptions.gfmusttrainroaming && gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand ); - BOOLEAN fAllowReinforceSAM = (gGameExternalOptions.fAllowMobileReinforceSAM && gGameExternalOptions.gfmusttrainroaming && gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand ); - - // Town->Town, Town->SAM, SAM->Town and SAM->SAM are disallowed for peaceful movement. - if ( fSourceIsMajorTown || fSourceIsSamSite ) - { - fCanBecomeGarrison = FALSE; - } - // Wilderness->Sam/Town. - else - { - if ( !NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) && // Is the sector under our control at the moment? - pTargetSector->fSurfaceWasEverPlayerControlled && // Has it ever been under control? - NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ) < gGameExternalOptions.iMaxMilitiaPerSector ) // Is there room here for more militia? - { - if (fTargetIsSamSite && fAllowReinforceSAM) - { - fCanBecomeGarrison = TRUE; - } - else if (fTargetIsMajorTown && fAllowReinforceCities) - { - fCanBecomeGarrison = TRUE; - } - } - else - { - fCanBecomeGarrison = FALSE; - } - } - - // RETURN. - if ( fTraverseAllowed && fRoamingAllowed && fCanBecomeGarrison ) - { - return TRUE; - } - else - { - return FALSE; - } + return FALSE; } // Trying to move peacefully out of a Town/SAM? @@ -1541,10 +1106,7 @@ void MilitiaMovementOrder(UINT8 sector) StrategicMap[ sX + ( sY * MAP_WORLD_X ) ].usFlags &= ~MILITIA_MOVE_ALLDIRS; UINT8 targetsector = SECTOR(targetX, targetY); - - if ( gGameExternalOptions.gflimitedRoaming && !IsSectorRoamingAllowed(targetsector) ) - return; - + // if militia moves from the currently loaded sector, it has to drop all gear first if ( gGameExternalOptions.fMilitiaUseSectorInventory && gWorldSectorX == sX && gWorldSectorY == sY && !gbWorldSectorZ ) { @@ -1558,341 +1120,12 @@ void MilitiaMovementOrder(UINT8 sector) if ( NumNonPlayerTeamMembersInSector( targetX, targetY, ENEMY_TEAM ) ) { - //Moa: handle deserters before moving in hostile territory - MobileMilitiaDeserters( targetX, targetY, TRUE, TRUE ); - gfMSBattle = TRUE; EnterAutoResolveMode( targetX, targetY ); } } -void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) -{ - UINT16 pMoveDir[4][3]; - UINT8 uiDirNumber = 0; - UINT32 iRandomRes = 0, iRandom = 0; - UINT8 x;//,y; - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); - UINT8 uiMilitiaCount; - BOOLEAN fSourceCityAllowsRoaming; - - // HEADROCK HAM 4: Player can set a sector to NO_LEAVE, forcing Mobiles to stay put if they enter the sector at all. - if (gubManualRestrictMilitia[ SECTOR( sMapX, sMapY ) ] == MANUAL_MOBILE_NO_LEAVE ) - { - // NO_LEAVE zone. Militia can't even consider moving. - return; - } - - // If we don't want roaming militia - // We shouldn't be here. - if ( !gGameExternalOptions.gfAllowMilitiaGroups || gGameExternalOptions.fMilitiaStrategicCommand ) - return; - - if( sMapX == 1 && sMapY == 1 ) - { - ClearBlockMoveList(); - gfMSBattle = FALSE; - } - - if( CheckInBlockMoveList( sMapX, sMapY ) ) - return; - - uiMilitiaCount = NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM ); - - if( !uiMilitiaCount ) - return; - - // Kaiden: Moved Create Militia code into CreateMilitiaSquads - // Removed the code from here and added the procedure call - // If it's time, and this is a city sector create a new group. - // But only if we're not training our own. - - if( (!gGameExternalOptions.gfmusttrainroaming) && ( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR ) ) - { - // Flugente: only enter this if the time is correct (but do not return if it isn't, we still might do the movement part) - if (GetWorldDay( ) < gGameExternalOptions.guiAllowMilitiaGroupsDelay && GetWorldHour() % gGameExternalOptions.guiCreateEachNHours ) - { - CreateMilitiaSquads( sMapX, sMapY ); - if (gfStrategicMilitiaChangesMade) - { - ResetMilitia(); - } - } - } - - // Flugente: if we can order militia directly, don't have them wander around at random - if ( MercStaffsMilitaryHQ() ) - return; - - // HEADROCK HAM B2.7: If INI flag is set, allow militia to move out of Minor City sectors (Orta, Tixa, San Mona, etc). - if (gGameExternalOptions.fAllowMilitiaMoveThroughMinorCities) - fSourceCityAllowsRoaming = ( !gfMilitiaAllowedInTown[GetTownIdForSector( sMapX, sMapY )] ); - else - fSourceCityAllowsRoaming = ( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ); - - // moving squad, if it is not a SAM site - if( ( fSourceCityAllowsRoaming ) && (!IsThisSectorASAMSector( sMapX, sMapY, 0 )) ) - { - if( !gGameExternalOptions.gfAllowMilitiaFollowPlayer || !PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, FALSE ) ) // and there's no player's mercs in the sector, or they are not forced to follow - { - if( GetWorldHour() % 2 ) - return; - - memset(pMoveDir, 0, sizeof(pMoveDir)); - GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, FALSE ); - - if( uiDirNumber ) - { - for( x = 1; x < uiDirNumber ; ++x ) - pMoveDir[x][1] += pMoveDir[x-1][1]; - // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld", x, pMoveDir[x][1]); - - // HEADROCK HAM 3.6: Too many INI settings. Removed a couple, including MIN/MAX SQUAD SIZE. -// iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] + -// ( uiMilitiaCount >= gGameExternalOptions.guiMinMilitiaSquadSize ? CHANCE_TO_MOVE_A_SQUAD : CHANCE_TO_MOVE_AN_UNFULL_SQUAD ) ); - iRandom = Random( pMoveDir[ uiDirNumber - 1 ][1] ); - - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Roll %ld", iRandomRes); - - // Flugente: as I once broke this, allow me to explain this part. We've determined the 'urge' to move to an adjacent sector. - // We now see wether an adjacent sector is a worthy target to move to. If we do not find a vali target, we stop the movement function - - iRandomRes = 256; - - for( x = 0; x < uiDirNumber; ++x) - { - if( iRandom < pMoveDir[x][1] ) - { - iRandomRes = x; - break; - } - } - - // "Decided" to stay here - if(iRandomRes >= uiDirNumber) - return; - - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%ld,%ld:Dir count %ld, Rand %ld. Go to %ld,%ld. Have %ld militia men", sMapX, sMapY, uiDirNumber, iRandomRes, SECTORX( pMoveDir[ iRandomRes ][0] ), SECTORY( pMoveDir[ iRandomRes ][0] ), uiMilitiaCount); - //Kaiden: if Restricted Sectors List option is turned on, - // militia can't move to any sectors in the list. - // Unless they are following a group of mercs. - /////////////////////////////////////////////////////////////////// - // HEADROCK HAM B1: Restrict roamers by XML as normal, but also - // allow them to move through visited sectors. - // Also, there's an option now to use dynamic restriction. The - // AdjustRoamingRestrictions() function is used to dynamically - // define which sectors are restricted, based on city conquest. - /////////////////////////////////////////////////////////////////// - - // HEADROCK HAM 3.4: Moved the check to a separate function. - if (gGameExternalOptions.gflimitedRoaming) - { - if (!IsSectorRoamingAllowed(pMoveDir[iRandomRes][0])) - return; - } - - // WDS bug fix for moving militia - INT16 targetX = SECTORX( pMoveDir[ iRandomRes ][0] ); - INT16 targetY = SECTORY( pMoveDir[ iRandomRes ][0] ); - Assert(targetX >= 0 && targetX < MAP_WORLD_X); - Assert(targetY >= 0 && targetY < MAP_WORLD_Y); - MoveMilitiaSquad( sMapX, sMapY, targetX, targetY, FALSE, FALSE ); - - if ( gfStrategicMilitiaChangesMade) - { - ResetMilitia(); - } - - if ( NumNonPlayerTeamMembersInSector( targetX, targetY, ENEMY_TEAM ) ) - { - extern GROUP *gpBattleGroup; - gpBattleGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY, ENEMY_TEAM ) ); - /* GROUP* pEnemyGroup = GetGroup( GetEnemyGroupIdInSector( targetX, targetY ) ); - - if(pEnemyGroup && pEnemyGroup->ubGroupID) - { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Attacking from %ld,%ld to %ld,%ld - enemy's group id %ld", sMapX, sMapY, targetX, SECTORY( pMoveDir[ iRandomRes ][0], pEnemyGroup->ubGroupID )); - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arrival 1, Arrival 2"); - - pEnemyGroup->ubPrevX = sMapX; - pEnemyGroup->ubPrevY = sMapY; - - pEnemyGroup->ubNextX = targetX; - pEnemyGroup->ubNextY = targetY; - */ - //Moa: handle deserters before moving in hostile territory - MobileMilitiaDeserters( targetX, targetY, TRUE, TRUE ); - - gfMSBattle = TRUE; - - // GroupArrivedAtSector( pEnemyGroup->ubGroupID , TRUE, FALSE ); - EnterAutoResolveMode( targetX, targetY ); - // } - } - } - } - } -} - -// Kaiden: Roaming Militia Training: -// If we're training roaming militia, -// we'll get our squad from here: -// Don't need to check for delay, as this function won't be -// called if there is a delay set. -void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ) -{ - // Variables for Direction Rating checks - UINT16 pMoveDir[4][3]; - UINT8 uiDirNumber = 0; - UINT32 iRandomRes = 0; - UINT8 x;//,y; - // Variables for checking other sectors in the same city - UINT16 iCounter; - UINT16 bTownId; - // Tracks X/Y coordinates of another possible sector to train from (within same city) - INT16 sCurrentX, sCurrentY; - - // Smart Militia Generator now locates the best sector for placement. - UINT16 usBestLocalSectorID = 0; - UINT16 usBestPerimeterSectorID = 0; - UINT16 usBestLocalSectorRating = 0; - UINT16 usBestPerimeterSectorRating = 0; - // Selected Target coordinates - UINT8 sTMapX = 0; - UINT8 sTMapY = 0; - - // Leadership may affect quantity of militia generated. - UINT8 ubBestLeadership = FindBestMilitiaTrainingLeadershipInSector ( sMapX, sMapY, 0, MOBILE_MILITIA ); - - // If we're not allowing roaming groups, then we're not creating them either. - if ( !gGameExternalOptions.gfAllowMilitiaGroups || gGameExternalOptions.fMilitiaStrategicCommand ) - return; - - // Reset block move list. Does this cause issues with training in A1? Probably not. - if( sMapX == 1 && sMapY == 1 ) - { - ClearBlockMoveList(); - gfMSBattle = FALSE; - } - - if( CheckInBlockMoveList( sMapX, sMapY ) )return; - - // Check all sectors adjacent to the training sector itself. - GenerateDirectionInfosForTraining( sMapX, sMapY, &uiDirNumber, pMoveDir ); - - if(uiDirNumber)// At least one available sector found, adjacent to Source Training Sector - { - for ( x = 0; x < uiDirNumber; x++) - { - // Best rating so far? - if (pMoveDir[x][1] > usBestLocalSectorRating) - { - // Mark this as the best "local" destination. - usBestLocalSectorID = pMoveDir[x][0]; - usBestLocalSectorRating = pMoveDir[x][1]; - } - } - } - - // If we're training inside a city, check other city sectors for nearby available space. Maybe you'll find - // a better place to put new mobiles? - bTownId = GetTownIdForSector( sMapX, sMapY ); - if( bTownId != BLANK_SECTOR ) - { - // We're training in a city. - iCounter = 0; - - // Go through each city in the game - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. Generate no militia from this sector. - ++iCounter; - continue; - } - - // Find out if any adjacent sectors have room in them. - GenerateDirectionInfosForTraining( sCurrentX, sCurrentY, &uiDirNumber, pMoveDir ); - - if(uiDirNumber)// At least one available adjacent sector has been found - { - // Go through each adjacent sector - for( x = 0; x < uiDirNumber ; x++ ) - { - // Have we found the best rating so far? - if ( pMoveDir[x][1] > usBestPerimeterSectorRating ) - { - usBestPerimeterSectorID = pMoveDir[x][0]; - usBestPerimeterSectorRating = pMoveDir[x][1]; - } - } - } - } - ++iCounter; - } - } - - // Randomly choose whether to place locally or somewhere else around the city perimeter. - // Local and Perimeter have separate "weights" in this randomization, but you're much more - // likely to place militia near the original source sector. That is because it has increased - // chance of being selected both as the best local and as the best overall, and so might be - // selected as the result of either random choice. - - // Make sure at least one sector was found with more than 0 rating - if (usBestLocalSectorRating > 0 || usBestPerimeterSectorRating > 0) - { - // Found at least one location. - iRandomRes = PreRandom( usBestLocalSectorRating + usBestPerimeterSectorRating ); - // Either go with randomization, or automatically select a Local sector if there is no better Perimeter sector. - if (iRandomRes < usBestLocalSectorRating || - usBestLocalSectorRating >= usBestPerimeterSectorRating) - { - sTMapX = SECTORX( usBestLocalSectorID ); - sTMapY = SECTORY( usBestLocalSectorID ); - - // Generate militia in the best sector immediately adjacent to the Source Training Sector. - GenerateMilitiaSquad( sMapX, sMapY, sTMapX, sTMapY, ubBestLeadership ); - AddToBlockMoveList( sTMapX, sTMapY ); - - // Check for enemies in target sector - if ( NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, ENEMY_TEAM ) ) - { - // Initiave battle - gfMSBattle = TRUE; - EnterAutoResolveMode( sTMapX, sTMapY ); - } - } - else - { - sTMapX = SECTORX( usBestPerimeterSectorID ); - sTMapY = SECTORY( usBestPerimeterSectorID ); - - // Generate militia in the best sector found in this city's perimeter. - GenerateMilitiaSquad( sCurrentX, sCurrentY, sTMapX, sTMapY, ubBestLeadership ); - AddToBlockMoveList( sTMapX, sTMapY ); - - // Check for enemies in target sector - if ( NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, ENEMY_TEAM ) ) - { - // Initiave battle - gfMSBattle = TRUE; - EnterAutoResolveMode( sTMapX, sTMapY ); - } - } - } -} - - extern BOOLEAN gfMSResetMilitia; void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) @@ -2162,16 +1395,16 @@ BOOLEAN IsThereMilitiaInAdjacentSector( INT16 sMapX, INT16 sMapY ) { UINT16 pMoveDir[4][3]; UINT8 uiDirNumber = 0; - UINT8 x; - BOOLEAN fResult = FALSE; GenerateDirectionInfos( sMapX, sMapY, &uiDirNumber, pMoveDir, FALSE, TRUE ); - for( x = 0; x < uiDirNumber ; ++x ) - if ( NumNonPlayerTeamMembersInSector( SECTORX( pMoveDir[x][0] ), SECTORY( pMoveDir[x][0] ), MILITIA_TEAM ) ) - fResult = TRUE; + for ( UINT8 x = 0; x < uiDirNumber; ++x ) + { + if ( NumNonPlayerTeamMembersInSector( SECTORX( pMoveDir[x][0] ), SECTORY( pMoveDir[x][0] ), MILITIA_TEAM ) ) + return TRUE; + } - return fResult; + return FALSE; } void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) @@ -2203,78 +1436,6 @@ void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) } } -void MilitiaFollowPlayer( INT16 sMapX, INT16 sMapY, INT16 sDMapX, INT16 sDMapY ) -{ - if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || - IsThisSectorASAMSector( sMapX, sMapY, 0 ) || - PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return; - - if( GetTownIdForSector( sDMapX, sDMapY ) != BLANK_SECTOR || - IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return; - - - MoveMilitiaSquad( sMapX, sMapY, sDMapX, sDMapY, FALSE, FALSE ); -} - - -// HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. -//Moa: changed the flag behavier - makes no sense to overwrite user settings, instead I reusing it to correct wrong values in old savegames. -// This function runs during sector conquest checks, and only if an entire town has been conquered. It also -// runs at day end, as well as on load/save. -void AdjustRoamingRestrictions( BOOLEAN fRecheck ) -{ - UINT32 uiCapturedTownsFlag = 0; - UINT16 cnt = 0; - - if (!gGameExternalOptions.fDynamicRestrictRoaming) - return; - - // to do: Add something to clean up the entire array before setting the flags... - - for (cnt=1; cnt < NUM_TOWNS; cnt++) - { - if ( IsTownUnderCompleteControlByPlayer((UINT8)cnt) ) - { - // Flag town as captured. - uiCapturedTownsFlag |= (1 << (cnt-1)); - } - } - - for (cnt=0; cnt < 256; cnt++) - { - gDynamicRestrictMilitia[cnt] = false; - } - - for (cnt=0; (cnt < 5001 && gDynamicRestrictions[cnt].sSectorID >= 0); cnt++) - { - if (!(~uiCapturedTownsFlag & gDynamicRestrictions[cnt].uiReqTownFlags)) - { - gDynamicRestrictMilitia[gDynamicRestrictions[cnt].sSectorID] = true; - // HEADROCK HAM 4: Also adjust Player-based restrictions. - if (gubManualRestrictMilitia[ gDynamicRestrictions[cnt].sSectorID ] == MANUAL_MOBILE_RESTRICTED) - { - gubManualRestrictMilitia[ gDynamicRestrictions[cnt].sSectorID ] = MANUAL_MOBILE_NO_RESTRICTION; - } - } - } - - // HEADROCK HAM 5: All restricted sectors are checked to see they aren't manually-permitted. - //Moa: Dont ever touch user settings, player set the restrictions for a reason. Initialization allready in InitManualMobileRestrictions. - //dnl!!! However if we are loading an older save we might need to check the array for MANUAL_MOBILE_RESTRICTED and replace it with MANUAL_MOBILE_NO_ENTER - //actually this can be removed once there are no older savegames around :) - if (fRecheck) - { - for (cnt = 0; cnt < 256; cnt++) - { - if (gubManualRestrictMilitia[cnt] == MANUAL_MOBILE_RESTRICTED) - { - gubManualRestrictMilitia[cnt] = MANUAL_MOBILE_NO_ENTER; - } - } - } -} - - // HEADROCK HAM B2.7: This is a copy of an existing function that generates possible movement directions for militia. // Due to the widespread use of that function, I've decided to make a new one that calculates directions // when generating militia. This function checks for available space at the target location. The stored results @@ -2290,7 +1451,7 @@ void GenerateDirectionInfosForTraining( INT16 sMapX, INT16 sMapY, UINT8* uiDirNu UINT16 usUpgradeCapacity = 0; // Clean up pMoveDir - for (UINT8 x = 0; x < 4; x++) + for (UINT8 x = 0; x < 4; ++x) { pMoveDir[x][0]=0; pMoveDir[x][1]=0; @@ -2414,58 +1575,6 @@ void GenerateDirectionInfosForTraining( INT16 sMapX, INT16 sMapY, UINT8* uiDirNu } } -// HEADROCK HAM 3.4: Something that should've been done a long time ago - moving the check of roaming restrictions -// to a separate function. Returns TRUE if the sector can be traversed by militia. -BOOLEAN IsSectorRoamingAllowed( UINT32 uiSector ) -{ - - // EXPLORATION-BASED RESTRICTION - // Is militia allowed to move through visited sectors? - if (gGameExternalOptions.fUnrestrictVisited) - { - // Has the sector ever been visited? - if ( SectorInfo[ uiSector ].fSurfaceWasEverPlayerControlled ) - { - // HEADROCK HAM 4: Take player-based restrictions into account... - if ( gubManualRestrictMilitia[ uiSector ] == MANUAL_MOBILE_NO_RESTRICTION || - gubManualRestrictMilitia[ uiSector ] == MANUAL_MOBILE_NO_LEAVE ) - { - // Always return TRUE. - return TRUE; - } - } - } - // Please note that with dynamic restrictions, an UNVISITED sector is not neccesarily RESTRICTED. - - // XML-BASED RESTRICTION - // Is destination allowed by the Dynamic Restrictions Array? - if( !gDynamicRestrictMilitia[ uiSector ] ) - { - // Don't restrict movement if there are player mercs in the target sector! Otherwise, the player - // cannot have militia follow him to attack the enemy. - if (!PlayerMercsInSector_MSE( SECTORX(uiSector), SECTORY(uiSector), FALSE )) - { - return FALSE; - } - } - else - { - // HEADROCK HAM 4: Take player restrictions into account - if ( gubManualRestrictMilitia[ uiSector ] == MANUAL_MOBILE_NO_ENTER ) - { - if ( !NumNonPlayerTeamMembersInSector( SECTORX( uiSector ), SECTORY( uiSector ), ENEMY_TEAM ) ) - { - // The player has disallowed movement into this sector, manually. As the condition above - // dictates, this only takes effect if there are no enemies in the target sector. Otherwise, - // militia can move to intercept them anyway. - return FALSE; - } - } - } - - return TRUE; -} - // HEADROCK HAM 3.6: Function returns the number of "upgrade slots" available at target sector. Basically, every GREEN // Militia at the target sector counts as 2 upgrade slots, while every regular counts as 1. @@ -2505,439 +1614,6 @@ UINT16 MilitiaUpgradeSlotsCheck( INT16 sMapX, INT16 sMapY ) return (usNumUpgradeSlots); } -extern BOOLEAN SectorIsImpassable( INT16 sSector ); -// HEADROCK HAM 4: Returns whether sector is allowed for militia roaming, taking into account player-set restrictions. -UINT8 ManualMobileMovementAllowed( UINT8 ubSector ) -{ - BOOLEAN fcheckManualSettings = FALSE; - - //if no one can pass get out of here quick! - if ( SectorIsImpassable( ubSector ) ) - return MANUAL_MOBILE_RESTRICTED; - - if (gGameExternalOptions.gflimitedRoaming)//RESTRICT_ROAMING = TRUE - { - if ( SectorInfo[ ubSector ].fSurfaceWasEverPlayerControlled )// Has the sector ever been liberated? - { - if (gGameExternalOptions.fUnrestrictVisited)//ALLOW_MILITIA_MOVEMENT_THROUGH_EXPLORED_SECTORS = TRUE - { - // Always check for manual restrictions. - fcheckManualSettings = TRUE; - } - else if (gGameExternalOptions.fAllowMilitiaMoveThroughMinorCities)//ALLOW_MILITIA_MOVEMENT_THROUGH_MINOR_CITIES = TRUE - { - UINT8 townID = GetTownIdForSector( SECTORX(ubSector), SECTORY(ubSector) ); - //this is a city and its a minor one where training is not allowed like San Mona, Tixa, Orta, Estoni, or Omerta? - if (townID != BLANK_SECTOR && !gfMilitiaAllowedInTown[townID]) - fcheckManualSettings = TRUE; - } - } - if(gGameExternalOptions.fDynamicRestrictRoaming)//ALLOW_DYNAMIC_RESTRICTED_ROAMING = TRUE - { - fcheckManualSettings |= gDynamicRestrictMilitia[ ubSector ]; - } - } - else//RESTRICT_ROAMING = FALSE - { - // No restrictions, militia is free to go (green) - return MANUAL_MOBILE_NO_RESTRICTION; - } - - if (fcheckManualSettings) - { - // player has restricted manually (green,yellow,red) -#ifdef JA2BETAVERSION - AssertGE(gubManualRestrictMilitia[ ubSector ],0); - AssertLE(gubManualRestrictMilitia[ ubSector ],3); -#endif - return gubManualRestrictMilitia[ ubSector ]; - } - else - { - // Restricted roaming! Militia can't go here ever. (gray) - return MANUAL_MOBILE_RESTRICTED; - } -} - -void InitManualMobileRestrictions() -{ - UINT16 x; - for ( x = 0; x < 256; x++ ) - { - UINT8 ubTownID = GetTownIdForSector( SECTORX(x), SECTORY(x) ); - if (ubTownID != BLANK_SECTOR ) - { - if (gfMilitiaAllowedInTown[ubTownID]) - { - // Major town. Set to NO-ENTER by default. - gubManualRestrictMilitia[x] = MANUAL_MOBILE_NO_ENTER; - continue; - } - else - { - // Minor town. Set to NO_RESTRICTIONS by default. - gubManualRestrictMilitia[x] = MANUAL_MOBILE_NO_RESTRICTION; - continue; - } - } - // By default, all other sectors are "go". - gubManualRestrictMilitia[x] = MANUAL_MOBILE_NO_RESTRICTION; - } -} - - -extern BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive ); - -// @brief Calculates the contingent for mobile militia. -// Calculates current active mobile militia and compares to variable maximum limit which can be altered by external data. -// @param printMessage Set to TRUE to get a screenmessage telling the player which maximum is reached. No message is generated when the maximum is not yet reached (<=100). -// @return The current percentage (0% - 255%). If the feature is deactivated allways 0 is returned. -UINT8 GetMobileMilitiaQuota( BOOLEAN printMessage ) -{ - /////////////////////// - // Check for maximum mobiles allowed - // - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode > 1 ) - { - //what we need to know - UINT16 iActiveMobiles = 0, iCurrentMax = 0; - UINT16 iTownSectorsUnderPlayerControl = 0, iTownSectorsLiberatedAtLeastOnce = 0; - UINT8 iTownsUnderPlayerControl = 0, iCurrentProgress = 0, iMaxProgress = 0, iNumRebelsInPlayerTeam = 0; - - //temp values for sectors we gonna check - INT8 iCurrT_ID; - UINT16 iStrategicMapID, iSectorInfoID; - SECTORINFO *pSectorInfo; - - // start gathering data - if (gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 8U) // check for TownsLiberated is active - for ( iCurrT_ID = 0; iCurrT_ID < NUM_TOWNS; iCurrT_ID++) // for each town - { - if ( GetTownSectorsUnderControl( iCurrT_ID ) == GetTownSectorSize( iCurrT_ID ) ) - iTownsUnderPlayerControl++; // remember player has that town under control - } - - for ( iSectorInfoID = 0; iSectorInfoID < 255; iSectorInfoID++) // for each sector ... - { - iStrategicMapID = SECTOR_INFO_TO_STRATEGIC_INDEX(iSectorInfoID); - pSectorInfo = &( SectorInfo[ iSectorInfoID ] ); - iCurrT_ID = StrategicMap[ iStrategicMapID ].bNameId; - - if ( iCurrT_ID != BLANK_SECTOR ) - { - // we have found a town (no sam site) - - if ( !StrategicMap[ iStrategicMapID ].fEnemyControlled ) - ++iTownSectorsUnderPlayerControl; // remember player currently controls that town sector - - if ( pSectorInfo->fSurfaceWasEverPlayerControlled ) - ++iTownSectorsLiberatedAtLeastOnce; // remember player had allready liberated that town sector once - - if ( MilitiaTrainingAllowedInTown( iCurrT_ID ) == FALSE ) // considered as mobile only if in that town training is taboo (Tixa, Omerta..) - iActiveMobiles += NumNonPlayerTeamMembersInSector( SECTORX( iSectorInfoID ), SECTORY( iSectorInfoID ), MILITIA_TEAM ); - } - //else if ( StrategicMap[ iStrategicMapID ].bSAMCondition > 0 ) //faster then below, but not safe - else if ( MilitiaTrainingAllowedInSector( SECTORX(iSectorInfoID), SECTORY(iSectorInfoID), 0 ) == FALSE ) - { - // we are in wilderness - iActiveMobiles += NumNonPlayerTeamMembersInSector( SECTORX( iSectorInfoID ), SECTORY( iSectorInfoID ), MILITIA_TEAM ); - } - } - - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 64U ) // check for rebels in player team is active - { - if ( gProfilesRPC != NULL ) - { - UINT16 rebelStructSize = sizeof ( gProfilesRPC ); - for (UINT16 rebelPC = 0; rebelPC < rebelStructSize; rebelPC++) - { - if ( IsMercOnTeam ( gProfilesRPC[ rebelPC ].ProfilId, FALSE, FALSE ) ) iNumRebelsInPlayerTeam++; - } - } - //if ( IsMercOnTeam ( IRA ) ) iNumRebelsInPlayerTeam++; - //if ( IsMercOnTeam ( DIMITRI ) ) iNumRebelsInPlayerTeam++; - //if ( IsMercOnTeam ( CARLOS ) ) iNumRebelsInPlayerTeam++; - //if ( IsMercOnTeam ( MIGUEL ) ) iNumRebelsInPlayerTeam++; - //if ( IsMercOnTeam ( DYNAMO ) ) iNumRebelsInPlayerTeam++; - //if ( IsMercOnTeam ( ENRICO ) ) iNumRebelsInPlayerTeam++; - } - - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 16U ) // check for current progress is active - iCurrentProgress = CurrentPlayerProgressPercentage(); - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 32U ) // check for max progress is active - iMaxProgress = HighestPlayerProgressPercentage(); - //end gathering data - ///////////////////// - // calc maximum (note: the modifier was initilized allready with MOBILE_MILITIA_MAX_ACTIVE_MODIFIER * MAX_MILITIA_PER_SECTOR) - UINT8 iModeMatch = 0; //takes the mode which matches the maximum used in order to build a message later on (0=no match 1..6) - UINT16 iCalc; - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 128U ) // we are using the highest value - { - iCurrentMax = 0; - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 2U ) // check for town sectors under player control is active - { - iCalc = (UINT16) ( iTownSectorsUnderPlayerControl * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 1; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 4U ) // check for town sectors liberated at least once is active - { - iCalc = (UINT16) (iTownSectorsLiberatedAtLeastOnce * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 2; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 8U ) - { - iCalc = (UINT16) (iTownsUnderPlayerControl * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 3 ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 3; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 16U ) - { - iCalc = (UINT16) (iCurrentProgress * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 20 / 100 ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 4; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 32U ) - { - iCalc = (UINT16) (iMaxProgress * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 20 / 100 ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 5; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 64U ) - { - iCalc = (UINT16) (iNumRebelsInPlayerTeam * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 3 ); - if ( iCurrentMax <= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 6; - } - } - } - else // we are using lowest value - { - iCurrentMax = (UINT16) -1; - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 2U ) - { - iCalc = (UINT16) ( iTownSectorsUnderPlayerControl * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 1; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 4U ) - { - iCalc = (UINT16) (iTownSectorsLiberatedAtLeastOnce * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 2; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 8U ) - { - iCalc = (UINT16) (iTownsUnderPlayerControl * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 3 ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 3; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 16U ) - { - iCalc = (UINT16) (iCurrentProgress * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 20 / 100 ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 4; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 32U ) - { - iCalc = (UINT16) (iMaxProgress * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 20 / 100 ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 5; - } - } - if ( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 64U ) - { - iCalc = (UINT16) (iNumRebelsInPlayerTeam * gGameExternalOptions.gfpMobileMilitiaMaxActiveModifier * 3 ); - if ( iCurrentMax >= iCalc ) - { - iCurrentMax = iCalc; - iModeMatch = 6; - } - } - } - ///////////////////// - //Notify player - if ( iActiveMobiles >= iCurrentMax ) - { - if ( printMessage && iModeMatch > 0 )//fail safe to avoid in-buffer == out-buffer - { - // providing feedback why player cant train more. - CHAR16 sString[200]; - swprintf( sString, pMilitiaConfirmStrings[15], iActiveMobiles, iCurrentMax, pMilitiaConfirmStrings[15 + iModeMatch] );//We reached maximum (..active../..max..)..make this..to do sth - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, sString ); - DoScreenIndependantMessageBox(sString, MSG_BOX_FLAG_OK, NULL); - } - } - return ( iCurrentMax == 0 ? 255 : (iActiveMobiles * 100 / iCurrentMax) ); - //return ( iCurrentMax == 0 ? 255 : max( 255, (iActiveMobiles * 100 / iCurrentMax) ) ); - - }//end check for maximum mobile militia allowed - - return 0; -} - - -//@brief Checks for militia quota and removes randomly some of militia if there are too many. -// Deserting works only if the feature is enabled and the sector is threatened by an adjacent enemy presence. -// The chance to generate deserters raises with the quota. -//@param sMapX, sMapY Strategic sector coordinate which will be checked. -//@param fDeleteEquipment If the militia has any equipment it will be deleted when he is a deserter. -//@param fPrintMessage Notifies player that some militia have deserted. -//@auth Moa -void MobileMilitiaDeserters(INT16 sMapX, INT16 sMapY, BOOLEAN fDeleteEquip, BOOLEAN fPrintMessage) -{ - // if more then allowed mobiles are active some of them will desert (green and only some regulars, elites will never desert) - UINT8 desertersGreen = 0, desertersRegular = 0; - BOOLEAN enemiesNear = FALSE; - - // feature not activated, return - if (!( gGameExternalOptions.gbMobileMilitiaMaxActiveMode & 1U ) ) - return; - - // Training allowed here therefore not a sector for mobile militia, return - if ( gfMilitiaAllowedInTown [ GetTownIdForSector( sMapX, sMapY ) ] ) - return; - - // This is a SAM site therefore no mobile militia here, return - if (IsThisSectorASAMSector( sMapX, sMapY, 0 )) - return; - - /////////////////////// - // check enemy presence to decide if mobiles are threatened and some will desert. - // Note: cant use NumEnemiesInFiveSectors() as it does not work for omerta or when reinforcements are deactivated, also it uses generateDirectionInfo(), which is used for militia movement. - - //enemies in current sector - if ( NumNonPlayerTeamMembersInSector( sMapX, sMapY, ENEMY_TEAM ) ) - enemiesNear = TRUE; - - if ( ( sMapX > MINIMUM_VALID_X_COORDINATE ) && !enemiesNear ) - { - //left side - if ( NumNonPlayerTeamMembersInSector( sMapX - 1, sMapY, ENEMY_TEAM ) ) - enemiesNear = TRUE; - } - if ( ( sMapX < MAXIMUM_VALID_X_COORDINATE ) && !enemiesNear) - { - //right side - if ( NumNonPlayerTeamMembersInSector( sMapX + 1, sMapY, ENEMY_TEAM ) ) - enemiesNear = TRUE; - } - if ( ( sMapY > MINIMUM_VALID_Y_COORDINATE ) && !enemiesNear ) - { - //top side - if ( NumNonPlayerTeamMembersInSector( sMapX, sMapY - 1, ENEMY_TEAM ) ) - enemiesNear = TRUE; - } - if ( ( sMapY < MAXIMUM_VALID_Y_COORDINATE ) && !enemiesNear) - { - //bottom side - if ( NumNonPlayerTeamMembersInSector( sMapX, sMapY + 1, ENEMY_TEAM ) ) - enemiesNear = TRUE; - } - - ///////////////////////// - //calc number of deserters - if ( enemiesNear ) //if deserting feature is active, this is a sector where mobile militia is allowed and there is a threat at target - { - UINT8 quota = GetMobileMilitiaQuota( FALSE ); - - if (quota > 100) //more active then allowed - { - UINT8 militiaGreen = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); - UINT8 militiaRegular = MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ); - - desertersGreen = (quota - 100) * militiaGreen / 100; - desertersGreen = Random( min( militiaGreen, desertersGreen ) );//cant remove more then actually exist in that group - - desertersRegular = (quota - 100) * militiaRegular / 200; - desertersRegular = Random( min ( militiaRegular, desertersRegular ) ); - } - } - - //////////////////////// - //remove militia - if ( desertersRegular + desertersGreen > 0 ) - { - StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, desertersGreen ); - StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, desertersRegular ); - - /////////////////////////// - //remove equipment - if ( fDeleteEquip && gGameExternalOptions.fMilitiaUseSectorInventory) - { - SOLDIERCREATE_STRUCT trashIt; - UINT8 cnt = desertersGreen; - while ( cnt > 0 ) - { - TakeMilitiaEquipmentfromSector( sMapX, sMapY, 0, &trashIt, SOLDIER_CLASS_GREEN_MILITIA); - cnt--; - } - cnt = desertersRegular; - while ( cnt > 0 ) - { - TakeMilitiaEquipmentfromSector( sMapX, sMapY, 0, &trashIt, SOLDIER_CLASS_REG_MILITIA); - cnt--; - } - } - - // Flugente: disease - PopulationMove( sMapX, sMapY, -1, -1, desertersGreen + desertersRegular ); - - /////////////////////////// - //notify player - if ( fPrintMessage ) - { - CHAR16 sSector[16]; - GetShortSectorString( sMapX, sMapY, sSector ); - - //using screen message to have it logged. Cant use msgBox as it prevents showing the autoresolve screen. - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMilitiaConfirmStrings[ 22 ], ( desertersRegular + desertersGreen ), sSector ); - } - } - //clean up - if (gfStrategicMilitiaChangesMade) - { - ResetMilitia(); - } -} - - -#include "mapscreen.h" -#include "Strategic Pathing.h" -#include "GameVersion.h" - // Flugente: militia movement BOOLEAN SaveMilitiaMovementInformationToSaveGameFile( HWFILE hFile ) { diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index 67a81716..08d8e0dd 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -12,29 +12,17 @@ extern UINT8 gpAttackDirs[5][4]; extern UINT8 guiDirNumber; -// Updates movement orders for militia squads -void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ); - // Flugente: militia in this sector is ordered to move according to flags that were applied to it prior void MilitiaMovementOrder(UINT8 sector); // Kaiden: creates militia squad in an adjacent sector // to the coordinates you pass to it. -void CreateMilitiaSquads(INT16 sMapX, INT16 sMapY ); void MilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ); // HEADROCK HAM 3.4: Now using different arguments for this function. All relevent instances have also been altered. void GenerateDirectionInfos( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3], BOOLEAN fForTraining, BOOLEAN fForBattle ); BOOLEAN MoveOneBestMilitiaMan(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY); -void MilitiaFollowPlayer( INT16 sMapX, INT16 sMapY, INT16 sDMapX, INT16 sDMapY ); -// HEADROCK HAM B1: Changes the allowed militia sectors -// HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. -extern void AdjustRoamingRestrictions( BOOLEAN fRecheck ); -// HEADROCK HAM 4: Yet ANOTHER array, this one holds player-set restrictions. It interacts with the dynamic one below. -extern UINT8 gubManualRestrictMilitia[ 256 ]; -// HEADROCK HAM B1: Alternate array keeps track of dynamically unrestricted sectors -extern BOOLEAN gDynamicRestrictMilitia[ 256 ]; // HEADROCK HAM B2.7: Wonder why this function wasn't declared here. It is now, to allow Town Militia.cpp to // access it. @@ -44,16 +32,6 @@ BOOLEAN CheckStandardConditionsForDirection( INT16 sSMapX, INT16 sSMapY, INT16 s // makes sure that the target sector has room for more militia. void GenerateDirectionInfosForTraining( INT16 sMapX, INT16 sMapY, UINT8* uiDirNumber, UINT16 pMoveDir[4][3] ); -// HEADROCK HAM 3.4: Stores restriction data from XML, including required cities for each sector to be allowed. -typedef struct DYNAMICRESTRICTIONS -{ - INT16 sSectorID; - UINT32 uiReqTownFlags; -} DYNAMICRESTRICTIONS; - -// HEADROCK HAM 3.4: New function for simple Roaming Restriction testing. -BOOLEAN IsSectorRoamingAllowed( UINT32 uiSector ); - // HEADROCK HAM 3.6: New upgrade check returns the amount of militia that can be upgraded at target sector, in // "upgrade points" UINT16 MilitiaUpgradeSlotsCheck( INT16 sMapX, INT16 sMapY ); @@ -61,16 +39,6 @@ UINT16 MilitiaUpgradeSlotsCheck( INT16 sMapX, INT16 sMapY ); // HEADROCK HAM 3.6: This needs to be accessible. void AddToBlockMoveList(INT16 sMapX, INT16 sMapY); -// HEADROCK HAM 4: Returns whether sector is allowed for militia roaming, taking into account player-set restrictions. -UINT8 ManualMobileMovementAllowed( UINT8 ubSector ); - -// HEADROCK HAM 4: Initialize all manual restrictions; -void InitManualMobileRestrictions(); - -//Moa: for mobile militia: militia deserters and maximum allowed -extern void MobileMilitiaDeserters( INT16 sMapX, INT16 sMapY, BOOLEAN fDeleteEquip, BOOLEAN fPrintMessage ); -extern UINT8 GetMobileMilitiaQuota( BOOLEAN printMessage ); - // Flugente: militia movement BOOLEAN SaveMilitiaMovementInformationToSaveGameFile( HWFILE hFile ); BOOLEAN LoadMilitiaMovementInformationFromSavedGameFile( HWFILE hFile, UINT32 uiSavedGameVersion ); diff --git a/Strategic/Quests.h b/Strategic/Quests.h index cbc98a3a..b2f2acf4 100644 --- a/Strategic/Quests.h +++ b/Strategic/Quests.h @@ -541,8 +541,8 @@ enum Facts FACT_CONRAD_SHOULD_GO = 367, FACT_PLAYER_KILLED_BOXERS = 368, - // HEADROCK HAM 4: Seen Mobile Militia screen after having at least one mobile unit? - FACT_MOBILE_RESTRICTIONS_VIEWED = 369, + + FACT_UNUSED = 369, // anv: Waldo The Mechanic, facts for his dialogue FACT_HELI_DAMAGED_CAN_START_REPAIR, diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index aacf6a7f..6b6ccaf5 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -588,13 +588,7 @@ void MercDailyUpdate() #endif // rebuild list for mapscreen ReBuildCharactersList( ); - // HEADROCK HAM B1: Run a function to redefine Roaming Militia Restrictions. - if (gGameExternalOptions.fDynamicRestrictRoaming) - { - // HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. - AdjustRoamingRestrictions( FALSE ); - } - + // Buggler: Pay income for operating Facilities today. if (giTotalEarnedForFacilityOperationsToday) { diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 2b83c7a1..f56b0dd7 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -1880,13 +1880,7 @@ void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSec { UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 2 ) ); } - // HEADROCK HAM B1: Run a function to redefine Roaming Militia Restrictions on city capture. - if (gGameExternalOptions.fDynamicRestrictRoaming) - { - // HEADROCK HAM 5: New flag tells us to also recheck restriced sectors. - AdjustRoamingRestrictions( FALSE ); - } - + // set flag even for towns where you can't train militia, useful for knowing Orta/Tixa were previously controlled gTownLoyalty[ bTownId ].fLiberatedAlready = TRUE; } diff --git a/Strategic/Strategic_VS2005.vcproj b/Strategic/Strategic_VS2005.vcproj index 04729006..c911743c 100644 --- a/Strategic/Strategic_VS2005.vcproj +++ b/Strategic/Strategic_VS2005.vcproj @@ -768,10 +768,6 @@ RelativePath=".\XML_Creatures.cpp" > - - @@ -788,10 +784,6 @@ RelativePath=".\XML_Minerals.cpp" > - - diff --git a/Strategic/Strategic_VS2008.vcproj b/Strategic/Strategic_VS2008.vcproj index 51214934..7d96282b 100644 --- a/Strategic/Strategic_VS2008.vcproj +++ b/Strategic/Strategic_VS2008.vcproj @@ -766,10 +766,6 @@ RelativePath=".\XML_Creatures.cpp" > - - @@ -786,10 +782,6 @@ RelativePath=".\XML_Minerals.cpp" > - - diff --git a/Strategic/Strategic_VS2010.vcxproj b/Strategic/Strategic_VS2010.vcxproj index 28afcd61..5f2869af 100644 --- a/Strategic/Strategic_VS2010.vcxproj +++ b/Strategic/Strategic_VS2010.vcxproj @@ -131,12 +131,10 @@ - - diff --git a/Strategic/Strategic_VS2010.vcxproj.filters b/Strategic/Strategic_VS2010.vcxproj.filters index d88d387f..08ac88a7 100644 --- a/Strategic/Strategic_VS2010.vcxproj.filters +++ b/Strategic/Strategic_VS2010.vcxproj.filters @@ -314,9 +314,6 @@ Source Files - - Source Files - Source Files @@ -326,9 +323,6 @@ Source Files - - Source Files - Source Files diff --git a/Strategic/Strategic_VS2013.vcxproj b/Strategic/Strategic_VS2013.vcxproj index b0113ce5..0c90891f 100644 --- a/Strategic/Strategic_VS2013.vcxproj +++ b/Strategic/Strategic_VS2013.vcxproj @@ -131,12 +131,10 @@ - - diff --git a/Strategic/Strategic_VS2013.vcxproj.filters b/Strategic/Strategic_VS2013.vcxproj.filters index 3721bc59..87da8955 100644 --- a/Strategic/Strategic_VS2013.vcxproj.filters +++ b/Strategic/Strategic_VS2013.vcxproj.filters @@ -308,9 +308,6 @@ Source Files - - Source Files - Source Files @@ -320,9 +317,6 @@ Source Files - - Source Files - Source Files diff --git a/Strategic/Strategic_VS2017.vcxproj b/Strategic/Strategic_VS2017.vcxproj index 27b72014..a45fc06c 100644 --- a/Strategic/Strategic_VS2017.vcxproj +++ b/Strategic/Strategic_VS2017.vcxproj @@ -131,12 +131,10 @@ - - diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index c13c14fa..59f769c0 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -53,7 +53,6 @@ INT16 gsTownSectorServerSkipY = -1; UINT8 gubTownSectorServerIndex = 0; BOOLEAN gfYesNoPromptIsForContinue = FALSE; // this flag remembers whether we're starting new training, or continuing INT32 giTotalCostOfTraining = 0; -BOOLEAN gfAreWeTrainingMobile = FALSE; BOOLEAN gfAreWePromotingGreen = FALSE; BOOLEAN gfAreWePromotingRegular = FALSE; @@ -88,10 +87,7 @@ BOOLEAN gfMilitiaAllowedInTown[MAX_TOWNS] = // private prototypes void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ); -// HEADROCK HAM 3.6: Duplicate function for handling callback on Mobile Militia training -void PayMobileMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ); void CantTrainMilitiaOkBoxCallback( UINT8 bExitValue ); -void CantTrainMobileMilitiaOkBoxCallback( UINT8 bExitValue ); void PayForTrainingInSector( UINT8 ubSector ); @@ -257,7 +253,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // HEADROCK HAM 3.6: Leadership may affect the resulting squad size. UINT8 ubTrainerEffectiveLeadership = FindBestMilitiaTrainingLeadershipInSector ( sMapX, sMapY, pTrainer->bSectorZ, TOWN_MILITIA ); - UINT8 iTrainingSquadSize = __min(iMaxMilitiaPerSector, CalcNumMilitiaTrained(ubTrainerEffectiveLeadership, FALSE)); + UINT8 iTrainingSquadSize = __min(iMaxMilitiaPerSector, CalcNumMilitiaTrained(ubTrainerEffectiveLeadership)); UINT8 promotionstodo = 0; // Flugente: our pool of volunteers limits how many militia can be created @@ -298,19 +294,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa // Kaiden: Roaming Militia Training: // If we're not training roaming militia, // then we will handle everything as normal. - - // HEADROCK HAM 3.6: This is now VOLUNTARY. - if( pTrainer->bAssignment == TRAIN_MOBILE ) - { - CreateMilitiaSquads(sMapX, sMapY ); - - // the trainer announces to player that he's finished his assignment. Make his sector flash! - AssignmentDone( pTrainer, TRUE, FALSE ); - - // handle completion of town by training group - HandleCompletionOfTownTrainingByGroupWithTrainer( pTrainer, MOBILE_MILITIA ); - } - else + { // we either create new militia or promote existing ones if no space is left while ( ubMilitiaTrained + promotionstodo < iTrainingSquadSize ) @@ -416,7 +400,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa } // SANDRO - merc records (num militia trained) - RecordNumMilitiaTrainedForMercs( sMapX, sMapY, pTrainer->bSectorZ, ubMilitiaTrained, FALSE ); + RecordNumMilitiaTrainedForMercs( sMapX, sMapY, pTrainer->bSectorZ, ubMilitiaTrained ); } if ( gGameExternalOptions.fMilitiaResources && !gGameExternalOptions.fMilitiaUseSectorInventory ) @@ -440,7 +424,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa AddStrategicEvent( EVENT_MILITIAROSTER_EMAIL, GetWorldTotalMin( ) + 60 * (1 + Random( 4 )), 0 ); } - // feed this a SOLDIER_CLASS_, it will return you a _MITILIA rank, or -1 if the guy's not militia INT8 SoldierClassToMilitiaRank(UINT8 ubSoldierClass) { @@ -462,7 +445,6 @@ INT8 SoldierClassToMilitiaRank(UINT8 ubSoldierClass) return(bRank); } - // feed this a _MITILIA rank, it will return you a SOLDIER_CLASS_, or -1 if the guy's not militia INT8 MilitiaRankToSoldierClass(UINT8 ubRank) { @@ -484,7 +466,6 @@ INT8 MilitiaRankToSoldierClass(UINT8 ubRank) return(bSoldierClass); } - void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); @@ -500,7 +481,6 @@ void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 u fMapPanelDirty = TRUE; } - void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); @@ -556,7 +536,6 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa fMapPanelDirty = TRUE; } - void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); @@ -631,7 +610,6 @@ void StrategicRemoveAllStaticMilitiaFromSector( INT16 sMapX, INT16 sMapY, UINT8 fMapPanelDirty = TRUE; } - // kill pts are (2 * kills) + assists UINT8 CheckOneMilitiaForPromotion(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubRecentKillPts) { @@ -683,7 +661,6 @@ UINT8 CheckOneMilitiaForPromotion(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, return 0; } - // call this if the player attacks his own militia void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY) { @@ -723,7 +700,6 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY) } } - UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank) { return MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ) + MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); @@ -851,7 +827,6 @@ BOOLEAN ServeNextFriendlySectorInTown( INT16 *sNeighbourX, INT16 *sNeighbourY ) return(TRUE); } - void HandleInterfaceMessageForCostOfTrainingMilitia( SOLDIERTYPE *pSoldier ) { INT32 iMilitiaTrainingCost = gGameExternalOptions.iMilitiaTrainingCost; @@ -867,19 +842,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2"); UINT8 ubMilitiaType = 0; if (pSoldier->bAssignment == TRAIN_TOWN) ubMilitiaType = TOWN_MILITIA; - else if (pSoldier->bAssignment == TRAIN_MOBILE) - ubMilitiaType = MOBILE_MILITIA; else return; + // grab total number of sectors iNumberOfSectors = GetNumberOfUnpaidTrainableSectors( ubMilitiaType ); Assert( iNumberOfSectors > 0 ); - - // Kaiden: Roaming Militia Training: - // We want to charge more for Roaming - + // get total cost - // HEADROCK HAM 3.6: Mobile and Garrison Militia now separate if (ubMilitiaType == TOWN_MILITIA) // Garrison { // If Regulars are maxed, and Elites are allowed, calculate cost to upgrade Regular->Elite @@ -903,14 +873,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2"); giTotalCostOfTraining = iMilitiaTrainingCost * iNumberOfSectors; Assert( giTotalCostOfTraining > 0 ); } - gfAreWeTrainingMobile = FALSE; - } - // Mobile - else - { - giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier) * iNumberOfSectors; - Assert( giTotalCostOfTraining > 0 ); - gfAreWeTrainingMobile = TRUE; } gfYesNoPromptIsForContinue = FALSE; @@ -923,66 +885,31 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia2"); swprintf( sString, pMilitiaConfirmStrings[ 8 ], giTotalCostOfTraining ); DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); } - else - { - swprintf( sString, pMilitiaConfirmStrings[ 11 ], giTotalCostOfTraining ); - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - } return; } // ok to start training, ask player - - - if( iNumberOfSectors > 1 ) + if ( ubMilitiaType == TOWN_MILITIA ) { - if (ubMilitiaType == TOWN_MILITIA) + if ( iNumberOfSectors > 1 ) { - swprintf( sString, pMilitiaConfirmStrings[ 7 ], iNumberOfSectors, giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] ); + swprintf( sString, pMilitiaConfirmStrings[7], iNumberOfSectors, giTotalCostOfTraining, pMilitiaConfirmStrings[1] ); } else { - swprintf( sString, pMilitiaConfirmStrings[ 13 ], iNumberOfSectors, giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] ); + swprintf( sString, L"%s%d. %s", pMilitiaConfirmStrings[0], giTotalCostOfTraining, pMilitiaConfirmStrings[1] ); } - } - else - { - if (ubMilitiaType == TOWN_MILITIA) - { - swprintf( sString, L"%s%d. %s", pMilitiaConfirmStrings[ 0 ], giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] ); - } - else - { - swprintf( sString, L"%s%d. %s", pMilitiaConfirmStrings[ 14 ], giTotalCostOfTraining, pMilitiaConfirmStrings[ 1 ] ); - } - } - // if we are in mapscreen, make a pop up - if( guiCurrentScreen == MAP_SCREEN ) - { - // HEADROCK HAM 3.6: Separate callbacks for Mobile and Garrison militia - if (ubMilitiaType == TOWN_MILITIA) + // if we are in mapscreen, make a pop up + if ( guiCurrentScreen == MAP_SCREEN ) { DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback ); } else - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PayMobileMilitiaTrainingYesNoBoxCallback ); - } - } - else - { - if (ubMilitiaType == TOWN_MILITIA) { DoMessageBox( MSG_BOX_BASIC_STYLE, sString, GAME_SCREEN, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback, &pCenteringRect ); } - else - { - DoMessageBox( MSG_BOX_BASIC_STYLE, sString, GAME_SCREEN, MSG_BOX_FLAG_YESNO, PayMobileMilitiaTrainingYesNoBoxCallback, &pCenteringRect ); - } } - - return; } void DoContinueMilitiaTrainingMessageBox( INT16 sSectorX, INT16 sSectorY, const STR16 str, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) @@ -1021,34 +948,16 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { ubMilitiaType = TOWN_MILITIA; } - else if (pSoldier->bAssignment == TRAIN_MOBILE ) - { - ubMilitiaType = MOBILE_MILITIA; - } if (ubMilitiaType == TOWN_MILITIA) { Assert( SectorInfo[ SECTOR( sSectorX, sSectorY ) ].fMilitiaTrainingPaid == FALSE ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - Assert( SectorInfo[ SECTOR( sSectorX, sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ); - } pMilitiaTrainerSoldier = pSoldier; gfYesNoPromptIsForContinue = TRUE; - - //Moa: prevent continue training when at/above maximum - if ( ubMilitiaType == MOBILE_MILITIA ) - { - if ( 100 <= GetMobileMilitiaQuota( TRUE ) ) - { - MilitiaTrainingRejected( MOBILE_MILITIA ); - return; - } - } - + // is there enough loyalty to continue training if( DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( pSoldier ) == FALSE ) { @@ -1058,10 +967,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - } return; } @@ -1084,132 +989,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); return; } - else if (ubMilitiaType == MOBILE_MILITIA) - { - // Test to see if not enough Town Militia - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR(pSoldier->sSectorX, pSoldier->sSectorY) ] ); - BOOLEAN fUnfullSectorFound = FALSE; - - // Test to see if not enough Town Militia - // HEADROCK HAM 4: No need for this check anymore. Militia can now be trained separately thanks to being - // able to keep them out of cities. - /* - - if ( CountMilitia( pSectorInfo ) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - fUnfullSectorFound = TRUE; - } - else - { - iCounter = 0; - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - INT16 sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - INT16 sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - pSectorInfo = &( SectorInfo[ SECTOR(sCurrentX, sCurrentY) ] ); - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. This sector cannot generate militia anyway. - iCounter++; - continue; - } - else - { - if (CountMilitia(pSectorInfo) < gGameExternalOptions.iMaxMilitiaPerSector ) - { - // Found a controlled city sector that does not yet have a full garrison - fUnfullSectorFound; - } - } - } - iCounter++; - } - } - if (fUnfullSectorFound) - { - // At least one city sector is controlled but not full of garrison militia. Can't train mobiles! - swprintf(sString, New113HAMMessage[9], gGameExternalOptions.iMaxMilitiaPerSector, pTownNames[bTownId]); - DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - return; - } - */ - - ////////////////////////////////////////// - // Capacity check in nearby sectors - UINT16 pMoveDir[4][3]; - UINT8 uiDirNumber = 0; - BOOLEAN fFoundValidSector = FALSE; - - - INT8 bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); - GenerateDirectionInfosForTraining( pSoldier->sSectorX, pSoldier->sSectorY, &uiDirNumber, pMoveDir ); - // Found at least one suitable place to put Mobiles? - if (uiDirNumber) - { - fFoundValidSector = TRUE; - } - // Try entire city. - else - { - INT32 iCounter = 0; - // Go through each city in the game - while( pTownNamesList[ iCounter ] != 0 ) - { - // Are we in this city? - if( pTownNamesList[ iCounter] == bTownId ) - { - INT16 sCurrentX = GET_X_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - INT16 sCurrentY = GET_Y_FROM_STRATEGIC_INDEX( pTownLocationsList[ iCounter ] ); - - // if sector has enemies or hasn't already been taken at least once, then - if ( !SectorInfo[ SECTOR(sCurrentX, sCurrentY) ].fSurfaceWasEverPlayerControlled || - NumNonPlayerTeamMembersInSector( sCurrentX, sCurrentY, ENEMY_TEAM ) > 0 ) - { - // skip the rest. This sector cannot generate militia anyway. - iCounter++; - continue; - } - - // Find out if any adjacent sectors have room in them. - GenerateDirectionInfosForTraining( sCurrentX, sCurrentY, &uiDirNumber, pMoveDir ); - - if(uiDirNumber) - { - fFoundValidSector = TRUE; - break; - } - } - iCounter++; - } - } - - // Couldn't find at least one sector to place Mobiles. Report "No room!" - if (!fFoundValidSector) - { - swprintf( sString, New113HAMMessage[ 8 ], pTownNames[ bTownId ], iMinLoyaltyToTrain ); - DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - return; - } - } - - // Kaiden: Roaming Militia Training: - // Charging more to train Roaming Militia - // Also Charging more for promotions over Training - - if( ubMilitiaType == MOBILE_MILITIA ) - { - giTotalCostOfTraining = (iMilitiaTrainingCost*gGameExternalOptions.iMilitiaCostModifier); - gfAreWeTrainingMobile = TRUE; - } - - else { if (IsMilitiaTrainableFromSoldiersSectorMaxed( pSoldier, REGULAR_MILITIA ) && (gGameExternalOptions.gfTrainVeteranMilitia) @@ -1227,7 +1007,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { giTotalCostOfTraining = (iMilitiaTrainingCost); } - gfAreWeTrainingMobile = FALSE; } // can player afford to continue training? @@ -1239,10 +1018,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMilitiaOkBoxCallback ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - } return; } @@ -1253,10 +1028,6 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { swprintf( sString, pMilitiaConfirmStrings[ 3 ], sStringB, pMilitiaConfirmStrings[ 4 ], giTotalCostOfTraining ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - swprintf( sString, pMilitiaConfirmStrings[ 12 ], sStringB, pMilitiaConfirmStrings[ 4 ], giTotalCostOfTraining ); - } // ask player whether he'd like to continue training //DoContinueMilitiaTrainingMessageBox( sSectorX, sSectorY, sString, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback ); @@ -1264,14 +1035,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia3"); { DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PayMilitiaTrainingYesNoBoxCallback ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_YESNO, PayMobileMilitiaTrainingYesNoBoxCallback ); - } } - - // IMPORTANT: This same callback is used both for initial training and for continue training prompt // use 'gfYesNoPromptIsForContinue' flag to tell them apart void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ) @@ -1317,22 +1082,12 @@ void PayMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ) MilitiaTrainingRejected( TOWN_MILITIA ); } - - return; } void CantTrainMilitiaOkBoxCallback( UINT8 bExitValue ) { MilitiaTrainingRejected( TOWN_MILITIA ); - return; -} - -// HEADROCK HAM 3.6: Duplicate of the above, for Mobile Militia purposes. -void CantTrainMobileMilitiaOkBoxCallback( UINT8 bExitValue ) -{ - MilitiaTrainingRejected( MOBILE_MILITIA ); - return; } // IMPORTANT: This same callback is used both for initial training and for continue training prompt @@ -1360,8 +1115,6 @@ void MilitiaTrainingRejected( UINT8 ubMilitiaType ) pMilitiaTrainerSoldier = NULL; } - - void HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap( void ) { if ( gTacticalStatus.Team[ MILITIA_TEAM ].bSide != 0 ) @@ -1376,7 +1129,6 @@ void HandleMilitiaStatusInCurrentMapBeforeLoadingNewMap( void ) } } - BOOLEAN CanSomeoneNearbyScoutThisSector( INT16 sSectorX, INT16 sSectorY, BOOLEAN fScoutTraitCheck ) // added argument - SANDRO { INT16 sSectorValue = 0, sSector = 0; @@ -1788,16 +1540,6 @@ void BuildListOfUnpaidTrainableSectors( UINT8 ubMilitiaType ) } } } - else - { - if (CanCharacterTrainMobileMilitia( pSoldier ) == TRUE ) - { - if (SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE) - { - gsUnpaidStrategicSector[ iCounter ] = CALCULATE_STRATEGIC_INDEX( pSoldier->sSectorX, pSoldier->sSectorY ); - } - } - } } } } @@ -1818,16 +1560,6 @@ void BuildListOfUnpaidTrainableSectors( UINT8 ubMilitiaType ) } } } - else - { - if (CanCharacterTrainMobileMilitia( pSoldier ) == TRUE ) - { - if (SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ].fMobileMilitiaTrainingPaid == FALSE ) - { - gsUnpaidStrategicSector[ iCounter ] = CALCULATE_STRATEGIC_INDEX( pSoldier->sSectorX, pSoldier->sSectorY ); - } - } - } } // now clean out repeated sectors @@ -1869,7 +1601,6 @@ INT32 GetNumberOfUnpaidTrainableSectors( UINT8 ubMilitiaType ) } - void StartTrainingInAllUnpaidTrainableSectors( UINT8 ubMilitiaType ) { INT32 iCounter = 0; @@ -1879,10 +1610,6 @@ void StartTrainingInAllUnpaidTrainableSectors( UINT8 ubMilitiaType ) { SetAssignmentForList( TRAIN_TOWN, 0 ); } - else if (ubMilitiaType == MOBILE_MILITIA) - { - SetAssignmentForList( TRAIN_MOBILE, 0 ); - } BuildListOfUnpaidTrainableSectors( ubMilitiaType ); @@ -1898,7 +1625,6 @@ void StartTrainingInAllUnpaidTrainableSectors( UINT8 ubMilitiaType ) } } - void ContinueTrainingInThisSector( UINT8 ubMilitiaType ) { UINT8 ubSector; @@ -1920,20 +1646,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia6"); UINT8 ubMilitiaType = 0; // spend the money - // Kaiden: Roaming Militia Training: - // Charging more to train Roaming Militia - // Or for promotions. - - if ( gfAreWeTrainingMobile) - { - Assert( SectorInfo[ ubSector ].fMobileMilitiaTrainingPaid == FALSE ); - // Mark sector as being paid up - SectorInfo[ ubSector ].fMobileMilitiaTrainingPaid = TRUE; - CostMultiplyer = gGameExternalOptions.iMilitiaCostModifier; - gfAreWeTrainingMobile = FALSE; - ubMilitiaType = MOBILE_MILITIA; - } - else + { Assert( SectorInfo[ ubSector ].fMilitiaTrainingPaid == FALSE ); if ( gfAreWePromotingGreen) @@ -1961,14 +1674,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia6"); ResetDoneFlagForAllMilitiaTrainersInSector( ubSector, ubMilitiaType ); } - void ResetDoneFlagForAllMilitiaTrainersInSector( UINT8 ubSector, UINT8 ubMilitiaType ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - - - for( iCounter = 0; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) + + for( INT32 iCounter = 0; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++iCounter ) { pSoldier = &Menptr[ iCounter ]; @@ -1985,22 +1695,10 @@ void ResetDoneFlagForAllMilitiaTrainersInSector( UINT8 ubSector, UINT8 ubMilitia } } } - else if (ubMilitiaType == MOBILE_MILITIA) - { - if( pSoldier->bAssignment == TRAIN_MOBILE ) - { - if( ( SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) == ubSector ) && ( pSoldier->bSectorZ == 0 ) ) - { - pSoldier->flags.fDoneAssignmentAndNothingToDoFlag = FALSE; - pSoldier->usQuoteSaidExtFlags &= ~SOLDIER_QUOTE_SAID_DONE_ASSIGNMENT; - } - } - } } } } - BOOLEAN MilitiaTrainingAllowedInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { INT8 bTownId; @@ -2101,23 +1799,21 @@ void BuildMilitiaPromotionsString( STR16 str ) gbRegToElitePromotions = 0; gbMilitiaPromotions = 0; } + // HEADROCK HAM 3.3: This function finds the best Militia Trainer in the target sector. It may also take into account // mercs' TEACHING skill, if told to. The function returns the calculated "Effective Leadership" of the selected // trainer. UINT8 FindBestMilitiaTrainingLeadershipInSector ( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT8 ubMilitiaType ) { - UINT16 cnt = 0; SOLDIERTYPE * pCheckedTrainer; UINT16 usTrainerEffectiveLeadership = 0; UINT8 ubBestLeadership = 0; // HEADROCK HAM 3.3: Add search for best trainer in sector - for ( pCheckedTrainer = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pCheckedTrainer++) + for ( pCheckedTrainer = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, ++pCheckedTrainer ) { - if (pCheckedTrainer->bActive && pCheckedTrainer->stats.bLife >= OKLIFE && - ((ubMilitiaType == TOWN_MILITIA && pCheckedTrainer->bAssignment == TRAIN_TOWN) || - (ubMilitiaType == MOBILE_MILITIA && pCheckedTrainer->bAssignment == TRAIN_MOBILE) ) ) + if (pCheckedTrainer->bActive && pCheckedTrainer->stats.bLife >= OKLIFE && (ubMilitiaType == TOWN_MILITIA && pCheckedTrainer->bAssignment == TRAIN_TOWN) ) { if (pCheckedTrainer->sSectorX == sMapX && pCheckedTrainer->sSectorY == sMapY && pCheckedTrainer->bSectorZ == bMapZ ) { @@ -2157,9 +1853,8 @@ UINT8 FindBestMilitiaTrainingLeadershipInSector ( INT16 sMapX, INT16 sMapY, INT8 // HEADROCK HAM 3.6: Created a new function to make things easier. This calculates the target number of militia to // be created. -UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership, BOOLEAN fMobile) +UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership) { - UINT8 ubReqLeadershipForFull = 1; UINT8 ubMinLeadershipForTraining = 0; UINT8 ubLeadershipRange = 0; @@ -2167,132 +1862,43 @@ UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership, BOOLEAN fMobile) // Result value UINT8 ubMilitiaToTrain = 0; - // Garrison Training - if (!fMobile) + + // Default Squad Size for Garrisons, read from INI. + ubMilitiaToTrain = gGameExternalOptions.iTrainingSquadSize; + + // Is affected by Leadership? + if (gGameExternalOptions.fLeadershipAffectsMilitiaQuantity && + gGameExternalOptions.ubReqLeadershipForFullTraining > gGameExternalOptions.ubMinimumLeadershipToTrainMilitia) { - // Default Squad Size for Garrisons, read from INI. - ubMilitiaToTrain = gGameExternalOptions.iTrainingSquadSize; + // Set these variables to their INI values. + ubReqLeadershipForFull = gGameExternalOptions.ubReqLeadershipForFullTraining; + ubMinLeadershipForTraining = gGameExternalOptions.ubMinimumLeadershipToTrainMilitia; - // Is affected by Leadership? - if (gGameExternalOptions.fLeadershipAffectsMilitiaQuantity && - gGameExternalOptions.ubReqLeadershipForFullTraining > gGameExternalOptions.ubMinimumLeadershipToTrainMilitia) - { - // Set these variables to their INI values. - ubReqLeadershipForFull = gGameExternalOptions.ubReqLeadershipForFullTraining; - ubMinLeadershipForTraining = gGameExternalOptions.ubMinimumLeadershipToTrainMilitia; - - // We make sure our effective leadership isn't above or below the limits. If so, reset to limits. - // If there is a minimum required to train militia, we're ASSUMING that the character has enough leadership - // otherwise they wouldn't even be here. But just in case he's skipped the check somehow, this will raise - // leadership to the minimum to avoid problems. - ubBestLeadership = __max(ubBestLeadership, ubMinLeadershipForTraining); - ubBestLeadership = __min(ubBestLeadership, ubReqLeadershipForFull); + // We make sure our effective leadership isn't above or below the limits. If so, reset to limits. + // If there is a minimum required to train militia, we're ASSUMING that the character has enough leadership + // otherwise they wouldn't even be here. But just in case he's skipped the check somehow, this will raise + // leadership to the minimum to avoid problems. + ubBestLeadership = __max(ubBestLeadership, ubMinLeadershipForTraining); + ubBestLeadership = __min(ubBestLeadership, ubReqLeadershipForFull); - // Find out by how much we've beaten the skill check - ubBestLeadership = ubBestLeadership - ubMinLeadershipForTraining; + // Find out by how much we've beaten the skill check + ubBestLeadership = ubBestLeadership - ubMinLeadershipForTraining; - // Find the range between the minimum and maximum. - ubLeadershipRange = ubReqLeadershipForFull - ubMinLeadershipForTraining; + // Find the range between the minimum and maximum. + ubLeadershipRange = ubReqLeadershipForFull - ubMinLeadershipForTraining; - // Squad Size is determined by the relative value of the leadership within the range. Anyone meeting or - // exceeding the range (latter shouldn't happen) will train a full squad. Others will train less. If - // leadership was the minimum required, only 1 militia is trained. - ubMilitiaToTrain = ((ubBestLeadership * ubMilitiaToTrain) / ubLeadershipRange) + 1; - ubMilitiaToTrain = __min(ubMilitiaToTrain, gGameExternalOptions.iTrainingSquadSize); - ubMilitiaToTrain = __max(1, ubMilitiaToTrain); - } - } - - // Mobile Militia - else - { - // Default Squad Size for Mobiles, read from INI. - ubMilitiaToTrain = gGameExternalOptions.guiNumMobileMilitiaTrained; - - // Is affected by Leadership? - if (gGameExternalOptions.fLeadershipAffectsMobileMilitiaQuantity && - gGameExternalOptions.ubReqLeadershipForFullMobileTraining > gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia ) - { - - // Set these variables to their INI values. - ubReqLeadershipForFull = gGameExternalOptions.ubReqLeadershipForFullMobileTraining; - ubMinLeadershipForTraining = gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia; - - // We make sure our effective leadership isn't above or below the limits. If so, reset to limits. - // If there is a minimum required to train militia, we're ASSUMING that the character has enough leadership - // otherwise they wouldn't even be here. But just in case he's skipped the check somehow, this will raise - // leadership to the minimum to avoid problems. - ubBestLeadership = __max(ubBestLeadership, ubMinLeadershipForTraining); - ubBestLeadership = __min(ubBestLeadership, ubReqLeadershipForFull); - - // Find out by how much we've beaten the skill check - ubBestLeadership = ubBestLeadership - ubMinLeadershipForTraining; - - // Find the range between the minimum and maximum. - ubLeadershipRange = ubReqLeadershipForFull - ubMinLeadershipForTraining; - - // Squad Size is determined by the relative value of the leadership within the range. Anyone meeting or - // exceeding the range (latter shouldn't happen) will train a full squad. Others will train less. If - // leadership was the minimum required, only 3 militia are trained. - ubMilitiaToTrain = ((ubBestLeadership * ubMilitiaToTrain) / ubLeadershipRange) + 1; - ubMilitiaToTrain = __min(ubMilitiaToTrain, gGameExternalOptions.guiNumMobileMilitiaTrained); - ubMilitiaToTrain = __max(3, ubMilitiaToTrain); - } + // Squad Size is determined by the relative value of the leadership within the range. Anyone meeting or + // exceeding the range (latter shouldn't happen) will train a full squad. Others will train less. If + // leadership was the minimum required, only 1 militia is trained. + ubMilitiaToTrain = ((ubBestLeadership * ubMilitiaToTrain) / ubLeadershipRange) + 1; + ubMilitiaToTrain = __min(ubMilitiaToTrain, gGameExternalOptions.iTrainingSquadSize); + ubMilitiaToTrain = __max(1, ubMilitiaToTrain); } return (ubMilitiaToTrain); } -// HEADROCK HAM 3.6: Duplicate function for handling callback on Mobile Militia training -void PayMobileMilitiaTrainingYesNoBoxCallback( UINT8 bExitValue ) -{ - CHAR16 sString[ 128 ]; - - Assert( giTotalCostOfTraining > 0 ); - - // yes - if( bExitValue == MSG_BOX_RETURN_YES ) - { - // does the player have enough - if( LaptopSaveInfo.iCurrentBalance >= giTotalCostOfTraining ) - { - if( gfYesNoPromptIsForContinue ) - { - ContinueTrainingInThisSector( MOBILE_MILITIA ); - } - else - { - StartTrainingInAllUnpaidTrainableSectors( MOBILE_MILITIA ); - } - -#ifdef JA2BETAVERSION - // put this BEFORE training gets handled to avoid detecting an error everytime a sector completes training - // Checks Town and Mobile militia - VerifyTownTrainingIsPaidFor(); -#endif - - // this completes the training prompt sequence - pMilitiaTrainerSoldier = NULL; - } - else // can't afford it - { - StopTimeCompression(); - - swprintf( sString, L"%s", pMilitiaConfirmStrings[ 2 ] ); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, CantTrainMobileMilitiaOkBoxCallback ); - } - } - else if( bExitValue == MSG_BOX_RETURN_NO ) - { - StopTimeCompression(); - - MilitiaTrainingRejected( MOBILE_MILITIA ); - } - - return; -} - // HEADROCK HAM 3.6: Daily check for upkeep of all militia void HandleMilitiaUpkeepPayment( void ) { @@ -2329,26 +1935,9 @@ void HandleMilitiaUpkeepPayment( void ) MilitiaList[cnt].ubSectorId = (UINT8)cnt; - UINT8 ubTownId = GetTownIdForSector( sMapX, sMapY ); - if ((ubTownId != BLANK_SECTOR && MilitiaTrainingAllowedInTown(ubTownId)) || // Major Town - IsThisSectorASAMSector( sMapX, sMapY, 0 ) ) // SAM Site - { - MilitiaList[cnt].ubNumTownGreens = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); - MilitiaList[cnt].ubNumTownRegulars = MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ); - MilitiaList[cnt].ubNumTownElites = MilitiaInSectorOfRank( sMapX, sMapY, ELITE_MILITIA ); - MilitiaList[cnt].ubNumMobileGreens = 0; - MilitiaList[cnt].ubNumMobileRegulars = 0; - MilitiaList[cnt].ubNumMobileElites = 0; - } - else - { - MilitiaList[cnt].ubNumMobileGreens = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); - MilitiaList[cnt].ubNumMobileRegulars = MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ); - MilitiaList[cnt].ubNumMobileElites = MilitiaInSectorOfRank( sMapX, sMapY, ELITE_MILITIA ); - MilitiaList[cnt].ubNumTownGreens = 0; - MilitiaList[cnt].ubNumTownRegulars = 0; - MilitiaList[cnt].ubNumTownElites = 0; - } + MilitiaList[cnt].ubNumTownGreens = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); + MilitiaList[cnt].ubNumTownRegulars = MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ); + MilitiaList[cnt].ubNumTownElites = MilitiaInSectorOfRank( sMapX, sMapY, ELITE_MILITIA ); } // Resort list so that sectors with more militia are at the top of the array. Higher weight @@ -2359,10 +1948,7 @@ void HandleMilitiaUpkeepPayment( void ) { if (MilitiaList[0].ubNumTownGreens + MilitiaList[0].ubNumTownRegulars + - MilitiaList[0].ubNumTownElites + - MilitiaList[0].ubNumMobileGreens + - MilitiaList[0].ubNumMobileRegulars + - MilitiaList[0].ubNumMobileElites == 0) + MilitiaList[0].ubNumTownElites == 0) { //All sectors are empty? Default to 0 payment. uiMoneyUnpaid = 0; @@ -2371,42 +1957,7 @@ void HandleMilitiaUpkeepPayment( void ) INT16 sX = SECTORX( MilitiaList[0].ubSectorId ); INT16 sY = SECTORY( MilitiaList[0].ubSectorId ); - if (MilitiaList[0].ubNumMobileElites > 0) - { - // Remove one militia from sector - StrategicRemoveMilitiaFromSector( sX, sY, ELITE_MILITIA, 1 ); - // Adjust list entry - MilitiaList[0].ubNumMobileElites--; - // Reduce debt appropriately - uiMoneyUnpaid -= gGameExternalOptions.usDailyCostMobile[ELITE_MILITIA]; - // Increase tally of militia removed - ++uiNumMilitiaDisbanded; - ++usElitesDisbanded; - - // Flugente: individual militia profiles need to be adjusted - DisbandIndividualMilitia( MilitiaList[0].ubSectorId, 0, 0, 1 ); - } - else if (MilitiaList[0].ubNumMobileRegulars > 0) - { - StrategicRemoveMilitiaFromSector( sX, sY, REGULAR_MILITIA, 1 ); - MilitiaList[0].ubNumMobileRegulars--; - uiMoneyUnpaid -= gGameExternalOptions.usDailyCostMobile[REGULAR_MILITIA]; - ++uiNumMilitiaDisbanded; - ++usRegularsDisbanded; - - DisbandIndividualMilitia( MilitiaList[0].ubSectorId, 0, 1, 0 ); - } - else if (MilitiaList[0].ubNumMobileGreens > 0) - { - StrategicRemoveMilitiaFromSector( sX, sY, GREEN_MILITIA, 1 ); - MilitiaList[0].ubNumMobileGreens--; - uiMoneyUnpaid -= gGameExternalOptions.usDailyCostMobile[GREEN_MILITIA]; - ++uiNumMilitiaDisbanded; - ++usGreenDisbanded; - - DisbandIndividualMilitia( MilitiaList[0].ubSectorId, 1, 0, 0 ); - } - else if (MilitiaList[0].ubNumTownElites > 0) + if (MilitiaList[0].ubNumTownElites > 0) { StrategicRemoveMilitiaFromSector( sX, sY, ELITE_MILITIA, 1 ); MilitiaList[0].ubNumTownElites--; @@ -2464,19 +2015,7 @@ void HandleMilitiaUpkeepPayment( void ) int MilitiaListQsortCompare(const void *pArg1, const void *pArg2) { - if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileElites > ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileElites) - { - return(-1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileRegulars > ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileRegulars) - { - return(-1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileGreens > ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileGreens) - { - return(-1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumTownElites > ((MILITIA_LIST_TYPE *)pArg2)->ubNumTownElites) + if (((MILITIA_LIST_TYPE *)pArg1)->ubNumTownElites > ((MILITIA_LIST_TYPE *)pArg2)->ubNumTownElites) { return(-1); } @@ -2501,19 +2040,7 @@ int MilitiaListQsortCompare(const void *pArg1, const void *pArg2) else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumTownElites < ((MILITIA_LIST_TYPE *)pArg2)->ubNumTownElites) { return(1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileGreens < ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileGreens) - { - return(1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileRegulars < ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileRegulars) - { - return(1); - } - else if (((MILITIA_LIST_TYPE *)pArg1)->ubNumMobileElites < ((MILITIA_LIST_TYPE *)pArg2)->ubNumMobileElites) - { - return(1); - } + } else { return(0); @@ -2527,7 +2054,6 @@ UINT32 CalcMilitiaUpkeep( void ) UINT32 uiTotalPayment = 0; UINT32 militia_static[MAX_MILITIA_LEVELS] = {0, 0, 0}; - UINT32 militia_mobile[MAX_MILITIA_LEVELS] = {0, 0, 0}; UINT32 militia_individual[MAX_MILITIA_LEVELS] = {0, 0, 0}; for (UINT16 cnt = 0; cnt < 256; ++cnt) @@ -2536,18 +2062,8 @@ UINT32 CalcMilitiaUpkeep( void ) UINT8 sMapX = SECTORX(cnt); UINT8 sMapY = SECTORY(cnt); - UINT8 ubTownId = GetTownIdForSector( sMapX, sMapY ); - if ((ubTownId != BLANK_SECTOR && MilitiaTrainingAllowedInTown(ubTownId)) || // Major Town - IsThisSectorASAMSector( sMapX, sMapY, 0 ) ) // SAM Site - { - for ( int i = GREEN_MILITIA; i < MAX_MILITIA_LEVELS; ++i ) - militia_static[i] += MilitiaInSectorOfRank( sMapX, sMapY, i ); - } - else - { - for ( int i = GREEN_MILITIA; i < MAX_MILITIA_LEVELS; ++i ) - militia_mobile[i] += MilitiaInSectorOfRank( sMapX, sMapY, i ); - } + for ( int i = GREEN_MILITIA; i < MAX_MILITIA_LEVELS; ++i ) + militia_static[i] += MilitiaInSectorOfRank( sMapX, sMapY, i ); } // Flugente: if indivdual militia is on, calculate costs there and use the above as a fallback option @@ -2558,14 +2074,9 @@ UINT32 CalcMilitiaUpkeep( void ) for ( int i = GREEN_MILITIA; i < MAX_MILITIA_LEVELS; ++i ) { - if ( militia_static[i] + militia_mobile[i] > militia_individual[i] ) + if ( militia_static[i] > militia_individual[i] ) { - UINT32 exceed = militia_static[i] + militia_mobile[i] - militia_individual[i]; - UINT32 exceed_mobile = min( exceed, militia_mobile[i] ); - UINT32 exced_static = exceed - exceed_mobile; - - uiTotalPayment += exced_static * gGameExternalOptions.usDailyCostTown[i]; - uiTotalPayment += exceed_mobile * gGameExternalOptions.usDailyCostMobile[i]; + uiTotalPayment += ( militia_static[i] + -militia_individual[i] ) * gGameExternalOptions.usDailyCostTown[i]; } } diff --git a/Strategic/Town Militia.h b/Strategic/Town Militia.h index f85cfade..2a77c1ac 100644 --- a/Strategic/Town Militia.h +++ b/Strategic/Town Militia.h @@ -6,7 +6,6 @@ #include "Types.h" #include "Soldier Control.h" - // how many militia of all ranks can be in any one sector at once //#define MAX_ALLOWABLE_MILITIA_PER_SECTOR 20 @@ -19,7 +18,6 @@ // minimum loyalty rating before training is allowed in a town //#define MIN_RATING_TO_TRAIN_TOWN 20 - // handle promoting a militia during militia training. return TRUE if militia could be promoted BOOLEAN TownMilitiaTrainingPromotion( INT16 sMapX, INT16 sMapY, UINT8& arusPromotedTo ); @@ -75,7 +73,6 @@ BOOLEAN IsTownFullMilitia( INT8 bTownId, INT8 iMilitiaType ); // is the SAM site full of militia? BOOLEAN IsSAMSiteFullOfMilitia( INT16 sSectorX, INT16 sSectorY, INT8 iMilitiaType ); - // now that town training is complete, handle the continue boxes void HandleContinueOfTownTraining( void ); @@ -90,7 +87,7 @@ BOOLEAN MilitiaTrainingAllowedInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSe BOOLEAN MilitiaTrainingAllowedInTown( INT8 bTownId ); // HEADROCK HAM 3.6: Function to calculate Militia and Mobile Militia training squad size. -UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership, BOOLEAN fMobile); +UINT8 CalcNumMilitiaTrained(UINT8 ubBestLeadership); // HEADROCK HAM 3.6: Total upkeep costs for YESTERDAY at midnight. Saved to savegames. extern UINT32 guiTotalUpkeepForMilitia; @@ -105,9 +102,6 @@ typedef struct MILITIA_LIST_TYPE UINT8 ubNumTownGreens; UINT8 ubNumTownRegulars; UINT8 ubNumTownElites; - UINT8 ubNumMobileGreens; - UINT8 ubNumMobileRegulars; - UINT8 ubNumMobileElites; } MILITIA_LIST_TYPE; diff --git a/Strategic/XML_DynamicRestrictions.cpp b/Strategic/XML_DynamicRestrictions.cpp deleted file mode 100644 index 6c9c5b16..00000000 --- a/Strategic/XML_DynamicRestrictions.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// HEADROCK HAM 3.4: Dynamic Roaming Restrictions XMLization -// -// This is a new part of the Dynamic Roaming Restrictions system. It reads in -// data about sectors to "un-restrict", and the towns that must be liberated -// for them to be unrestricted. There can be several unrestriction conditions -// for each sector, and only one of the conditions must be true for the sector -// to become allowed. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifdef PRECOMPILEDHEADERS - #include "Tactical All.h" -#else - #include "sgp.h" - #include "Debug Control.h" - #include "expat.h" - #include "gamesettings.h" - #include "XML.h" - #include "FileMan.h" - #include "campaign types.h" - #include "militiasquads.h" - #include "mapscreen.h" -#endif - -// HEADROCK HAM 3.4: Stores restriction data from XML, including required cities for each sector to be allowed. -extern DYNAMICRESTRICTIONS gDynamicRestrictions[5001]; - -struct -{ - PARSE_STAGE curElement; - - CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - - INT16 sCurSectorX; - INT16 sCurSectorY; - UINT32 uiReqTownFlags; - UINT32 maxArraySize; - UINT32 curIndex; - UINT32 currentDepth; - UINT32 maxReadDepth; -} -typedef dynamicroamingParseData; - - -static void XMLCALL -dynamicroamingStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) -{ - dynamicroamingParseData * pData = (dynamicroamingParseData *)userData; - - if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? - { - if(strcmp(name, "DYNAMICROAMING") == 0 && pData->curElement == ELEMENT_NONE) - { - // Set all sector IDs to -1 ("unused") - for (UINT16 cnt=0; cnt<5001; cnt++) - { - gDynamicRestrictions[cnt].sSectorID = -1; - } - pData->curElement = ELEMENT_LIST; - - pData->maxReadDepth++; //we are not skipping this element - } - else if(strcmp(name, "RESTRICTION") == 0 && pData->curElement == ELEMENT_LIST) - { - pData->curElement = ELEMENT; - pData->uiReqTownFlags = 0; - - //DebugMsg(TOPIC_JA2, DBG_LEVEL_3,"MergeStartElementHandle: setting memory for curMerge"); - - pData->maxReadDepth++; //we are not skipping this element - - //pData->curIndex++; - } - else if(pData->curElement == ELEMENT && - (strcmp(name, "SectorGrid") == 0 || - strcmp(name, "ReqTown") == 0 )) - { - pData->curElement = ELEMENT_PROPERTY; - - pData->maxReadDepth++; //we are not skipping this element - } - - pData->szCharData[0] = '\0'; - } - - pData->currentDepth++; - -} - -static void XMLCALL -dynamicroamingCharacterDataHandle(void *userData, const XML_Char *str, int len) -{ - dynamicroamingParseData * pData = (dynamicroamingParseData *)userData; - - if( (pData->currentDepth <= pData->maxReadDepth) && - (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - ){ - strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); - } -} - - -static void XMLCALL -dynamicroamingEndElementHandle(void *userData, const XML_Char *name) -{ - dynamicroamingParseData * pData = (dynamicroamingParseData *)userData; - - if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading - { - if(strcmp(name, "DYNAMICROAMING") == 0) - { - pData->curElement = ELEMENT_NONE; - } - else if(strcmp(name, "RESTRICTION") == 0) - { - pData->curElement = ELEMENT_LIST; - - if (SECTOR(pData->sCurSectorX, pData->sCurSectorY) >= 0 && SECTOR(pData->sCurSectorX, pData->sCurSectorY) < 256) - { - pData->curIndex++; - gDynamicRestrictions[pData->curIndex].sSectorID = SECTOR(pData->sCurSectorX,pData->sCurSectorY); - gDynamicRestrictions[pData->curIndex].uiReqTownFlags |= pData->uiReqTownFlags; - } - } - - else if(strcmp(name, "SectorGrid") == 0 ) - { - UINT8 x, y; - pData->curElement = ELEMENT; - - y = (UINT8)pData->szCharData[0] & 0x1F; - x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) - { - pData->sCurSectorX = x; - pData->sCurSectorY = y; - } - } - else if(strcmp(name, "ReqTown") == 0 ) - { - if ((UINT8) atol(pData->szCharData) > 0 && (UINT8) atol(pData->szCharData) < NUM_TOWNS ) - { - pData->curElement = ELEMENT; - pData->uiReqTownFlags |= (1 << ((UINT8) atol(pData->szCharData) - 1)); - } - else - { - pData->uiReqTownFlags = 0; - } - } - - pData->maxReadDepth--; - } - - pData->currentDepth--; -} - - - - -BOOLEAN ReadInDynamicRoamingRestrictions(STR fileName) -{ - HWFILE hFile; - UINT32 uiBytesRead; - UINT32 uiFSize; - CHAR8 * lpcBuffer; - XML_Parser parser = XML_ParserCreate(NULL); - - dynamicroamingParseData pData; - - DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading DynamicRestrictions.xml" ); - - // Open merges file - hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); - if ( !hFile ) - return( FALSE ); - - uiFSize = FileGetSize(hFile); - lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); - - //Read in block - if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) - { - MemFree(lpcBuffer); - return( FALSE ); - } - - lpcBuffer[uiFSize] = 0; //add a null terminator - - FileClose( hFile ); - - - XML_SetElementHandler(parser, dynamicroamingStartElementHandle, dynamicroamingEndElementHandle); - XML_SetCharacterDataHandler(parser, dynamicroamingCharacterDataHandle); - - - memset(&pData,0,sizeof(pData)); - pData.maxArraySize = MAXITEMS; - pData.curIndex = -1; - - XML_SetUserData(parser, &pData); - - - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) - { - CHAR8 errorBuf[511]; - - sprintf(errorBuf, "XML Parser Error in DynamicRestrictions.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); - LiveMessage(errorBuf); - - MemFree(lpcBuffer); - return FALSE; - } - - MemFree(lpcBuffer); - - - XML_ParserFree(parser); - - return( TRUE ); -} - diff --git a/Strategic/XML_FacilityTypes.cpp b/Strategic/XML_FacilityTypes.cpp index d5134ab6..5199d05c 100644 --- a/Strategic/XML_FacilityTypes.cpp +++ b/Strategic/XML_FacilityTypes.cpp @@ -61,16 +61,14 @@ BOOLEAN FacilityTypes_TextOnly; void InitFacilityTypeEntry( facilitytypeParseData *pData ) { - // This does base setup on a single type entry, making sure that all values are set to DEFAULT. This is run // immediately before writing XML data into game memory. // Default values set here are only those that differ from 0. Normally this means maximums and performace data // which should equal 100 unless defined otherwise in the XML. pData->curFacilityTypeData.usMilitiaTraining = 100; - pData->curFacilityTypeData.usMobileMilitiaTraining = 100; - for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; cnt++ ) + for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; ++cnt ) { pData->curFacilityTypeData.AssignmentData[ cnt ].ubMaximumBreath = 100; pData->curFacilityTypeData.AssignmentData[ cnt ].ubMaximumMorale = 100; @@ -177,9 +175,7 @@ facilitytypeStartElementHandle(void *userData, const XML_Char *name, const XML_C strcmp(name, "ubTotalStaffLimit") == 0 || strcmp(name, "ubMilitiaTrainersAllowed") == 0 || - strcmp(name, "ubMobileMilitiaTrainersAllowed") == 0 || strcmp(name, "usMilitiaTraining") == 0 || - strcmp(name, "usMobileMilitiaTraining") == 0 || strcmp( name, "pmcentrypoint" ) == 0 )) { @@ -424,9 +420,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name) gFacilityTypes[pData->curIndex].ubTotalStaffLimit = pData->curFacilityTypeData.ubTotalStaffLimit; gFacilityTypes[pData->curIndex].ubMilitiaTrainersAllowed = pData->curFacilityTypeData.ubMilitiaTrainersAllowed; - gFacilityTypes[pData->curIndex].ubMobileMilitiaTrainersAllowed = pData->curFacilityTypeData.ubMobileMilitiaTrainersAllowed; gFacilityTypes[pData->curIndex].usMilitiaTraining = pData->curFacilityTypeData.usMilitiaTraining; - gFacilityTypes[pData->curIndex].usMobileMilitiaTraining = pData->curFacilityTypeData.usMobileMilitiaTraining; gFacilityTypes[pData->curIndex].usFacilityFlags = pData->curFacilityTypeData.usFacilityFlags; @@ -504,14 +498,12 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name) SGP_THROW(L"FacilityTypes.XML Error: A tag was encountered too early! Please make sure all tags are closed properly."); } } - // Set current Index. As long as it equals 0, the program is not writing any data to memory. else if(strcmp(name, "ubIndex") == 0) { pData->curElement = FACILITYTYPE_TYPE; pData->curIndex = (UINT8) atol(pData->szCharData); } - ////////////////////////////////////////////// // General facility data and militia effects @@ -523,7 +515,6 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name) MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curFacilityTypeData.szFacilityName, sizeof(pData->curFacilityTypeData.szFacilityName)/sizeof(pData->curFacilityTypeData.szFacilityName[0]) ); pData->curFacilityTypeData.szFacilityName[sizeof(pData->curFacilityTypeData.szFacilityName)/sizeof(pData->curFacilityTypeData.szFacilityName[0]) - 1] = '\0'; } - else if(strcmp(name, "szFacilityShortName") == 0) { pData->curElement = FACILITYTYPE_TYPE; @@ -531,34 +522,21 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name) MultiByteToWideChar( CP_UTF8, 0, pData->szCharData, -1, pData->curFacilityTypeData.szFacilityShortName, sizeof(pData->curFacilityTypeData.szFacilityShortName)/sizeof(pData->curFacilityTypeData.szFacilityShortName[0]) ); pData->curFacilityTypeData.szFacilityShortName[sizeof(pData->curFacilityTypeData.szFacilityShortName)/sizeof(pData->curFacilityTypeData.szFacilityShortName[0]) - 1] = '\0'; } - else if(strcmp(name, "ubTotalStaffLimit") == 0 ) { pData->curElement = FACILITYTYPE_TYPE; pData->curFacilityTypeData.ubTotalStaffLimit = (UINT8) atol(pData->szCharData); } - else if(strcmp(name, "ubMilitiaTrainersAllowed") == 0 ) { pData->curElement = FACILITYTYPE_TYPE; pData->curFacilityTypeData.ubMilitiaTrainersAllowed = (UINT8) atol(pData->szCharData); } - else if(strcmp(name, "ubMobileMilitiaTrainersAllowed") == 0 ) - { - pData->curElement = FACILITYTYPE_TYPE; - pData->curFacilityTypeData.ubMobileMilitiaTrainersAllowed = (UINT8) atol(pData->szCharData); - } else if(strcmp(name, "usMilitiaTraining") == 0 ) { pData->curElement = FACILITYTYPE_TYPE; pData->curFacilityTypeData.usMilitiaTraining = (UINT8) atol(pData->szCharData); } - else if(strcmp(name, "usMobileMilitiaTraining") == 0 ) - { - pData->curElement = FACILITYTYPE_TYPE; - pData->curFacilityTypeData.usMobileMilitiaTraining = (UINT8) atol(pData->szCharData); - } - else if ( strcmp( name, "pmcentrypoint" ) == 0 ) { pData->curElement = FACILITYTYPE_TYPE; diff --git a/Strategic/XML_Roaming.cpp b/Strategic/XML_Roaming.cpp deleted file mode 100644 index 3485b26f..00000000 --- a/Strategic/XML_Roaming.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#ifdef PRECOMPILEDHEADERS - #include "Strategic All.h" - #include "XML.h" -#else - #include "builddefines.h" - #include - #include "XML.h" - #include "expat.h" - #include "string.h" - #include "Campaign Types.h" - #include "FileMan.h" - #include "MemMan.h" - #include "Debug Control.h" -#endif - -#define MAX_CHAR_DATA_LENGTH 500 - -extern INT32 iRestrictedSectorArraySize; -extern UINT32 gRestrictMilitia[256]; - - -typedef enum -{ - ROAMING_ELEMENT_NONE = 0, - ROAMING_ELEMENT_RESTRICTED_SECTORS, - ROAMING_ELEMENT_SECTOR, -} ROAMING_PARSE_STAGE; - - - - -typedef struct -{ - UINT8 ubSectorID; - BOOLEAN fValidSector; -} RoamingInfo; - - -typedef struct -{ - ROAMING_PARSE_STAGE curElement; - CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1]; - RoamingInfo curRoamingInfo; - UINT32 uiSectorCount; - UINT32 currentDepth; - UINT32 maxReadDepth; -} RoamingParseData; - - -static void XMLCALL -RoamingStartElementHandle(void *userData, const XML_Char *name, const char **atts) -{ - RoamingParseData * pData = (RoamingParseData *) userData; - - if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? - { - - if(strcmp(name, "RESTRICTED_SECTORS") == 0 && pData->curElement == ROAMING_ELEMENT_NONE) - { - pData->curElement = ROAMING_ELEMENT_RESTRICTED_SECTORS; - pData->maxReadDepth++; //we are not skipping this element - } - - else if(strcmp(name, "SECTOR") == 0 && pData->curElement == ROAMING_ELEMENT_RESTRICTED_SECTORS) - { - pData->curElement = ROAMING_ELEMENT_SECTOR; - pData->maxReadDepth++; //we are not skipping this element - } - pData->szCharData[0] = '\0'; - } - - pData->currentDepth++; - -} - - - -static void XMLCALL -RoamingCharacterDataHandle(void *userData, const XML_Char *str, int len) -{ - RoamingParseData * pData = (RoamingParseData *) userData; - - if(pData->currentDepth <= pData->maxReadDepth && strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH) - strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData))); -} - - -static void XMLCALL -RoamingEndElementHandle(void *userData, const XML_Char *name) -{ - RoamingParseData * pData = (RoamingParseData *) userData; - - if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading - { - if(strcmp(name, "RESTRICTED_SECTORS") == 0 && pData->curElement == ROAMING_ELEMENT_RESTRICTED_SECTORS) - { - pData->curElement = ROAMING_ELEMENT_NONE; - iRestrictedSectorArraySize = pData->uiSectorCount; - } - //Kaiden: Code shamelessly stolen from lesh to accept sector Aliases - else if(strcmp(name, "SECTOR") == 0 && pData->curElement == ROAMING_ELEMENT_SECTOR) - { - UINT8 x, y; - pData->curElement = ROAMING_ELEMENT_RESTRICTED_SECTORS; - - y = (UINT8)pData->szCharData[0] & 0x1F; - x = (UINT8)atol(&pData->szCharData[1]); - if ( x > 0 && x <= 16 && y > 0 && y <= 16 ) - { - pData->curRoamingInfo.fValidSector = TRUE; - pData->curRoamingInfo.ubSectorID = SECTOR(x,y); - gRestrictMilitia[pData->uiSectorCount] = pData->curRoamingInfo.ubSectorID; - pData->uiSectorCount++; - } - else - { - pData->curRoamingInfo.fValidSector = FALSE; - } - } - pData->maxReadDepth--; - } - - pData->currentDepth--; -} - - -BOOLEAN ReadInRoamingInfo(STR fileName) -{ - HWFILE hFile; - UINT32 uiBytesRead; - UINT32 uiFSize; - CHAR8 * lpcBuffer; - XML_Parser parser = XML_ParserCreate(NULL); - - RoamingParseData pData; - - hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE ); - if ( !hFile ) - return( FALSE ); - - uiFSize = FileGetSize(hFile); - lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1); - - //Read in block - if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) ) - { - MemFree(lpcBuffer); - return( FALSE ); - } - - lpcBuffer[uiFSize] = 0; //add a null terminator - - FileClose( hFile ); - - - XML_SetElementHandler(parser, RoamingStartElementHandle, RoamingEndElementHandle); - XML_SetCharacterDataHandler(parser, RoamingCharacterDataHandle); - - - memset(&pData,0,sizeof(pData)); - XML_SetUserData(parser, &pData); - iRestrictedSectorArraySize = 0; - - if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) - { - CHAR8 errorBuf[511]; - sprintf(errorBuf, "XML Parser Error in RestrictedRoamingMilitia.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); - LiveMessage(errorBuf); - - MemFree(lpcBuffer); - return FALSE; - } - - MemFree(lpcBuffer); - - XML_ParserFree(parser); - - return TRUE; -} diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 1c3720dc..e5127999 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -2878,8 +2878,7 @@ void DrawCharacterInfo(INT16 sCharNumber) wcscpy(sString, pAttributeMenuStrings[pSoldier->bTrainStat]); } // train town? - // HEADROCK HAM 3.6: Draw for Mobile Trainers as well. - else if( pSoldier->bAssignment == TRAIN_TOWN || pSoldier->bAssignment == TRAIN_MOBILE ) + else if( pSoldier->bAssignment == TRAIN_TOWN ) { wcscpy(sString,pTownNames[GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ) ] ); } @@ -6192,11 +6191,6 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) ubProgress = SectorInfo[SECTOR(sMapX, sMapY)].ubMilitiaTrainingPercentDone; usMaxProgress = 100; } - else if ( pSoldier->bAssignment == TRAIN_MOBILE ) - { - ubProgress = SectorInfo[SECTOR(sMapX, sMapY)].ubMobileMilitiaTrainingPercentDone; - usMaxProgress = 100; - } else if ( pSoldier->bAssignment == TRAIN_SELF || pSoldier->bAssignment == TRAIN_BY_OTHER ) { @@ -8024,16 +8018,6 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { //activate autoresolve in prebattle interface. ActivatePreBattleRetreatAction(); } - // WANNE: Only allow when mobile militia is allowed! - else if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand ) - { - // only handle border button keyboard equivalents if the button is visible! - if ( !fShowMapInventoryPool ) - { - // toggle show mobile restrictions filter - ToggleMobileFilter(); - } - } break; case 's': if( fAlt ) @@ -9049,43 +9033,9 @@ void PollRightButtonInMapView( UINT32 *puiNewEvent ) else { if ( GetMouseMapXY( &sMapX, &sMapY ) ) - { - // HEADROCK HAM 4: Toggle Militia Restrictions manually. This occurs when the Mobile Restrictions - // view is turned on. Each click advances the sector's classification by 1. If max is reached, - // loops back to start. - // HEADROCK HAM 5: Whoops, disallow changing restrictions for sectors that are - // not accessible to militia to begin with. - //Moa: we should be able to change restrictions where ever the militia is potentially allowed to move. - // Able to change restriction if: - // Potentially allowed: - // - we are in mobile Restrictions view && we have RESTRICT_ROAMING = TRUE in ini && - // - ALLOW_MILITIA_MOVEMENT_THROUGH_EXPLORED_SECTORS = TRUE && we have liberated that sector at least once - // note that ALLOW_MILITIA_MOVEMENT_THROUGH_EXPLORED_SECTORS = TRUE does not overwrites any restrictions anymore it extends the region where restrictions are allowed, just like DynamicRestriction does - // - ALLOW_MILITIA_MOVEMENT_THROUGH_MINOR_CITIES = TRUE && it is a Minor Cities && we have liberated that citysector - // - DynamicRestrictions if set in ini (does not matter if visited or not) - //if ( fShowMobileRestrictionsFlag == TRUE && gDynamicRestrictMilitia[ SECTOR( sMapX, sMapY ) ] == TRUE) - if ( gusMapDisplayColourMode == MAP_DISPLAY_MOBILEMILITIARESTRICTIONS && gGameExternalOptions.gflimitedRoaming && - ( ( gGameExternalOptions.fUnrestrictVisited == TRUE && SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled ) - || ( gGameExternalOptions.fAllowMilitiaMoveThroughMinorCities && GetTownIdForSector( sMapX, sMapY ) > BLANK_SECTOR && !gfMilitiaAllowedInTown[GetTownIdForSector( sMapX, sMapY )] && SectorInfo[ SECTOR( sMapX, sMapY ) ].fSurfaceWasEverPlayerControlled ) - || ( gGameExternalOptions.fDynamicRestrictRoaming && gDynamicRestrictMilitia[ SECTOR( sMapX, sMapY ) ] == TRUE ) - ) ) - { - // Restrict more. - if ( gubManualRestrictMilitia[ SECTOR( sMapX, sMapY ) ] > MANUAL_MOBILE_NO_ENTER ) - { - gubManualRestrictMilitia[ SECTOR( sMapX, sMapY ) ]--; - } - else - { - // Wrap back to highest. - gubManualRestrictMilitia[ SECTOR( sMapX, sMapY ) ] = MANUAL_MOBILE_NO_RESTRICTION; - } - fMapPanelDirty = TRUE; - // Skip the rest of this function. - return; - } + { // don't change sectors if we've just done the militia restrictions thing. - else if( ( sSelMapX != sMapX ) || ( sSelMapY != sMapY ) ) + if( ( sSelMapX != sMapX ) || ( sSelMapY != sMapY ) ) { ChangeSelectedMapSector( sMapX, sMapY, ( INT8 )iCurrentMapSectorZ ); } diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index b941ef44..e7203b5f 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -109,16 +109,6 @@ BOOLEAN InitializeInvPanelCoordsVehicle( ); // HEADROCK HAM 3.6: Calculate daily cost for all mercs who have one. INT32 GetTotalContractExpenses ( void ); -// HEADROCK HAM 4: enumarate Manual Militia Restriction states -enum -{ - MANUAL_MOBILE_RESTRICTED, - MANUAL_MOBILE_NO_ENTER, - MANUAL_MOBILE_NO_LEAVE, - MANUAL_MOBILE_NO_RESTRICTION, - NUM_MANUAL_MOBILE_STATES, -}; - // Flugente: militia movement extern BOOLEAN fPlotForMilitia; extern UINT32 gMilitiaPlotStartSector; diff --git a/Strategic/strategic.cpp b/Strategic/strategic.cpp index 4d618a5f..10b94786 100644 --- a/Strategic/strategic.cpp +++ b/Strategic/strategic.cpp @@ -33,8 +33,6 @@ StrategicMapElement StrategicMap[MAP_WORLD_X*MAP_WORLD_Y]; extern BOOLEAN fReDrawFace; - - BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) { // add the guy to the dead list @@ -100,7 +98,6 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) return( TRUE ); } - void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) { INT32 cnt = 0; @@ -109,8 +106,7 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - - + // see if this was the friend of a living merc for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) { @@ -166,95 +162,3 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) } } - -BOOLEAN SetMilitiaMovementOrder(INT16 sX, INT16 sY, INT8 sZ, UINT32 dir) -{ - // militia can only move on the surface - if ( sZ ) - return FALSE; - - // militia needs to be here... - if ( !NumNonPlayerTeamMembersInSector( sX, sY, MILITIA_TEAM ) ) - return FALSE; - - // in order to give movement orders, we need a merc to staff a military headquarter - if ( !MercStaffsMilitaryHQ() ) - return FALSE; - - INT16 newX = sX; - INT16 newY = sY; - UINT8 movetype = THROUGH_STRATEGIC_MOVE; - - switch (dir) - { - case MILITIA_MOVE_NORTH: - --newY; - movetype = NORTH_STRATEGIC_MOVE; - break; - - case MILITIA_MOVE_WEST: - --newX; - movetype = WEST_STRATEGIC_MOVE; - break; - - case MILITIA_MOVE_EAST: - ++newX; - movetype = EAST_STRATEGIC_MOVE; - break; - - case MILITIA_MOVE_SOUTH: - ++newY; - movetype = SOUTH_STRATEGIC_MOVE; - break; - - default: - return FALSE; - break; - } - - if ( gGameExternalOptions.gflimitedRoaming && !IsSectorRoamingAllowed( SECTOR(newX, newY) ) ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gpStrategicString[STR_MILITIAMOVEMENT_NO_LIMITEDROAMING] ); - return FALSE; - } - - UINT8 ubTraverseType = SectorInfo[ SECTOR(sX, sY) ].ubTraversability[ movetype ]; - - if( ubTraverseType == GROUNDBARRIER || ubTraverseType == EDGEOFWORLD ) - return FALSE; - - UINT32 ubTraverseMod = 0; - - switch( ubTraverseType ) - { - case TOWN: ubTraverseMod = 1780;break; - case ROAD: ubTraverseMod = 100;break; - case PLAINS: ubTraverseMod = 85; break; - case SAND: ubTraverseMod = 50; break; - case SPARSE: ubTraverseMod = 70; break; - case DENSE: ubTraverseMod = 60; break; - case SWAMP: ubTraverseMod = 35; break; - case WATER: ubTraverseMod = 25; break; - case HILLS: ubTraverseMod = 50; break; - case NS_RIVER: ubTraverseMod = 25; break; - case EW_RIVER: ubTraverseMod = 25; break; - } - - if( ubTraverseMod ) - { - UINT32 timeneeded = FOOT_TRAVEL_TIME * 100 / ubTraverseMod; - - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sX, sY ) ] ); - - StrategicMap[ sX + ( sY * MAP_WORLD_X ) ].usFlags &= ~MILITIA_MOVE_ALLDIRS; - StrategicMap[ sX + ( sY * MAP_WORLD_X ) ].usFlags |= dir; - - AddStrategicEvent( EVENT_MILITIA_MOVEMENT_ORDER, GetWorldTotalMin() + timeneeded, SECTOR( sX, sY ) ); - - fMapPanelDirty = TRUE; - - return TRUE; - } - - return FALSE; -} \ No newline at end of file diff --git a/Strategic/strategic.h b/Strategic/strategic.h index 00af9255..082b3f95 100644 --- a/Strategic/strategic.h +++ b/Strategic/strategic.h @@ -65,6 +65,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ); BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ); -BOOLEAN SetMilitiaMovementOrder(INT16 sX, INT16 sY, INT8 sZ, UINT32 dir); - #endif \ No newline at end of file diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index c5ffc22c..8f08ca4d 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -714,7 +714,7 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta //Madd: option to make mercs quiet during training / doctoring / repairing if ( ((pSoldier->bAssignment == TRAIN_BY_OTHER || pSoldier->bAssignment == TRAIN_TEAMMATE || pSoldier->bAssignment == TRAIN_SELF || - pSoldier->bAssignment == FACILITY_STAFF || pSoldier->bAssignment == TRAIN_TOWN || pSoldier->bAssignment == TRAIN_MOBILE + pSoldier->bAssignment == FACILITY_STAFF || pSoldier->bAssignment == TRAIN_TOWN || pSoldier->bAssignment == TRAIN_WORKERS || pSoldier->bAssignment == DRILL_MILITIA ) && !gGameSettings.fOptions[TOPTION_QUIET_TRAINING]) || (IS_REPAIR(pSoldier->bAssignment) && !gGameSettings.fOptions[TOPTION_QUIET_REPAIRING]) || diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index a1637fab..f61613dd 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -2311,8 +2311,6 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case TRAIN_SELF: case TRAIN_TOWN: - // HEADROCK HAM 3.6: New assignment. - case TRAIN_MOBILE: case TRAIN_TEAMMATE: case TRAIN_BY_OTHER: case TRAIN_WORKERS: @@ -2331,7 +2329,6 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sPtsAvailable = GetSoldierStudentPts( MercPtrs[ pFace->ubSoldierID ], MercPtrs[ pFace->ubSoldierID ]->bTrainStat, &usMaximumPts ); break; case( TRAIN_TOWN ): - case( TRAIN_MOBILE ): case DRILL_MILITIA: sPtsAvailable = GetTownTrainPtsForCharacter( MercPtrs[ pFace->ubSoldierID ], &usMaximumPts ); // divide both amounts by 10 to make the displayed numbers a little more user-palatable (smaller) diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index c5942f97..7961df14 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -60,10 +60,8 @@ INT32 ghMilitiaControlBox = -1; INT16 gsMilitiaControlBoxesX, gsMilitiaControlBoxesY; //INT16 gsTalkToAllBoxesX, gsTalkToAllBoxesY; - // assignment menu mouse regions MOUSE_REGION gMilitiaControlMenuRegion[ MAX_MILCON_STRING_COUNT ]; -//MOUSE_REGION gTalkToAllMenuRegion[ MAX_TRAIN_STRING_COUNT ]; MOUSE_REGION gMilitiaControlScreenMaskRegion; diff --git a/Tactical/XML.h b/Tactical/XML.h index ef237c23..beeee8bd 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -156,14 +156,12 @@ typedef PARSE_STAGE; #define ALTSECTORSFILENAME "Map\\AltSectors.xml" #define SAMSITESFILENAME "Map\\SamSites.xml" #define HELISITESFILENAME "Map\\HeliSites.xml" -#define ROAMINGMILITIAFILENAME "Map\\RestrictedRoamingMilitia.xml" #define EXTRAITEMSFILENAME "Map\\A9_0_ExtraItems" // ".xml" will be added @runtime #define EXTRAITEMSFILENAME2 "Map\\A11_0_ExtraItems" // ".xml" will be added @runtime #define SHIPPINGDESTINATIONSFILENAME "Map\\ShippingDestinations.xml" #define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml" #define DELIVERYMETHODSFILENAME "Map\\DeliveryMethods.xml" #define SECTORFACILITIESFILENAME "Map\\Facilities.xml" -#define DYNAMICROAMINGFILENAME "Map\\DynamicRestrictions.xml" #define FACILITYTYPESFILENAME "Map\\FacilityTypes.xml" #define SECTORNAMESFILENAME "Map\\SectorNames.xml" #define COOLNESSBYSECTORFILENAME "Map\\CoolnessBySector.xml" @@ -427,9 +425,6 @@ extern BOOLEAN WriteInPatrolInfo(STR fileName); extern BOOLEAN ReadInArmyCompositionInfo(STR fileName); extern BOOLEAN WriteInArmyCompositionInfo(STR fileName); -//Kaiden: Roaming Militia Restricted Sectors List -extern BOOLEAN ReadInRoamingInfo(STR filename); - // Dealtar: New shipping system XMLs extern BOOLEAN ReadInShippingDestinations(STR fileName, BOOLEAN localizedVersion); extern BOOLEAN ReadInDeliveryMethods(STR fileName); @@ -459,9 +454,6 @@ extern BOOLEAN ReadInFuneralLocations(STR fileName); // HEADROCK HAM 3.4: Sector Facility Locations extern BOOLEAN ReadInSectorFacilities(STR fileName); -// HEADROCK HAM 3.4: Dynamic Roaming Restrictions -extern BOOLEAN ReadInDynamicRoamingRestrictions(STR fileName); - // HEADROCK HAM 3.5: Facility Types and bonuses extern BOOLEAN ReadInFacilityTypes(STR fileName, BOOLEAN localizedVersion); diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index e165e044..5123cfea 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -1101,8 +1101,62 @@ profileEndElementHandle(void *userData, const XML_Char *name) pData->currentDepth--; } +// Flugente hack: analyze profiles and print out the result +#include // added by Flugente for vfs-stuff +#include +#include +extern STR16 gzMercSkillTextNew[]; +void AnalyzeProfiles() +{ + INT32 relevantmerccntr = 0; + INT32 traitcntr[NUM_SKILLTRAITS_NT] = { 0 }; + INT32 experttraitcntr[NUM_SKILLTRAITS_NT] = { 0 }; + + for ( int i = 0; i < NUM_PROFILES; ++i ) + { + // we are only interested in AIM/MERC/RPCs + if ( i != NO_PROFILE && + ( tempProfiles[i].Type == 1 || tempProfiles[i].Type == 2 || tempProfiles[i].Type == 3 ) + ) + { + ++relevantmerccntr; + + INT32 perstraitcntr[NUM_SKILLTRAITS_NT] = { 0 }; + + perstraitcntr[tempProfiles[i].bNewSkillTrait1] += 1; + perstraitcntr[tempProfiles[i].bNewSkillTrait2] += 1; + perstraitcntr[tempProfiles[i].bNewSkillTrait3] += 1; + + for ( int j = 0; j < NUM_SKILLTRAITS_NT; ++j ) + { + traitcntr[j] += perstraitcntr[j]; + + if ( perstraitcntr[j] > 1 ) + experttraitcntr[j] += 1; + } + } + } + + // write stuff + { + std::stringstream settings; + const char endl[] = "\r\n"; + + settings << "AIM + MERC + RPC: " << relevantmerccntr << endl; + settings << endl; + settings << "Trait Total Single Experts" << endl; + + for ( int j = 0; j < NUM_SKILLTRAITS_NT; ++j ) + { + settings << j << " " << traitcntr[j] << " " << traitcntr[j] - 2 * experttraitcntr[j] << " " << experttraitcntr[j] << endl; + } + + vfs::COpenWriteFile wfile( "MercProfileAnalysis.txt", true, true ); + wfile->write( settings.str().c_str(), settings.str().length() ); + } +} BOOLEAN ReadInMercProfiles(STR fileName, BOOLEAN localizedVersion) { @@ -1164,6 +1218,9 @@ BOOLEAN ReadInMercProfiles(STR fileName, BOOLEAN localizedVersion) XML_ParserFree(parser); + // Flugente hack: analyze profiles and print out the result + //AnalyzeProfiles(); + return( TRUE ); } diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 7e637ffc..6e5d7172 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -2993,7 +2993,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"锻炼", // train yourself - L"游击队", // L"Mobile Militia", //ham3.6 L"培训工人", //L"Train workers", L"教练", // train your teammates L"学员", // be trained by an instructor @@ -4240,7 +4239,6 @@ STR16 pwTownInfoStrings[] = L"等级", // the training level of civilians in this town L"民兵训练度", // 10 // state of civilian training in town L"民兵", // the state of the trained civilians in the town - L"巡逻民兵", // L"Mobile Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // Flugente: prisoner texts L"囚犯", //L"Prisoners", @@ -4356,7 +4354,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"显示领空 (|A)", L"显示物品 (|I)", L"显示民兵和敌人 (|Z)", - L"显示民兵移动 (|R)", // HEADROCK HAM 4: Mobile Restrictions Button L"显示疾病消息", //L"Show Disease Data", L"显示天气", // L"Show Weather", }; @@ -6237,10 +6234,7 @@ STR16 zMarksMapScreenText[] = L"佣兵有一份限时的合同。", //"Merc has a finite contract.", L"佣兵的合同没投保", //"Merc's contract is not insured", L"地图概况",//"Map Overview", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"你目前没有民兵。当你招募了一些后再返回这个显示模式。", - L"这个视图显示你的移动民兵能去和不能去哪里。 灰色 = 移动民兵拒绝来这里. 红色 = 移动民兵能来这里, 但是你告诉他们不要这样. 黄色 = 移动民兵能进入这个区域, 但是不能离开. 绿色 = 移动民兵可以自由的进入这里. 右击一个绿色/黄色区域循环它的行为.", - + // Flugente: disease texts describing what a map view does //文本描述疾病查看地图并做翻译。 L"这个视图会展示出哪个地区爆发了瘟疫,这个数字表明,平均每个人的感染程度,颜色表示它的范围。 灰色=无病。 绿色到红色=不断升级的感染程度。", //L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6262,25 +6256,23 @@ STR16 pMilitiaConfirmStrings[] = L"同意支付吗?", L"你无法支付。", L"继续在%s (%s %d)训练民兵吗?", + L"花费$", L"( Y/N )", // abbreviated yes/no L"", // unused L"在%d地区训练民兵将花费$%d。%s", + L"你无法支付$%d以供在这里训练民兵。", L"%s的忠诚度必须达到%d以上方可训练民兵。", L"你不能在%s训练民兵了。", - L"你无法支付$%d以供在这里训练巡逻民兵。", // L"You cannot afford the $%d to train mobile militia here.", // HEADROCK HAM 3.6: Mobile Militia - L"继续在%s (%s %d)训练巡逻民兵吗?", // L"Continue training mobile militia in %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia - L"在%d地区训练巡逻民兵将花费$%d。%s", // L"Training mobile militia in %d sectors will cost $ %d. %s", // HEADROCK HAM 3.6: Mobile Militia - L"训练一队民兵要花费$", // L"Training a squad of mobile militia will cost $", // HEADROCK HAM 3.6: Mobile Militia - L"你无法训练更多的游击队因为已经达到上限(%d/%d)。你必须先%s才能训练更多。", //L"You cannot train more mobile militia because the maximum is reached (%d/%d). You have to %s first in order to train more.", L"解放更多城镇分区", //L"liberate more town sectors", + L"解放新的城镇分区", //L"liberate new town sectors", L"解放更多城镇", //L"liberate more towns", L"恢复失去的进度", //L"regain your lost progress", L"继续进度", //L"progress further", + L"雇佣更多反抗军", //L"recruit more rebels", - L"民兵队长通报你,有%d名民兵在%s分区遭遇敌军时逃跑了。", //L"The militia team leader has to inform you that %d fellow have deserted facing enemy in sector %s.", }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 672d13c3..db51b372 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2994,7 +2994,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Oefenen", // train yourself - L"Mobile Militia", // TODO.Translate L"Train workers", // TODO.Translate L"Trainer", // train your teammates L"Student", // be trained by an instructor @@ -4242,7 +4241,6 @@ STR16 pwTownInfoStrings[] = L"Niveau", // the training level of civilians in this town L"Training Burgers", // 10 // state of civilian training in town L"Militie", // the state of the trained civilians in the town - L"Mobile Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // TODO.Translate // Flugente: prisoner texts L"Prisoners", @@ -4359,7 +4357,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Toon Luchtruim (|A)", L"Toon |Items", L"Toon Milities & Vijanden (|Z)", - L"Show Mobile Militia |Restrictions", // HEADROCK HAM 4: Mobile Restrictions Button // TODO.Translate L"Show Disease Data", // TODO.Translate L"Show Weather", // TODO.Translate }; @@ -6245,10 +6242,7 @@ STR16 zMarksMapScreenText[] = L"Huurling heeft eindig contract.", L"Contract Huurling is niet verzekerd", L"Map Overview", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"You currently have no Mobile Militia. Return to this view mode once you've recruited some.", - L"This view shows where your Mobile Militia can and cannot go. GREY = Mobile Militia refuse to go here. RED = Mobile Militia can go here, but you've told them not to. YELLOW = Mobile Militia can enter this sector, but not leave. GREEN = Mobile Militia can go here freely. Right click a Green/Yellow sector to cycle its behavior.", - + // Flugente: disease texts describing what a map view does TODO.Translate L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6270,25 +6264,23 @@ STR16 pMilitiaConfirmStrings[] = L"Uitgave goedkeuren?", // asking player if they wish to pay the amount requested L"je kunt dit niet betalen.", // telling the player they can't afford to train this town L"Doorgaan met militie trainen %s (%s %d)?", // continue training this town? + L"Kosten $", // the cost in dollars to train militia L"( J/N )", // abbreviated yes/no L"", // unused L"Stadsmilities trainen in %d sectors kost $ %d. %s", // cost to train sveral sectors at once + L"Je kunt de $%d niet betalen om de stadsmilitie hier te trainen.", L"%s heeft een loyaliteit nodig van %d procent om door te gaan met milities trainen.", L"Je kunt de militie in %s niet meer trainen.", - L"You cannot afford the $%d to train mobile militia here.", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Continue training mobile militia in %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Training mobile militia in %d sectors will cost $ %d. %s", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Training a squad of mobile militia will cost $", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"You cannot train more mobile militia because the maximum is reached (%d/%d). You have to %s first in order to train more.", // TODO.Translate L"liberate more town sectors", // TODO.Translate + L"liberate new town sectors", // TODO.Translate L"liberate more towns", // TODO.Translate L"regain your lost progress", // TODO.Translate L"progress further", // TODO.Translate + L"recruit more rebels", // TODO.Translate - L"The militia team leader has to inform you that %d fellow have deserted facing enemy in sector %s.", // TODO.Translate }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 823cbadd..cf42df85 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2993,7 +2993,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Practice", // train yourself - L"Mobile Militia", L"Train workers", L"Trainer", // train your teammates L"Student", // be trained by an instructor @@ -4240,7 +4239,6 @@ STR16 pwTownInfoStrings[] = L"Level", // the training level of civilians in this town L"Civilian Training", // 10 // state of civilian training in town L"Militia", // the state of the trained civilians in the town - L"Mobile Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // Flugente: prisoner texts L"Prisoners", @@ -4357,7 +4355,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Show |Airspace", L"Show |Items", L"Show Militia & Enemies (|Z)", - L"Show Mobile Militia |Restrictions", // HEADROCK HAM 4: Mobile Restrictions Button L"Show Disease Data", L"Show Weather", }; @@ -6238,9 +6235,6 @@ STR16 zMarksMapScreenText[] = L"Merc has a finite contract.", L"Merc's contract is not insured", L"Map Overview", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"You currently have no Mobile Militia. Return to this view mode once you've recruited some.", - L"This view shows where your Mobile Militia can and cannot go. GREY = Mobile Militia refuse to go here. RED = Mobile Militia can go here, but you've told them not to. YELLOW = Mobile Militia can enter this sector, but not leave. GREEN = Mobile Militia can go here freely. Right click a Green/Yellow sector to cycle its behavior.", // Flugente: disease texts describing what a map view does L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6263,25 +6257,23 @@ STR16 pMilitiaConfirmStrings[] = L"Approve expenditure?", // asking player if they wish to pay the amount requested L"You can't afford it.", // telling the player they can't afford to train this town L"Continue training militia in %s (%s %d)?", // continue training this town? + L"Cost $", // the cost in dollars to train militia L"( Y/N )", // abbreviated yes/no L"", // unused L"Training town militia in %d sectors will cost $ %d. %s", // cost to train sveral sectors at once + L"You cannot afford the $%d to train town militia here.", L"%s needs a loyalty of %d percent for you to be able to continue training militia.", - L"You cannot train the militia in %s any further.", - L"You cannot afford the $%d to train mobile militia here.", // HEADROCK HAM 3.6: Mobile Militia - L"Continue training mobile militia in %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia - L"Training mobile militia in %d sectors will cost $ %d. %s", // HEADROCK HAM 3.6: Mobile Militia - L"Training a squad of mobile militia will cost $", // HEADROCK HAM 3.6: Mobile Militia - L"You cannot train more mobile militia because the maximum is reached (%d/%d). You have to %s first in order to train more.", //Moa: maximum number mobile militia (15) + L"You cannot train the militia in %s any further.", L"liberate more town sectors", + L"liberate new town sectors", L"liberate more towns", L"regain your lost progress", L"progress further", + L"recruit more rebels", - L"The militia team leader has to inform you that %d fellow have deserted facing enemy in sector %s.", //Moa: mobile deserted (22) }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 83e843b8..f58c887b 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -3001,7 +3001,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Formation", // train yourself - L"Milice mobile", L"Train workers", // TODO.Translate L"Entraîneur", // train your teammates L"Élève", // be trained by an instructor @@ -4246,7 +4245,6 @@ STR16 pwTownInfoStrings[] = L"Niveau ", // the training level of civilians in this town L"Formation ", // 10 // state of civilian training in town L"Milice ", // the state of the trained civilians in the town - L"Formation mobile ", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // Flugente: prisoner texts // TODO.Translate L"Prisonnier ", @@ -4363,7 +4361,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Espace aérien (|A)", L"Objets (|I)", L"Milice & Ennemis (|Z)", - L"Montrer la milice mobile |Restrictions", // HEADROCK HAM 4: Mobile Restrictions Button L"Show Disease Data", // TODO.Translate L"Show Weather", // TODO.Translate }; @@ -6250,10 +6247,7 @@ STR16 zMarksMapScreenText[] = L"Le mercenaire a un contrat déterminé.", L"Ce mercenaire n'est pas assuré.", L"Écran carte", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"Vous n'avez actuellement aucune milice mobile. Retournez à ce mode du vue quand vous en aurez recruté.", - L"Cette vue montre où votre milice mobile peut aller ou pas. Gris = La milice mobile refuse d'y aller. ROUGE = La milice mobile peut y aller, mais vous avez dit de ne pas y aller. JAUNE = La milice mobile peut entrer dans ce secteur, mais ne peut pas en sortir. VERT = la milice mobile peut y aller librement. Clic droit sur un secteur vert/jaune/rouge pour changer de couleur.", - + // Flugente: disease texts describing what a map view does TODO.Translate L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6275,25 +6269,23 @@ STR16 pMilitiaConfirmStrings[] = L"Êtes-vous d'accord ?", // asking player if they wish to pay the amount requested L"Vous n'en avez pas les moyens.", // telling the player they can't afford to train this town L"Voulez-vous poursuivre l'entraînement de la milice à %s (%s %d) ?", // continue training this town? + L"Coût $ ", // the cost in dollars to train militia L"(O/N)", // abbreviated oui/non L"", // unused L"L'entraînement des milices dans %d secteurs vous coûtera %d $. %s", // cost to train sveral sectors at once + L"Vous ne pouvez pas payer les %d $ nécessaires à l'entraînement.", L"Vous ne pouvez poursuivre l'entraînement de la milice à %s que si cette ville est à niveau de loyauté de %d pour cent.", L"Vous ne pouvez plus entraîner de milice à %s.", - L"Yous ne pouvez pas payer les %d $ nécessaires à l'entraînement de la milice mobile.", // HEADROCK HAM 3.6: Mobile Militia - L"Voulez-vous poursuivre l'entraînement de la milice mobile à %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia - L"L'entraînement des milices mobiles dans %d secteurs vous coûtera %d $. %s", // HEADROCK HAM 3.6: Mobile Militia - L"L'entraînement de la milice mobile vous coûtera $ ", // HEADROCK HAM 3.6: Mobile Militia - L"Vous ne pouvez plus former de milice mobile, car le maximum est atteint (%d/%d). Vous devez d'abord %s pour continuer.", L"libérer plus de secteurs d'une ville", + L"libérer de nouveaux secteurs d'une ville", L"libérer plus de villes", L"reprendre vos secteurs perdus", L"progresser dans votre avancée", + L"recruter plus de rebelles", - L"Le chef de la milice informe que %d compagnon(s) ont fui face à l'ennemi dans le secteur %s.", }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 2bc1b131..ea613763 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -2997,7 +2997,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Üben", // train yourself - L"Mobile Miliz", L"Train workers", // TODO.Translate L"Trainer", // train your teammates L"Rekrut", // be trained by an instructor @@ -4240,7 +4239,6 @@ STR16 pwTownInfoStrings[] = L"Level", // the training level of civilians in this town L"Zivilistentraining", // 10 // state of civilian training in town L"Miliz", // the state of the trained civilians in the town - L"Mobile M. Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // Flugente: prisoner texts L"Gefangene", @@ -4349,9 +4347,8 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Luftr|aum zeigen", L"Gegenstände zeigen (|I)", L"Mili|z & Feinde zeigen", - L"Zeige Mobile Miliz Begrenzungen (|R)", // HEADROCK HAM 4: Mobile Restrictions Button L"Show Disease Data", // TODO.Translate - L"Show Weather", // TODO.Translate + L"Zeige Wetter", }; STR16 pMapScreenInvenButtonHelpText[] = @@ -6090,10 +6087,7 @@ STR16 zMarksMapScreenText[] = L"Söldner hat begrenzten Vertrag.", L"Vertrag des Söldners beinhaltet keine Versicherung.", L"Kartenübersicht", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"Sie haben derzeit keine Mobile Miliz. Rekrutieren Sie einige Milizen und kehren Sie zurück zu dieser Ansicht.", - L"Diese Ansicht zeigt Ihnen, wo Ihre Mobile Miliz ins feindliche Gebiet vorrücken kann. GRAU = Mobile Miliz verweigern hier vorzurücken. ROT = Mobile Miliz kann hier vorrücken, aber Sie haben den Befehl nicht gegeben. GELB = Mobile Miliz kann in den Sektor vorrücken, aber nicht verlassen. GRÜN = Mobile Miliz kann sich hier frei bewegen. Rechtsklick auf einen GRÜNEN / GELBEN Bereich um das Verhalten der Miliz zu ändern.", - + // Flugente: disease texts describing what a map view does TODO.Translate L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6114,25 +6108,23 @@ STR16 pMilitiaConfirmStrings[] = L"Ausgabe genehmigen?", // asking player if they wish to pay the amount requested L"Sie haben nicht genug Geld.", // telling the player they can't afford to train this town L"Miliz in %s (%s %d) weitertrainieren?", // continue training this town? + L"Preis $", // the cost in dollars to train militia L"( J/N )", // abbreviated yes/no L"Miliz auf dem Raketenstützpunkt im Sektor %s (%s %d) weitertrainieren?", // continue trainign militia in SAM site sector L"Milizen in %d Sektoren zu trainieren kostet $ %d. %s", // cost to train sveral sectors at once + L"Sie können sich keine $%d für die Miliz hier leisten.", L"%s benötigt eine Loyalität von %d Prozent, um mit dem Milizen-Training fortzufahren.", L"Sie können die Miliz in %s nicht mehr trainieren.", - L"Sie können sich keine $%d für mobile Miliz hier leisten.", // HEADROCK HAM 3.6: Mobile Militia - L"Mobile Milizen in %s (%s %d) weitertrainieren?", // HEADROCK HAM 3.6: Mobile Militia - L"Mobile Milizen in %d Sektoren zu trainieren kostet $ %d. %s", // HEADROCK HAM 3.6: Mobile Militia - L"Eine mobile Milizeinheit für diese Stadt zu trainieren kostet $", // HEADROCK HAM 3.6: Mobile Militia - L"Sie können keine weiteren mobilen Milizen ausbilden, da das Maximum erreicht wurde (%d/%d). Sie müssen zunächst %s um weitere zu trainieren.", L"weitere Stadtteile befreien", + L"neue Stadtteile befreien", L"mehr Städte erobern", L"den verlorenen Fortschritt wieder aufholen", L"weiter fortschreiten", + L"mehr Rebellen rekrutieren", - L"Der Miliztruppführer muss Sie leider darüber informieren, dass %d Mitstreiter im Angesicht des Feindes desertierten im Sektor %s.", }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 1dad9dad..67459df2 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2988,8 +2988,7 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { - L"Allenati", // train yourself - L"Mobile Militia", // TODO.Translate + L"Allenati", // train yourself L"Train workers", // TODO.Translate L"Allenatore", // train your teammates L"Studente", // be trained by an instructor @@ -4236,7 +4235,6 @@ STR16 pwTownInfoStrings[] = L"Livello", // the training level of civilians in this town L"addestramento civili", // 10 // state of civilian training in town L"Esercito", // the state of the trained civilians in the town - L"Mobile Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // TODO.Translate // Flugente: prisoner texts // TODO.Translate L"Prisoners", @@ -4353,7 +4351,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Mostra spazio |aereo", L"Mostra oggett|i", L"Mostra esercito & nemici (|Z)", - L"Show Mobile Militia |Restrictions", // HEADROCK HAM 4: Mobile Restrictions Button // TODO.Translate L"Show Disease Data", // TODO.Translate L"Show Weather", // TODO.Translate }; @@ -6228,10 +6225,7 @@ STR16 zMarksMapScreenText[] = L"%s è pieno di soldati.", L"Il mercenario ha un contratto a tempo determinato.", L"Il contratto del mercenario non è assicurato", - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"You currently have no Mobile Militia. Return to this view mode once you've recruited some.", - L"This view shows where your Mobile Militia can and cannot go. GREY = Mobile Militia refuse to go here. RED = Mobile Militia can go here, but you've told them not to. YELLOW = Mobile Militia can enter this sector, but not leave. GREEN = Mobile Militia can go here freely. Right click a Green/Yellow sector to cycle its behavior.", - + // Flugente: disease texts describing what a map view does TODO.Translate L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6253,25 +6247,23 @@ STR16 pMilitiaConfirmStrings[] = L"Approvate la spesa?", // asking player if they wish to pay the amount requested L"Non potete permettervelo.", // telling the player they can't afford to train this town L"Continuate ad aeddestrare i soldati in %s (%s %d)?", // continue training this town? + L"Costo $", // the cost in dollars to train militia L"(S/N)", // abbreviated yes/no L"", // unused L"Addestrare l'esrecito cittadino nei settori di %d costerà $ %d. %s", // cost to train sveral sectors at once + L"Non potete permettervi il $%d per addestrare l'esercito cittadino qui.", L"%s ha bisogno di una percentuale di %d affinché possiate continuare ad addestrare i soldati.", L"Non potete più addestrare i soldati a %s.", - L"You cannot afford the $%d to train mobile militia here.", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Continue training mobile militia in %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Training mobile militia in %d sectors will cost $ %d. %s", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"Training a squad of mobile militia will cost $", // HEADROCK HAM 3.6: Mobile Militia // TODO.Translate - L"You cannot train more mobile militia because the maximum is reached (%d/%d). You have to %s first in order to train more.", // TODO.Translate L"liberate more town sectors", // TODO.Translate + L"liberate new town sectors", // TODO.Translate L"liberate more towns", // TODO.Translate L"regain your lost progress", // TODO.Translate L"progress further", // TODO.Translate + L"recruit more rebels", // TODO.Translate - L"The militia team leader has to inform you that %d fellow have deserted facing enemy in sector %s.", // TODO.Translate }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 976e86f7..41524415 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2999,7 +2999,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Praktyka", // train yourself - L"Mobile Militia", // TODO.Translate L"Train workers", // TODO.Translate L"Instruktor", // train your teammates L"Uczeń", // be trained by an instructor @@ -4247,7 +4246,6 @@ STR16 pwTownInfoStrings[] = L"Poziom", // the training level of civilians in this town L"Szkolenie cywili", // 10 // state of civilian training in town L"Samoobrona", // the state of the trained civilians in the town - L"Mobile Training", // HEADROCK HAM 3.6: The stat of Mobile militia training in town // TODO.Translate // Flugente: prisoner texts // TODO.Translate L"Prisoners", @@ -4364,7 +4362,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Pokaż przestrzeń powietrzną (|A)", L"Pokaż przedmioty (|I)", L"Pokaż samoobronę i wrogów (|Z)", - L"Show Mobile Militia |Restrictions", // HEADROCK HAM 4: Mobile Restrictions Button // TODO.Translate L"Show Disease Data", // TODO.Translate L"Show Weather", // TODO.Translate }; @@ -6246,10 +6243,7 @@ STR16 zMarksMapScreenText[] = L"Najemnik ma kontrakt na określony czas.", L"Kontrakt najemnika nie jest ubezpieczony", L"Mapa", // 24 - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"You currently have no Mobile Militia. Return to this view mode once you've recruited some.", - L"This view shows where your Mobile Militia can and cannot go. GREY = Mobile Militia refuse to go here. RED = Mobile Militia can go here, but you've told them not to. YELLOW = Mobile Militia can enter this sector, but not leave. GREEN = Mobile Militia can go here freely. Right click a Green/Yellow sector to cycle its behavior.", - + // Flugente: disease texts describing what a map view does TODO.Translate L"This view shows in which sectors disease has broken out. The number indicates the mean magnitude of infection per person, the colour indicates how widespread it is. GREY= No disease known of. GREEN to RED = escalating levels of infection.", @@ -6271,25 +6265,23 @@ STR16 pMilitiaConfirmStrings[] = L"Zatwierdzasz wydatek?", // asking player if they wish to pay the amount requested L"Nie stać cię na to.", // telling the player they can't afford to train this town L"Kontynuować szkolenie samoobrony w - %s (%s %d)?", // continue training this town? + L"Koszt $", // the cost in dollars to train militia L"( T/N )", // abbreviated yes/no L"", // unused L"Szkolenie samoobrony w %d sektorach będzie kosztowało $ %d. %s", // cost to train sveral sectors at once + L"Nie masz %d$, aby wyszkolić samoobronę w tym mieście.", L"%s musi mieć %d% lojalności, aby można było kontynuować szkolenie samoobrony.", L"Nie możesz już dłużej szkolić samoobrony w mieście %s.", - L"Nie masz %d$ i nie możesz trenować tutaj ruchomej samoobrony.", // HEADROCK HAM 3.6: Mobile Militia - L"Kontynuuj trening ruchomej samoobrony w %s (%s %d)?", // HEADROCK HAM 3.6: Mobile Militia - L"Trenowanie ruchomej samoobrony w %d sektorach będzie kosztować %d$. %s", // HEADROCK HAM 3.6: Mobile Militia - L"Trenowanie ruchomej samoobrony będzie kosztować $", // HEADROCK HAM 3.6: Mobile Militia - L"You cannot train more mobile militia because the maximum is reached (%d/%d). You have to %s first in order to train more.", // TODO.Translate L"liberate more town sectors", // TODO.Translate + L"liberate new town sectors", // TODO.Translate L"liberate more towns", // TODO.Translate L"regain your lost progress", // TODO.Translate L"progress further", // TODO.Translate + L"recruit more rebels", // TODO.Translate - L"The militia team leader has to inform you that %d fellow have deserted facing enemy in sector %s.", // TODO.Translate }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index ef8692f9..c4c34991 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2993,7 +2993,6 @@ STR16 pAttributeMenuStrings[] = STR16 pTrainingMenuStrings[] = { L"Практика", // train yourself - L"Патрульные", L"Рабочие", // Train workers L"Тренер", // train your teammates L"Ученик", // be trained by an instructor @@ -4240,7 +4239,6 @@ STR16 pwTownInfoStrings[] = L"Уровень", // the training level of civilians in this town L"Тренировка ополчения", // 10 // state of civilian training in town L"Ополчение", // the state of the trained civilians in the town - L"Тренировка патруля", // HEADROCK HAM 3.6: The stat of Mobile militia training in town //Mobile Training // Flugente: prisoner texts L"Заключенные", @@ -4357,7 +4355,6 @@ STR16 pMapScreenBorderButtonHelpText[] = L"Карта воздушного пространства (|A)", L"Вещи (|I)", L"Ополчение и враги (|Z)", - L"Патруль ополчения (|R)", // HEADROCK HAM 4: Mobile Restrictions Button L"Очаги заболеваний", L"Погода", }; @@ -6238,10 +6235,7 @@ STR16 zMarksMapScreenText[] = L"У наёмника ограниченный контракт.", L"Контракт наёмника не застрахован", L"Стратегическая карта", - // HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view. - L"Сейчас у вас нет патрульных групп. Включите этот режим в следующий раз, когда наберёте их.", - L"Здесь показано, куда может пройти патруль, и куда нет. СЕРЫЙ = не пойдут туда. КРАСНЫЙ = могут пойти туда, но вы запретили им. ЖЁЛТЫЙ = могут вступить в сектор, но не могут его покинуть. ЗЕЛЁНЫЙ = могут свободно передвигаться. Нажатием правой кнопки мыши можно менять цветовой статус сектора.", - + // Flugente: disease texts describing what a map view does L"Здесь показаны вспышки заболеваний по секторам. Число указывает средний показатель инфекции на человека, цвет - насколько широко распространена инфекция. СЕРЫЙ= нет информации о заболеваемости. ЗЕЛЁНЫЙ - КРАСНЫЙ = уровень роста заболеваемости.", @@ -6263,25 +6257,23 @@ STR16 pMilitiaConfirmStrings[] = L"Подтвердить платеж?", // asking player if they wish to pay the amount requested L"Вы не можете себе этого позволить.", // telling the player they can't afford to train this town L"Продолжить тренировку в %s (%s %d)?", // continue training this town? + L"Цена $", // the cost in dollars to train militia L"( Д/Н )", // abbreviated yes/no L"", // unused L"Тренировка ополчения в секторе %d будет стоить $%d. %s", // cost to train sveral sectors at once + L"У вас нет $%d, чтобы приступить к тренировке ополчения.", L"%s: Требуется не менее %d процентов лояльности, чтобы продолжить тренировку ополчения.", L"Больше вы не можете тренировать ополчение в %s.", - L"У вас нет $%d чтобы тренировать здесь патрульные подразделение.", - L"Продолжить тренировку патруля в %s (%s %d)?", - L"Тренировка патрульного подразделения в секторе %d обойдётся в $ %d. %s", - L"Тренировка патрульного подразделения обойдётся в $", - L"Вы не можете больше тренировать патруль, так как достигнут максимум (%d/%d). Вам необходимо сначала %s для того, чтобы продложить тренировку.", L"освободить больше городских секторов", + L"освободить новые городские сектора", L"освободить больше городов", L"восстановить потерянные прогресс", L"продвинуться дальше", + L"нанять больше повстанцев", - L"Лидер ополченцев сообщает вам, что %d человек дезертировали перед лицом противника %s.", }; //Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel