mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
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
This commit is contained in:
+53
-817
File diff suppressed because it is too large
Load Diff
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<<DETECT_ENEMIES_DYNAMIC))
|
||||
{
|
||||
// Is sector allowed for militia roaming?
|
||||
if (IsSectorRoamingAllowed( X ) )
|
||||
{
|
||||
// Enemy is in a militia-allowed area, and is always visible.
|
||||
SectorInfo[X].ubDetectionLevel |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ubStrategicDetectionLevel & (1<<DETECT_ENEMIES_LONGRANGE))
|
||||
{
|
||||
if( GetSectorFlagStatus( SECTORX(X), SECTORY(X), 0, SF_ALREADY_VISITED ) == TRUE )
|
||||
|
||||
@@ -488,15 +488,10 @@ void InitStrategicLayer( void )
|
||||
|
||||
// HEADROCK HAM 3.6: Initialize facilities.
|
||||
InitFacilities();
|
||||
|
||||
// HEADROCK HAM 4: Initialize Manual Mobile Militia Restrictions.
|
||||
InitManualMobileRestrictions();
|
||||
|
||||
// Flugente: initialize dynamic supply data
|
||||
//InitStrategicSupplies();
|
||||
|
||||
|
||||
// free up any leave list arrays that were left allocated
|
||||
ShutDownLeaveList( );
|
||||
|
||||
// re-set up leave list arrays for dismissed mercs
|
||||
InitLeaveList( );
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include "Assignments.h"
|
||||
// HEADROCK HAM 4: Now accepts INI settings
|
||||
#include "GameSettings.h"
|
||||
// Also include Town Militia for checks regarding Mobile Militia Restrictions
|
||||
#include "Town Militia.h"
|
||||
// Also include Quests, for checking whether a fact is true.
|
||||
#include "Quests.h"
|
||||
// HEADROCK HAM 5: Required for inventory filter popup
|
||||
@@ -54,8 +52,6 @@ UINT16 MAP_BORDER_ITEM_BTN_X;
|
||||
UINT16 MAP_BORDER_ITEM_BTN_Y;
|
||||
UINT16 MAP_BORDER_MILITIA_BTN_X;
|
||||
UINT16 MAP_BORDER_MILITIA_BTN_Y;
|
||||
UINT16 MAP_BORDER_MOBILE_BTN_X;
|
||||
UINT16 MAP_BORDER_MOBILE_BTN_Y;
|
||||
UINT16 MAP_BORDER_DISEASE_BTN_X; // Flugente: disease
|
||||
UINT16 MAP_BORDER_DISEASE_BTN_Y;
|
||||
UINT16 MAP_BORDER_WEATHER_BTN_X; // Flugente: weather
|
||||
@@ -128,8 +124,6 @@ void BtnItemCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
void BtnAircraftCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
void BtnTeamCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
void BtnMilitiaCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
// HEADROCK HAM 4: Mobile Restrictions Button callback
|
||||
void BtnMobileCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
|
||||
// Flugente: disease
|
||||
void BtnDiseaseCallback(GUI_BUTTON *btn,INT32 reason);
|
||||
@@ -204,15 +198,8 @@ void RenderMapBorder( void )
|
||||
|
||||
// get and blt border
|
||||
GetVideoObject(&hHandle, guiMapBorder );
|
||||
// HEADROCK HAM 4: Load different map border depending on whether we want to display the mobile militia button or not.
|
||||
if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand )
|
||||
{
|
||||
BltVideoObject( guiSAVEBUFFER , hHandle, 1, xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY,NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
BltVideoObject( guiSAVEBUFFER , hHandle, 0, xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY,NULL );
|
||||
}
|
||||
|
||||
BltVideoObject( guiSAVEBUFFER, hHandle, 0, xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
RestoreExternBackgroundRect( xResOffset + MAP_BORDER_X, yResOffset + MAP_BORDER_Y, SCREEN_WIDTH - MAP_BORDER_X - 2 * xResOffset, SCREEN_HEIGHT - 121 - 2 * yResOffset);
|
||||
|
||||
@@ -220,7 +207,6 @@ void RenderMapBorder( void )
|
||||
DisplayCurrentLevelMarker( );
|
||||
}
|
||||
|
||||
|
||||
void RenderMapBorderEtaPopUp( void )
|
||||
{
|
||||
// renders map border corner to the FRAME_BUFFER
|
||||
@@ -299,17 +285,7 @@ BOOLEAN CreateButtonsForMapBorder( void )
|
||||
giMapBorderButtons[ MAP_BORDER_ITEM_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_ITEM_BTN ], MAP_BORDER_ITEM_BTN_X, MAP_BORDER_ITEM_BTN_Y,
|
||||
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnItemCallback);
|
||||
|
||||
// WANNE: Only display the buton when mobile militia is allowed!
|
||||
// HEADROCK HAM 4: Mobile Restrictions Button
|
||||
if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand )
|
||||
{
|
||||
giMapBorderButtonsImage[ MAP_BORDER_MOBILE_BTN ] = LoadButtonImage( "INTERFACE\\map_border_buttons.sti" ,-1,20,-1,21,-1 );
|
||||
giMapBorderButtons[ MAP_BORDER_MOBILE_BTN ] = QuickCreateButton( giMapBorderButtonsImage[ MAP_BORDER_MOBILE_BTN ], MAP_BORDER_MOBILE_BTN_X, MAP_BORDER_MOBILE_BTN_Y,
|
||||
BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH,
|
||||
(GUI_CALLBACK)MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnMobileCallback);
|
||||
}
|
||||
|
||||
|
||||
// set up fast help text
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_TOWN_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_TOWN_BTN ] );
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_MINE_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_MINE_BTN ] );
|
||||
@@ -317,9 +293,6 @@ BOOLEAN CreateButtonsForMapBorder( void )
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_AIRSPACE_BTN ] );
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_ITEM_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_ITEM_BTN ] );
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_MILITIA_BTN ] );
|
||||
|
||||
if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand )
|
||||
SetButtonFastHelpText( giMapBorderButtons[ MAP_BORDER_MOBILE_BTN ], pMapScreenBorderButtonHelpText[ MAP_BORDER_MOBILE_BTN ] ); // HEADROCK HAM 4: Mobile Militia button
|
||||
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_TOWN_BTN ], MSYS_NO_CURSOR );
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_MINE_BTN ], MSYS_NO_CURSOR );
|
||||
@@ -327,10 +300,7 @@ BOOLEAN CreateButtonsForMapBorder( void )
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ], MSYS_NO_CURSOR );
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_ITEM_BTN ], MSYS_NO_CURSOR );
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ], MSYS_NO_CURSOR );
|
||||
|
||||
if ( gGameExternalOptions.gfAllowMilitiaGroups && !gGameExternalOptions.fMilitiaStrategicCommand )
|
||||
SetButtonCursor(giMapBorderButtons[ MAP_BORDER_MOBILE_BTN ], MSYS_NO_CURSOR ); // HEADROCK HAM 4: Mobile Militia button
|
||||
|
||||
|
||||
// Flugente: disease
|
||||
if ( gGameExternalOptions.fDisease && gGameExternalOptions.fDiseaseStrategic )
|
||||
{
|
||||
@@ -436,7 +406,6 @@ BOOLEAN CreateButtonsForMapBorder( void )
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_MILITIA_BTN ]);
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_AIRSPACE_BTN ]);
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_ITEM_BTN ]);
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_MOBILE_BTN ]);
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_DISEASE_BTN ]);
|
||||
DisableButton( giMapBorderButtons[ MAP_BORDER_WEATHER_BTN ]);
|
||||
|
||||
@@ -448,7 +417,6 @@ BOOLEAN CreateButtonsForMapBorder( void )
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
void DeleteMapBorderButtons( void )
|
||||
{
|
||||
for ( int i = 0; i < NUM_MAP_BORDER_BTNS; ++i )
|
||||
@@ -576,22 +544,6 @@ void BtnWeatherCallback( GUI_BUTTON *btn, INT32 reason )
|
||||
}
|
||||
}
|
||||
|
||||
// HEADROCK HAM 4: Callback for Mobile Restrictions Button
|
||||
void BtnMobileCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
{
|
||||
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
|
||||
{
|
||||
CommonBtnCallbackBtnDownChecks();
|
||||
|
||||
ToggleMobileFilter();
|
||||
}
|
||||
else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN )
|
||||
{
|
||||
CommonBtnCallbackBtnDownChecks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ToggleShowTownsMode( void )
|
||||
{
|
||||
if( fShowTownFlag == TRUE )
|
||||
@@ -691,8 +643,7 @@ void ToggleShowMilitiaMode( void )
|
||||
|
||||
// if he's already training some
|
||||
// HEADROCK HAM 3.6: Also for Mobile trainers.
|
||||
if( IsAnyOneOnPlayersTeamOnThisAssignment( TRAIN_TOWN ) ||
|
||||
IsAnyOneOnPlayersTeamOnThisAssignment( TRAIN_MOBILE ) )
|
||||
if( IsAnyOneOnPlayersTeamOnThisAssignment( TRAIN_TOWN ) )
|
||||
{
|
||||
// say they'll show up when training is completed
|
||||
pwString = pMapErrorString[ 28 ];
|
||||
@@ -829,48 +780,6 @@ void ToggleWeatherFilter( void )
|
||||
}
|
||||
}
|
||||
|
||||
// HEADROCK HAM 4: Toggle Mobile Restrictions Button
|
||||
void ToggleMobileFilter( void )
|
||||
{
|
||||
if ( gusMapDisplayColourMode == MAP_DISPLAY_MOBILEMILITIARESTRICTIONS )
|
||||
{
|
||||
gusMapDisplayColourMode = MAP_DISPLAY_NORMAL;
|
||||
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
|
||||
// dirty regions
|
||||
fMapPanelDirty = TRUE;
|
||||
fTeamPanelDirty = TRUE;
|
||||
fCharacterInfoPanelDirty = TRUE;
|
||||
fMapScreenBottomDirty = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// turn items ON
|
||||
TurnOnMobileFilterMode();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void ShowDestinationOfPlottedPath( STR16 pLoc )
|
||||
{
|
||||
INT16 sFontX, sFontY;
|
||||
|
||||
SetFontDestBuffer( FRAME_BUFFER, 0, 0, 640, 480, FALSE );
|
||||
|
||||
SetFont( COMPFONT );
|
||||
SetFontForeground( 183 );
|
||||
SetFontBackground( FONT_BLACK );
|
||||
|
||||
VarFindFontCenterCoordinates( 461, 344, 70, 12, COMPFONT, &sFontX, &sFontY, pLoc );
|
||||
gprintfdirty(sFontX, sFontY, pLoc );
|
||||
mprintf(sFontX, sFontY, pLoc );
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void DisplayCurrentLevelMarker( void )
|
||||
{
|
||||
// display the current level marker on the map border
|
||||
@@ -882,18 +791,14 @@ void DisplayCurrentLevelMarker( void )
|
||||
BltVideoObject( guiSAVEBUFFER , hHandle, 0, MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), VO_BLT_SRCTRANSPARENCY,NULL );
|
||||
|
||||
RestoreExternBackgroundRect(MAP_LEVEL_MARKER_X + 1, MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( INT16 )iCurrentMapSectorZ ), 55, 9);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void CreateMouseRegionsForLevelMarkers( void )
|
||||
{
|
||||
INT16 sCounter = 0;
|
||||
CHAR16 sString[ 64 ];
|
||||
|
||||
for( sCounter = 0; sCounter < 4 ; sCounter++ )
|
||||
for( sCounter = 0; sCounter < 4 ; ++sCounter )
|
||||
{
|
||||
MSYS_DefineRegion(&LevelMouseRegions[ sCounter ], MAP_LEVEL_MARKER_X, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * sCounter ) ), MAP_LEVEL_MARKER_X + MAP_LEVEL_MARKER_WIDTH, ( INT16 )( MAP_LEVEL_MARKER_Y + ( MAP_LEVEL_MARKER_DELTA * ( sCounter + 1 ) ) ), MSYS_PRIORITY_HIGH, MSYS_NO_CURSOR,
|
||||
MSYS_NO_CALLBACK, LevelMarkerBtnCallback );
|
||||
@@ -962,8 +867,6 @@ void TurnOnShowTeamsMode( void )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TurnOnAirSpaceMode( void )
|
||||
{
|
||||
// if mode already on, leave, else set and redraw
|
||||
@@ -976,7 +879,6 @@ void TurnOnAirSpaceMode( void )
|
||||
if ( gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE || gusMapDisplayColourMode == MAP_DISPLAY_AIRSPACE_COLOURED_SAMS )
|
||||
{
|
||||
MapBorderButtonOn( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
|
||||
@@ -1103,7 +1005,6 @@ void TurnOnDiseaseFilterMode( void )
|
||||
gusMapDisplayColourMode = MAP_DISPLAY_DISEASE;
|
||||
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
|
||||
@@ -1149,7 +1050,7 @@ void TurnOnDiseaseFilterMode( void )
|
||||
|
||||
if ( !gubFact[FACT_DISEASE_VIEWED] )
|
||||
{
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, zMarksMapScreenText[27] );
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, zMarksMapScreenText[25] );
|
||||
|
||||
SetFactTrue( FACT_DISEASE_VIEWED );
|
||||
}
|
||||
@@ -1169,7 +1070,6 @@ void TurnOnWeatherFilterMode()
|
||||
gusMapDisplayColourMode = MAP_DISPLAY_WEATHER;
|
||||
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_WEATHER_BTN );
|
||||
|
||||
@@ -1217,7 +1117,7 @@ void TurnOnWeatherFilterMode()
|
||||
static BOOLEAN sWeatherviewed = FALSE;
|
||||
if ( !sWeatherviewed )
|
||||
{
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, zMarksMapScreenText[28] );
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, zMarksMapScreenText[26] );
|
||||
|
||||
sWeatherviewed = TRUE;
|
||||
}
|
||||
@@ -1229,82 +1129,6 @@ void TurnOnWeatherFilterMode()
|
||||
}
|
||||
}
|
||||
|
||||
// HEADROCK HAM 4: Activate "View Mobile Restrictions" mode.
|
||||
void TurnOnMobileFilterMode( void )
|
||||
{
|
||||
// if mode already on, leave, else set and redraw
|
||||
|
||||
if ( gusMapDisplayColourMode != MAP_DISPLAY_MOBILEMILITIARESTRICTIONS )
|
||||
{
|
||||
gusMapDisplayColourMode = MAP_DISPLAY_MOBILEMILITIARESTRICTIONS;
|
||||
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
|
||||
// Also turn on Militia mode
|
||||
fShowMilitia = FALSE; // Fool the function so that it always turns militia ON.
|
||||
ToggleShowMilitiaMode();
|
||||
|
||||
if( fShowMineFlag == TRUE )
|
||||
{
|
||||
fShowMineFlag = FALSE;
|
||||
MapBorderButtonOff( MAP_BORDER_MINE_BTN );
|
||||
}
|
||||
|
||||
if( fShowTeamFlag == TRUE )
|
||||
{
|
||||
fShowTeamFlag = FALSE;
|
||||
MapBorderButtonOff( MAP_BORDER_TEAMS_BTN );
|
||||
}
|
||||
|
||||
// Turn off items
|
||||
if( fShowItemsFlag == TRUE )
|
||||
{
|
||||
fShowItemsFlag = FALSE;
|
||||
MapBorderButtonOff( MAP_BORDER_ITEM_BTN );
|
||||
}
|
||||
|
||||
if ( (bSelectedDestChar != -1) || fPlotForHelicopter || fPlotForMilitia )
|
||||
{
|
||||
AbortMovementPlottingMode( );
|
||||
}
|
||||
else if ( gfInChangeArrivalSectorMode )
|
||||
{
|
||||
CancelChangeArrivalSectorMode( );
|
||||
}
|
||||
|
||||
STR16 pwString = NULL;
|
||||
|
||||
// check if player has any Mobile militia
|
||||
if ( DoesPlayerHaveAnyMobileMilitia( ) == 1 )
|
||||
{
|
||||
// say you need to train mobiles first
|
||||
pwString = zMarksMapScreenText[ 25 ];
|
||||
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, pwString );
|
||||
}
|
||||
|
||||
if ( !gubFact[ FACT_MOBILE_RESTRICTIONS_VIEWED ] )
|
||||
{
|
||||
// say you need to train mobiles first
|
||||
pwString = zMarksMapScreenText[ 26 ];
|
||||
|
||||
MapScreenMessage( FONT_MCOLOR_LTYELLOW, MSG_MAP_UI_POSITION_MIDDLE, pwString );
|
||||
|
||||
SetFactTrue( FACT_MOBILE_RESTRICTIONS_VIEWED );
|
||||
}
|
||||
|
||||
// dirty regions
|
||||
fMapPanelDirty = TRUE;
|
||||
fTeamPanelDirty = TRUE;
|
||||
fCharacterInfoPanelDirty = TRUE;
|
||||
fMapScreenBottomDirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InitializeMapBorderButtonStates( void )
|
||||
{
|
||||
if( fShowItemsFlag )
|
||||
@@ -1357,36 +1181,24 @@ void InitializeMapBorderButtonStates( void )
|
||||
case MAP_DISPLAY_AIRSPACE:
|
||||
case MAP_DISPLAY_AIRSPACE_COLOURED_SAMS:
|
||||
MapBorderButtonOn( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
break;
|
||||
|
||||
case MAP_DISPLAY_MOBILEMILITIARESTRICTIONS:
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
break;
|
||||
|
||||
|
||||
case MAP_DISPLAY_DISEASE:
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_WEATHER_BTN );
|
||||
break;
|
||||
|
||||
case MAP_DISPLAY_WEATHER:
|
||||
MapBorderButtonOff( MAP_BORDER_AIRSPACE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_MOBILE_BTN );
|
||||
MapBorderButtonOff( MAP_BORDER_DISEASE_BTN );
|
||||
MapBorderButtonOn( MAP_BORDER_WEATHER_BTN );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOLEAN DoesPlayerHaveAnyMilitia( void )
|
||||
{
|
||||
// run through list of towns that might have militia..if any return TRUE..else return FALSE
|
||||
@@ -1406,38 +1218,6 @@ BOOLEAN DoesPlayerHaveAnyMilitia( void )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// HEADROCK HAM 4: Check for Mobile Militia
|
||||
UINT8 DoesPlayerHaveAnyMobileMilitia( void )
|
||||
{
|
||||
if ( !gGameExternalOptions.gfAllowMilitiaGroups || gGameExternalOptions.fMilitiaStrategicCommand )
|
||||
{
|
||||
// Mobile Militia not allowed at all.
|
||||
return (0);
|
||||
}
|
||||
|
||||
// run through list of towns that might have militia..if any return TRUE..else return FALSE
|
||||
for ( INT16 sX = 1; sX < MAP_WORLD_X - 1; ++sX )
|
||||
{
|
||||
for ( INT16 sY = 1; sY < MAP_WORLD_Y - 1; ++sY )
|
||||
{
|
||||
// Look only in sectors where Militia Training is not allowed at all. If any militia are found there,
|
||||
// it means that they had to MOVE there, hence mobile militia.
|
||||
if (!MilitiaTrainingAllowedInSector( sX, sY, 0 ))
|
||||
{
|
||||
if ( NumNonPlayerTeamMembersInSector( sX, sY, MILITIA_TEAM ) > 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;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
+16
-1340
File diff suppressed because it is too large
Load Diff
@@ -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 );
|
||||
|
||||
+2
-2
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -768,10 +768,6 @@
|
||||
RelativePath=".\XML_Creatures.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_DynamicRestrictions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_ExtraItems.cpp"
|
||||
>
|
||||
@@ -788,10 +784,6 @@
|
||||
RelativePath=".\XML_Minerals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_Roaming.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_SectorNames.cpp"
|
||||
>
|
||||
|
||||
@@ -766,10 +766,6 @@
|
||||
RelativePath=".\XML_Creatures.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_DynamicRestrictions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_ExtraItems.cpp"
|
||||
>
|
||||
@@ -786,10 +782,6 @@
|
||||
RelativePath=".\XML_Minerals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="XML_Roaming.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\XML_SectorNames.cpp"
|
||||
>
|
||||
|
||||
@@ -131,12 +131,10 @@
|
||||
<ClCompile Include="XML_Bloodcats.cpp" />
|
||||
<ClCompile Include="XML_CoolnessBySector.cpp" />
|
||||
<ClCompile Include="XML_Creatures.cpp" />
|
||||
<ClCompile Include="XML_DynamicRestrictions.cpp" />
|
||||
<ClCompile Include="XML_ExtraItems.cpp" />
|
||||
<ClCompile Include="XML_Facilities.cpp" />
|
||||
<ClCompile Include="XML_FacilityTypes.cpp" />
|
||||
<ClCompile Include="XML_Minerals.cpp" />
|
||||
<ClCompile Include="XML_Roaming.cpp" />
|
||||
<ClCompile Include="XML_SectorNames.cpp" />
|
||||
<ClCompile Include="XML_SquadNames.cpp" />
|
||||
<ClCompile Include="XML_UniformColors.cpp" />
|
||||
|
||||
@@ -314,9 +314,6 @@
|
||||
<ClCompile Include="XML_Bloodcats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_DynamicRestrictions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_ExtraItems.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -326,9 +323,6 @@
|
||||
<ClCompile Include="XML_FacilityTypes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_Roaming.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_SectorNames.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -131,12 +131,10 @@
|
||||
<ClCompile Include="XML_Bloodcats.cpp" />
|
||||
<ClCompile Include="XML_CoolnessBySector.cpp" />
|
||||
<ClCompile Include="XML_Creatures.cpp" />
|
||||
<ClCompile Include="XML_DynamicRestrictions.cpp" />
|
||||
<ClCompile Include="XML_ExtraItems.cpp" />
|
||||
<ClCompile Include="XML_Facilities.cpp" />
|
||||
<ClCompile Include="XML_FacilityTypes.cpp" />
|
||||
<ClCompile Include="XML_Minerals.cpp" />
|
||||
<ClCompile Include="XML_Roaming.cpp" />
|
||||
<ClCompile Include="XML_SectorNames.cpp" />
|
||||
<ClCompile Include="XML_SquadNames.cpp" />
|
||||
<ClCompile Include="XML_UniformColors.cpp" />
|
||||
|
||||
@@ -308,9 +308,6 @@
|
||||
<ClCompile Include="XML_Bloodcats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_DynamicRestrictions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_ExtraItems.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -320,9 +317,6 @@
|
||||
<ClCompile Include="XML_FacilityTypes.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_Roaming.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XML_SectorNames.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -131,12 +131,10 @@
|
||||
<ClCompile Include="XML_Bloodcats.cpp" />
|
||||
<ClCompile Include="XML_CoolnessBySector.cpp" />
|
||||
<ClCompile Include="XML_Creatures.cpp" />
|
||||
<ClCompile Include="XML_DynamicRestrictions.cpp" />
|
||||
<ClCompile Include="XML_ExtraItems.cpp" />
|
||||
<ClCompile Include="XML_Facilities.cpp" />
|
||||
<ClCompile Include="XML_FacilityTypes.cpp" />
|
||||
<ClCompile Include="XML_Minerals.cpp" />
|
||||
<ClCompile Include="XML_Roaming.cpp" />
|
||||
<ClCompile Include="XML_SectorNames.cpp" />
|
||||
<ClCompile Include="XML_SquadNames.cpp" />
|
||||
<ClCompile Include="XML_UniformColors.cpp" />
|
||||
|
||||
+56
-545
@@ -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 indivídual 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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 </FACILITYTYPE> 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;
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Strategic All.h"
|
||||
#include "XML.h"
|
||||
#else
|
||||
#include "builddefines.h"
|
||||
#include <stdio.h>
|
||||
#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;
|
||||
}
|
||||
+3
-53
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-97
@@ -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;
|
||||
}
|
||||
@@ -65,6 +65,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN SetMilitiaMovementOrder(INT16 sX, INT16 sY, INT8 sZ, UINT32 dir);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user