mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
New Feature: a private military company allows hiring of advanced militia. For more info, see http://www.ja-galaxy-forum.com/ubbthreads.php/topics/335279#Post335279
Does not break savegame compatibility. Requires GameDir revision >= r2130. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7457 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -66,9 +66,10 @@
|
||||
#include "Tactical Save.h" // added by Flugente
|
||||
#include "Campaign Types.h" // added by Flugente
|
||||
#include "Strategic Town Loyalty.h"
|
||||
#include "DynamicDialogue.h" // added by Flugente
|
||||
#include "DynamicDialogue.h" // added by Flugente
|
||||
#include "Disease.h" // added by Flugente
|
||||
#include "Queen Command.h" // added by Flugente
|
||||
#include "PMC.h" // added by Flugente
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
@@ -2540,6 +2541,9 @@ void UpdateAssignments()
|
||||
HandleDiseaseDiagnosis(); // this must come after HandleDisease() so we discover fresh infections
|
||||
HandleDiseaseSectorTreatment();
|
||||
|
||||
// Flugente: PMC recruits new personnel
|
||||
HourlyUpdatePMC();
|
||||
|
||||
// check to see if anyone is done healing?
|
||||
UpdatePatientsWhoAreDoneHealing( );
|
||||
|
||||
|
||||
@@ -281,6 +281,9 @@ typedef struct FACILITYASSIGNMENTTYPE
|
||||
|
||||
} FACILITYASSIGNMENTTYPE;
|
||||
|
||||
// Flugente: facilitytype properties
|
||||
#define FACILITYTYPE_PMCENTRYPOINT 0x00000001 // militia hired from the PMC can only enter Arulco in sectors with facilites with this property
|
||||
|
||||
// HEADROCK HAM 3.5: Facility Type
|
||||
typedef struct FACILITYTYPE
|
||||
{
|
||||
@@ -295,6 +298,8 @@ typedef struct FACILITYTYPE
|
||||
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
|
||||
|
||||
FACILITYASSIGNMENTTYPE AssignmentData[ NUM_FACILITY_ASSIGNMENTS ]; // Data about possible assignments that can be done here
|
||||
|
||||
} FACILITYTYPE;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "Campaign.h"
|
||||
#include "PostalService.h"
|
||||
#include "MilitiaSquads.h"
|
||||
#include "PMC.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -509,6 +510,16 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
case EVENT_MILITIA_MOVEMENT_ORDER:
|
||||
MilitiaMovementOrder( (UINT8) pEvent->uiParam );
|
||||
break;
|
||||
|
||||
case EVENT_PMC_EMAIL:
|
||||
// only send the email if we hven't already visited the site, otherwise continue to spam ;-)
|
||||
if ( !IsBookMarkSet(PMC_BOOKMARK) )
|
||||
AddEmail( PMC_INTRO, PMC_INTRO_LENGTH, PMC, GetWorldTotalMin( ), -1, -1, TYPE_EMAIL_EMAIL_EDT );
|
||||
break;
|
||||
|
||||
case EVENT_PMC_REINFORCEMENT_ARRIVAL:
|
||||
HandlePMCArrival( (UINT8)pEvent->uiParam );
|
||||
break;
|
||||
}
|
||||
gfPreventDeletionOfAnyEvent = fOrigPreventFlag;
|
||||
return TRUE;
|
||||
|
||||
@@ -112,7 +112,9 @@ enum
|
||||
EVENT_HELICOPTER_HOVER_FOR_A_MINUTE,
|
||||
EVENT_HELICOPTER_REFUEL_FOR_A_MINUTE,
|
||||
|
||||
EVENT_MILITIA_MOVEMENT_ORDER, // Flugente: timed event: militia was ordered to move, at this time they should arrive
|
||||
EVENT_MILITIA_MOVEMENT_ORDER, // Flugente: militia was ordered to move, at this time they should arrive
|
||||
EVENT_PMC_EMAIL, // Flugente: pmc will send us an introduction email
|
||||
EVENT_PMC_REINFORCEMENT_ARRIVAL, // Flugente: pmc hired militia arrives
|
||||
|
||||
NUMBER_OF_EVENT_TYPES_PLUS_ONE,
|
||||
NUMBER_OF_EVENT_TYPES = NUMBER_OF_EVENT_TYPES_PLUS_ONE - 1
|
||||
|
||||
@@ -109,6 +109,8 @@ CHAR16 gEventName[NUMBER_OF_EVENT_TYPES_PLUS_ONE][40]={
|
||||
#endif
|
||||
L"HelicopterHoverForAMinute",
|
||||
L"HelicopterRefuelForAMinute",
|
||||
L"MilitiaMovementOrder",
|
||||
L"PMCReinforcementArrival",
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "MilitiaSquads.h"
|
||||
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "PMC.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#include "Vehicles.h"
|
||||
@@ -714,6 +715,9 @@ fFirstTimeInMapScreen = TRUE;
|
||||
// Flugente campaign stats
|
||||
gCampaignStats.clear();
|
||||
|
||||
// Flugente: PMC
|
||||
GameInitPMC();
|
||||
|
||||
InitStrategicLayer();
|
||||
|
||||
// Set new game flag
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "Map Screen Interface Border.h"
|
||||
#include "interface control.h"
|
||||
#include "Map Screen Interface Map.h"
|
||||
#include "laptop.h" // added by Flugente
|
||||
#include "Game Event Hook.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
// HEADROCK HAM 3: include these files so that a militia trainer's Effective Leadership can be determined. Used
|
||||
@@ -126,6 +128,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
UINT8 iTrainingSquadSize = __min(iMaxMilitiaPerSector, CalcNumMilitiaTrained(ubTrainerEffectiveLeadership, FALSE));
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Militia1");
|
||||
|
||||
// get town index
|
||||
ubTownId = StrategicMap[ sMapX + sMapY * MAP_WORLD_X ].bNameId;
|
||||
|
||||
@@ -134,7 +137,6 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
Assert( IsThisSectorASAMSector( sMapX, sMapY, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
// force tactical to update militia status
|
||||
gfStrategicMilitiaChangesMade = FALSE;
|
||||
|
||||
@@ -221,7 +223,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ubTownId != BLANK_SECTOR )
|
||||
if( ubTownId != BLANK_SECTOR )
|
||||
{
|
||||
// dammit! Last chance - try to find other eligible sectors in the same town with a Green guy to be promoted
|
||||
InitFriendlyTownSectorServer(ubTownId, sMapX, sMapY);
|
||||
@@ -246,9 +248,9 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
}
|
||||
}
|
||||
|
||||
// Kaiden: Veteran militia training
|
||||
// This is essentially copy/pasted from above
|
||||
// But the names have been changed to protect the innocent
|
||||
// Kaiden: Veteran militia training
|
||||
// This is essentially copy/pasted from above
|
||||
// But the names have been changed to protect the innocent
|
||||
if ((!fFoundOne) && (gGameExternalOptions.gfTrainVeteranMilitia)
|
||||
&& (GetWorldDay( ) >= gGameExternalOptions.guiTrainVeteranMilitiaDelay))
|
||||
{
|
||||
@@ -305,7 +307,7 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
}
|
||||
|
||||
// next, please!
|
||||
ubMilitiaTrained++;
|
||||
++ubMilitiaTrained;
|
||||
}
|
||||
|
||||
if (gfStrategicMilitiaChangesMade)
|
||||
@@ -332,12 +334,16 @@ void TownMilitiaTrainingCompleted( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMa
|
||||
RecordNumMilitiaTrainedForMercs( sMapX, sMapY, pTrainer->bSectorZ, ubMilitiaTrained, FALSE );
|
||||
}
|
||||
|
||||
// the trainer announces to player that he's finished his assignment. Make his sector flash!
|
||||
AssignmentDone( pTrainer, TRUE, FALSE );
|
||||
// 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
|
||||
// handle completion of town by training group
|
||||
HandleCompletionOfTownTrainingByGroupWithTrainer( pTrainer, TOWN_MILITIA );
|
||||
}
|
||||
|
||||
// Flugente: if we trained militia, the PMC notices us and offers their services
|
||||
if ( gGameExternalOptions.fPMC )
|
||||
AddStrategicEvent( EVENT_PMC_EMAIL, GetWorldTotalMin() + 60 * (1 + Random(6)), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -179,7 +179,9 @@ facilitytypeStartElementHandle(void *userData, const XML_Char *name, const XML_C
|
||||
strcmp(name, "ubMilitiaTrainersAllowed") == 0 ||
|
||||
strcmp(name, "ubMobileMilitiaTrainersAllowed") == 0 ||
|
||||
strcmp(name, "usMilitiaTraining") == 0 ||
|
||||
strcmp(name, "usMobileMilitiaTraining") == 0 ))
|
||||
strcmp(name, "usMobileMilitiaTraining") == 0 ||
|
||||
|
||||
strcmp( name, "pmcentrypoint" ) == 0 ))
|
||||
{
|
||||
pData->curElement = FACILITYTYPE_ELEMENT;
|
||||
|
||||
@@ -426,8 +428,10 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
gFacilityTypes[pData->curIndex].usMilitiaTraining = pData->curFacilityTypeData.usMilitiaTraining;
|
||||
gFacilityTypes[pData->curIndex].usMobileMilitiaTraining = pData->curFacilityTypeData.usMobileMilitiaTraining;
|
||||
|
||||
gFacilityTypes[pData->curIndex].usFacilityFlags = pData->curFacilityTypeData.usFacilityFlags;
|
||||
|
||||
// Set assignment-specific data
|
||||
for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; cnt++)
|
||||
for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; ++cnt)
|
||||
{
|
||||
// Performance and limits
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].usPerformance = pData->curFacilityTypeData.AssignmentData[cnt].usPerformance;
|
||||
@@ -472,7 +476,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].ubMinimumLoyaltyHere = pData->curFacilityTypeData.AssignmentData[cnt].ubMinimumLoyaltyHere;
|
||||
|
||||
// Set risks associated with this assignment
|
||||
for (UINT16 cntB = 0; cntB < NUM_RISKS; cntB++)
|
||||
for (UINT16 cntB = 0; cntB < NUM_RISKS; ++cntB)
|
||||
{
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].usChance = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].usChance;
|
||||
gFacilityTypes[pData->curIndex].AssignmentData[cnt].Risk[cntB].bBaseEffect = pData->curFacilityTypeData.AssignmentData[cnt].Risk[cntB].bBaseEffect;
|
||||
@@ -485,7 +489,7 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
wcscpy(gFacilityTypes[pData->curIndex].szFacilityName, pData->curFacilityTypeData.szFacilityName);
|
||||
wcscpy(gFacilityTypes[pData->curIndex].szFacilityShortName, pData->curFacilityTypeData.szFacilityShortName);
|
||||
|
||||
for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; cnt++)
|
||||
for (UINT16 cnt = 0; cnt < NUM_FACILITY_ASSIGNMENTS; ++cnt)
|
||||
{
|
||||
wcscpy(gFacilityTypes[pData->curIndex].AssignmentData[cnt].szTooltipText, pData->curFacilityTypeData.AssignmentData[cnt].szTooltipText);
|
||||
}
|
||||
@@ -539,25 +543,29 @@ facilitytypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
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;
|
||||
if ( (UINT8)atol( pData->szCharData ) )
|
||||
pData->curFacilityTypeData.usFacilityFlags |= FACILITYTYPE_PMCENTRYPOINT;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// Assignments
|
||||
|
||||
|
||||
Reference in New Issue
Block a user