cleaned up code: some comiler-warnings fixed, obsolete code removed (oops..and some whitespace stuff) (by CleaningWoman)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6102 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-05-27 21:01:04 +00:00
parent f92f70c78d
commit 9bd26015e5
33 changed files with 167 additions and 291 deletions
+39 -147
View File
@@ -796,8 +796,6 @@ BOOLEAN CanCharacterDoctor( SOLDIERTYPE *pSoldier )
BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier )
{
INT32 iCounter;
AssertNotNIL(pSoldier);
// items?
@@ -815,7 +813,7 @@ BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier )
// vehicles?
if ( pSoldier->bSectorZ == 0 )
{
for ( iCounter = 0; iCounter < ubNumberOfVehicles; iCounter++ )
for (INT32 iCounter = 0; iCounter < ubNumberOfVehicles; iCounter++ )
{
if ( pVehicleList[ iCounter ].fValid == TRUE )
{
@@ -875,7 +873,6 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
INT8 bPocket;
UINT8 ubItemsInPocket, ubObjectInPocketCounter;
INT8 bLoop;
SOLDIERTYPE * pOtherSoldier;
OBJECTTYPE * pObj;
UINT8 ubPassType;
@@ -928,7 +925,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
// now look for items to repair on other mercs
for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop < gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ )
{
pOtherSoldier = MercPtrs[ bLoop ];
SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ];
if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) )
{
@@ -1439,14 +1436,13 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol
INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier, UINT8 ubMilitiaType )
{
INT8 bLoop;
SOLDIERTYPE * pOtherSoldier;
INT8 bCount = 0;
AssertNotNIL(pSoldier);
for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ )
{
pOtherSoldier = MercPtrs[ bLoop ];
SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ];
if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->stats.bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ )
{
// Count depends on Militia Type requested
@@ -2624,7 +2620,7 @@ UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts )
// for max points we display the maximum amount of prisoners instead
*pusMaxPts = 0;
if ( !pSoldier || !pSoldier->bSectorZ )
if ( !pSoldier || !pSoldier->bSectorZ ) // FIXME: Dereferencing null pointer
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ] );
@@ -4147,10 +4143,9 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
INT8 bPocket =0;
BOOLEAN fNothingLeftToRepair = FALSE;
INT8 bLoop, bLoopStart, bLoopEnd;
BOOLEAN fAnyOfSoldiersOwnItemsWereFixed = FALSE;
OBJECTTYPE * pObj;
fAnyOfSoldiersOwnItemsWereFixed = UnjamGunsOnSoldier( pSoldier, pSoldier, &ubRepairPtsLeft );
BOOLEAN fAnyOfSoldiersOwnItemsWereFixed = UnjamGunsOnSoldier( pSoldier, pSoldier, &ubRepairPtsLeft );
// repair items on self
// HEADROCK HAM B2.8: Experimental feature: Fixes LBEs last, as they don't actually require repairs.
@@ -4655,12 +4650,11 @@ void HandleTrainingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
// std::vector<TOWN_TRAINER_TYPE> TownTrainer (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS);
UINT8 ubTownTrainers;
UINT16 usMaxPts;
BOOLEAN fSamSiteInSector = FALSE;
BOOLEAN fTrainingCompleted = FALSE;
// find out if a sam site here
fSamSiteInSector = IsThisSectorASAMSector( sMapX, sMapY, 0 );
BOOLEAN fSamSiteInSector = IsThisSectorASAMSector( sMapX, sMapY, 0 );
// Training in underground sectors is disallowed by the interface code, so there should never be any
if (bZ != 0)
@@ -5425,11 +5419,10 @@ BOOLEAN TrainTownInSector( SOLDIERTYPE *pTrainer, INT16 sMapX, INT16 sMapY, INT1
{
SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] );
UINT8 ubTownId = 0;
BOOLEAN fSamSiteInSector = FALSE;
// find out if a sam site here
fSamSiteInSector = IsThisSectorASAMSector( sMapX, sMapY, 0 );
BOOLEAN fSamSiteInSector = IsThisSectorASAMSector( sMapX, sMapY, 0 );
// get town index
ubTownId = StrategicMap[ pTrainer->sSectorX + pTrainer->sSectorY * MAP_WORLD_X ].bNameId;
@@ -5681,7 +5674,7 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
// give experience rewards to the interrogators
// total experience to share
FLOAT totalexp = 100 * prisonersinterrogated;
FLOAT totalexp = (FLOAT) (100 * prisonersinterrogated);
FLOAT expratio = totalexp / (interrogationpoints * 33); // TODO
// award experience
@@ -6682,11 +6675,11 @@ void HandleShadingOfLinesForVehicleMenu( void )
void VehicleMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1, iVehicleID;
INT32 iVehicleID;
SOLDIERTYPE * pSoldier;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
@@ -6732,9 +6725,7 @@ void VehicleMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
void VehicleMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -7103,12 +7094,11 @@ void CreateDestroyMouseRegionForRepairMenu( void )
void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE *pSoldier = NULL;
INT32 iRepairWhat;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
// ignore clicks on disabled lines
if( GetBoxShadeFlag( ghRepairBox, iValue ) == TRUE )
@@ -7245,9 +7235,7 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
void RepairMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -8611,10 +8599,9 @@ void CreateDestroyMouseRegionsForSquadMenu( BOOLEAN fPositionBox )
void AssignmentMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE *pSoldier;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
pSoldier = GetSelectedAssignSoldier( FALSE );
@@ -8661,9 +8648,7 @@ void AssignmentMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void RemoveMercMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -8687,9 +8672,7 @@ void RemoveMercMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void ContractMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for Contract region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -8716,9 +8699,7 @@ void ContractMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
void SquadMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -8752,13 +8733,8 @@ void SquadMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void RemoveMercMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for contract region
INT32 iValue = -1;
SOLDIERTYPE * pSoldier = NULL;
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 0 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
@@ -9054,9 +9030,7 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
void TrainingMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if( HandleAssignmentExpansionAndHighLightForTrainingMenu( ) == TRUE )
{
@@ -9086,9 +9060,7 @@ void TrainingMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void AttributeMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -9110,21 +9082,11 @@ void AttributeMenuMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason )
void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE * pSoldier = NULL;
CHAR16 sString[ 128 ];
INT8 bCanJoinSquad;
/* ARM: Squad menu is now disabled for anyone between sectors
UINT8 ubNextX, ubNextY, ubPrevX, ubPrevY;
UINT32 uiTraverseTime, uiArriveTime;
INT32 iOldSquadValue = -1;
BOOLEAN fCharacterWasBetweenSectors = FALSE;
*/
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 0 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
@@ -9276,14 +9238,10 @@ void SquadMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE * pSoldier = NULL;
BOOLEAN fCanTrainMilitia = TRUE;
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 0 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) || ( iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) )
{
@@ -9486,18 +9444,10 @@ void TrainingMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
}
}
void AttributesMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE * pSoldier = NULL;
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
@@ -9558,15 +9508,10 @@ void AttributesMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
CHAR16 sString[ 128 ];
SOLDIERTYPE * pSoldier = NULL;
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 0 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
@@ -12701,7 +12646,7 @@ BOOLEAN AnyMercInGroupCantContinueMoving( GROUP *pGroup )
while( pPlayer )
{
// if group has player list... and a valid first soldier
if( pPlayer && pPlayer->pSoldier )
if( pPlayer->pSoldier )
{
pSoldier = pPlayer->pSoldier;
@@ -13858,48 +13803,7 @@ SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK )
void ResumeOldAssignment( SOLDIERTYPE *pSoldier )
{
BOOLEAN fOldAssignmentInvalid = FALSE;
// ARM: I don't think the whole "old assignment" idea is a very good one, and I doubt the code that maintains that
// variable is very foolproof, plus what meaning does the old assignemnt have later, anyway?
// so I'd rather just settle for putting him into any squad:
fOldAssignmentInvalid = TRUE;
/*
if ( pSoldier->bOldAssignment == pSoldier->bAssigment )
{
// no good: we rely on this to make sure guys training militia STOP training militia!
fOldAssignmentInvalid = TRUE;
}
else if( pSoldier->bOldAssignment == VEHICLE )
{
SetSoldierAssignment( pSoldier, ( INT8 )( pSoldier->bOldAssignment ), ( pSoldier->iVehicleId ), 0, 0 );
// it might not work - check
if ( pSoldier->bAssignment != VEHICLE )
{
fOldAssignmentInvalid = TRUE;
}
}
else if( pSoldier->bOldAssignment < ON_DUTY )
{
if( AddCharacterToSquad( pSoldier, pSoldier->bOldAssignment ) == FALSE )
{
fOldAssignmentInvalid = TRUE;
}
}
else
{
fOldAssignmentInvalid = TRUE;
}
*/
if ( fOldAssignmentInvalid )
{
AddCharacterToAnySquad( pSoldier );
}
AddCharacterToAnySquad( pSoldier );
// make sure the player has time to OK this before proceeding
StopTimeCompression();
@@ -15475,9 +15379,7 @@ void CreateDestroyMouseRegionForFacilityMenu( void )
void FacilityMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if( HandleAssignmentExpansionAndHighLightForFacilityMenu( ) == TRUE )
{
@@ -15513,13 +15415,10 @@ void FacilityMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason )
void FacilityMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT32 iValue = -1;
SOLDIERTYPE * pSoldier = NULL;
BOOLEAN fCanOperateFacility = TRUE;
pSoldier = GetSelectedAssignSoldier( FALSE );
iValue = MSYS_GetRegionUserData( pRegion, 1 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 1 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) || ( iReason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) )
{
@@ -16596,9 +16495,7 @@ void CreateDestroyMouseRegionsForFacilityAssignmentMenu( void )
void FacilityAssignmentMenuMvtCallBack ( MOUSE_REGION * pRegion, INT32 iReason )
{
// mvt callback handler for assignment region
INT32 iValue = -1;
iValue = MSYS_GetRegionUserData( pRegion, 0 );
INT32 iValue = MSYS_GetRegionUserData( pRegion, 0 );
if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
@@ -16620,17 +16517,12 @@ void FacilityAssignmentMenuMvtCallBack ( MOUSE_REGION * pRegion, INT32 iReason )
void FacilityAssignmentMenuBtnCallback ( MOUSE_REGION * pRegion, INT32 iReason )
{
// btn callback handler for assignment region
INT16 ubFacilityType = -1;
INT16 ubAssignmentType = -1;
INT16 ubVehicleID = -1;
SOLDIERTYPE * pSoldier = NULL;
BOOLEAN fCanOperateFacility = TRUE;
pSoldier = GetSelectedAssignSoldier( FALSE );
ubFacilityType = gubFacilityInSubmenu;
ubAssignmentType = (INT16)MSYS_GetRegionUserData( pRegion, 1 );
ubVehicleID = (INT16)MSYS_GetRegionUserData( pRegion, 2 );
SOLDIERTYPE* pSoldier = GetSelectedAssignSoldier( FALSE );
INT16 ubFacilityType = gubFacilityInSubmenu;
INT16 ubAssignmentType = (INT16)MSYS_GetRegionUserData( pRegion, 1 );
INT16 ubVehicleID = (INT16)MSYS_GetRegionUserData( pRegion, 2 );
if (ubFacilityType <= 0 || ubFacilityType >= NUM_FACILITY_TYPES || ubAssignmentType <= 0)
{
+42 -37
View File
@@ -2,7 +2,7 @@
// HEADROCK HAM 3.5: Facilities
//
// This file contains functions that test facility data (read
// from XML) whenever necessary. See XML_Facilities.cpp and
// from XML) whenever necessary. See XML_Facilities.cpp and
// XML_FacilityTypes.cpp for the reading XML functions.
//////////////////////////////////////////////////////////////////
@@ -29,8 +29,13 @@
#include "strategicmap.h"
#include "Game Clock.h"
#include "Campaign.h"
#include "Drugs And Alcohol.cpp"
#include "Soldier Control.cpp"
#include "Drugs And Alcohol.h"
#include "Interface.h"
#include "message.h"
#include "Morale.h"
#include "Points.h"
#include "Soldier Control.h"
#include "Isometric Utils.h"
#include "MilitiaSquads.h"
#include "Tactical Save.h"
#endif
@@ -57,7 +62,7 @@ INT16 GetFacilityModifier( UINT8 ubModifierType, UINT8 ubFacilityType, UINT8 ubA
{
switch (ubModifierType)
{
case FACILITY_PERFORMANCE_MOD:
case FACILITY_PERFORMANCE_MOD:
sAssignmentModifier = gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].usPerformance;
sAmbientModifier = gFacilityTypes[ubFacilityType].AssignmentData[0].usPerformance;
sAssignmentModifier = 100 + ((sAssignmentModifier-100) + (sAmbientModifier-100));
@@ -163,7 +168,7 @@ INT16 GetFacilityModifier( UINT8 ubModifierType, UINT8 ubFacilityType, UINT8 ubA
{
switch (ubModifierType)
{
case FACILITY_PERFORMANCE_MOD:
case FACILITY_PERFORMANCE_MOD:
sAmbientModifier = gFacilityTypes[ubFacilityType].AssignmentData[0].usPerformance;
return (sAmbientModifier);
@@ -225,7 +230,7 @@ INT16 GetFacilityModifier( UINT8 ubModifierType, UINT8 ubFacilityType, UINT8 ubA
}
}
// This is a handler function that runs through every facility in the soldier's sector, retrieving one type of
// This is a handler function that runs through every facility in the soldier's sector, retrieving one type of
// modifier from each facility.
INT16 GetSectorModifier( SOLDIERTYPE *pSoldier, UINT8 ubModifierType )
{
@@ -365,7 +370,7 @@ void UpdateStrategicDetectionLevel( )
{
UINT8 ubSector = SECTOR(pSoldier->sSectorX, pSoldier->sSectorY);
UINT8 ubFacilityType = (UINT8)pSoldier->sFacilityTypeOperated;
if (GetSoldierFacilityAssignmentIndex( pSoldier ) == -1)
{
// Skip this soldier, he is not performing a facility assignment.
@@ -388,7 +393,7 @@ void UpdateStrategicDetectionLevel( )
ubCounter++;
continue;
}
/////////////////////////////////////////////////////////
// Begin testing for facility detection bonuses.
@@ -483,7 +488,7 @@ void UpdateStrategicDetectionLevel( )
{
SectorInfo[X].ubDetectionLevel |= 1;
}
// ENEMY COUNTING:
if (ubStrategicDetectionLevel & (1<<COUNT_ENEMIES_IN_WILD)||
ubStrategicDetectionLevel & (1<<COUNT_ENEMIES_IN_CITIES))
@@ -536,7 +541,7 @@ void UpdateSkyriderCostModifier()
if ( CanCharacterFacility( pSoldier, ubFacilityType, ubAssignmentType ) &&
GetWorldTotalMin() - pSoldier->uiLastAssignmentChangeMin >= (UINT32)gGameExternalOptions.ubMinutesForAssignmentToCount )
{
// Make sure facility type is valid.
Assert(ubFacilityType < MAX_NUM_FACILITY_TYPES);
@@ -546,7 +551,7 @@ void UpdateSkyriderCostModifier()
ubCounter++;
continue;
}
// Does facility change Skyrider Costs at all?
gsSkyriderCostModifier += GetFacilityModifier( FACILITY_SKYRIDER_COST_MOD, ubFacilityType, ubAssignmentType );
}
@@ -608,14 +613,14 @@ void UpdateFacilityUsageCosts( )
ubCounter++;
continue;
}
sCost = gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].sCostPerHour;
if (sCost > 0)
{
/////////////////////////////////////////////////////////
// Increase debt for operating this facility
giTotalOwedForFacilityOperationsToday += gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].sCostPerHour;
}
else if (sCost < 0)
@@ -632,10 +637,10 @@ void UpdateFacilityUsageCosts( )
}
}
// HEADROCK HAM 3.6: This function runs once at the end of each day.
// It handles debt accrued by operation facilities. If there is enough money to pay the debt off, this
// is done automatically. If only part of the money is available, or none of it, your account is emptied and all
// "expensive" facility work ends immediately. You also suffer a loyalty hit across Arulco based on how much money
// HEADROCK HAM 3.6: This function runs once at the end of each day.
// It handles debt accrued by operation facilities. If there is enough money to pay the debt off, this
// is done automatically. If only part of the money is available, or none of it, your account is emptied and all
// "expensive" facility work ends immediately. You also suffer a loyalty hit across Arulco based on how much money
// you owe. Facility work cannot continue before the debt is paid off!
void HandleDailyPaymentFacilityDebt( void )
{
@@ -750,7 +755,7 @@ INT32 MineIncomeModifierFromFacility( UINT8 ubMine )
// This function converts a soldier's current assignment into a single Facility Assignment Type Index.
// The Assignment Type Index is used for referencing various data and effects associated with performing a
// SPECIFIC assignment with the help of a SPECIFIC facility. It's basically a reference number for the gFacilityTypes
// SPECIFIC assignment with the help of a SPECIFIC facility. It's basically a reference number for the gFacilityTypes
// array.
INT8 GetSoldierFacilityAssignmentIndex( SOLDIERTYPE *pSoldier )
{
@@ -929,7 +934,7 @@ INT8 GetSoldierFacilityAssignmentIndex( SOLDIERTYPE *pSoldier )
INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacilityType, UINT8 ubAssignmentType )
{
INT16 Result = 0;
INT32 iChance;
INT16 bBaseEffect;
UINT16 ubRange;
@@ -958,7 +963,7 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
{
ubLocalLoyalty = 0;
}
///////////////
INT16 sAbsoluteMaxResult;
INT16 sAbsoluteMinResult;
@@ -1080,7 +1085,7 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
{
// Let's find out how bad/good the result is.
// By now, the Combined Stats variable is anywhere between -100 and +100.
// By now, the Combined Stats variable is anywhere between -100 and +100.
// We use this to move the Base Effect point from its original location, effectively giving us a better
// or worse result based on our stats.
bBaseEffect += (bCombinedStats * (ubRange+1)) / 100;
@@ -1189,7 +1194,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
continue;
}
}
Result = FacilityRiskResult( pSoldier, iCounter, ubFacilityType, ubAssignmentType);
if (Result != 0)
{
@@ -1228,7 +1233,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1280,7 +1285,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1332,7 +1337,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1384,7 +1389,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1437,7 +1442,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
if (pSoldier->stats.bLife < OKLIFE)
@@ -1509,7 +1514,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1561,7 +1566,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1613,7 +1618,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1665,7 +1670,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1717,7 +1722,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
// merc records - stat damaged
if( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
///////////////////////////////////////////////////////////////////////////////////////////
fBadResult = TRUE;
@@ -1903,9 +1908,9 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
gMercProfiles[ pSoldier->ubProfile ].bDexterity = pSoldier->stats.bDexterity;
gMercProfiles[ pSoldier->ubProfile ].bStrength = pSoldier->stats.bStrength;
gMercProfiles[ pSoldier->ubProfile ].bAgility = pSoldier->stats.bAgility;
fBadResult = TRUE; // stop the time, call a doctor, we had a heart attack!
// merc records - stat damaged
gMercProfiles[ pSoldier->ubProfile ].records.usTimesStatDamaged++;
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
@@ -1927,7 +1932,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
else
swprintf( sString, gzFacilityErrorMessage[24], pTownNames[ubTownID], pSoldier->GetName(), gFacilityTypes[ubFacilityType].szFacilityName );
ScreenMsg( usColor, MSG_INTERFACE, sString );
// SANDRO - add to merc records - facility accidents counter
if ( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
@@ -1949,7 +1954,7 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
else
swprintf( sString, gzFacilityErrorMessage[26], pSoldier->GetName(), szSectorGrid, gFacilityTypes[ubFacilityType].szFacilityName );
ScreenMsg( usColor, MSG_INTERFACE, sString );
// SANDRO - add to merc records - facility accidents counter
if ( Result < 0 )
gMercProfiles[ pSoldier->ubProfile ].records.usFacilityAccidents++;
@@ -1995,7 +2000,7 @@ INT32 GetTotalFacilityHourlyCosts( BOOLEAN fPositive )
//UINT8 ubSector = SECTOR(pSoldier->sSectorX, pSoldier->sSectorY);
INT16 ubFacilityType = pSoldier->sFacilityTypeOperated;
if (!fPositive && ubFacilityType != -1 && // We want facilities that cost money to operate
gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].sCostPerHour > 0) // This facility costs money
{
+2 -2
View File
@@ -1386,7 +1386,7 @@ void ReplaceSleepSpot( SCHEDULENODE * pSchedule, UINT16 usNewSpot )
void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot )
{
SOLDIERTYPE * pSoldier2;
UINT32 usSleepSpot2, usNewSleepSpot;
UINT32 usSleepSpot2;
UINT32 uiLoop;
SCHEDULENODE * pSchedule;
UINT8 ubDirection;
@@ -1405,7 +1405,7 @@ void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot )
{
// conflict!
//usNewSleepSpot = (INT16) FindGridNoFromSweetSpotWithStructData( pSoldier2, pSoldier2->usAnimState, usSleepSpot2, 3, &ubDirection, FALSE );
usNewSleepSpot = FindGridNoFromSweetSpotExcludingSweetSpot( pSoldier2, usSleepSpot2, 3, &ubDirection );
INT32 usNewSleepSpot = FindGridNoFromSweetSpotExcludingSweetSpot( pSoldier2, usSleepSpot2, 3, &ubDirection );
if (!TileIsOutOfBounds(usNewSleepSpot))
{
ReplaceSleepSpot( pSchedule, usNewSleepSpot );
+4 -18
View File
@@ -14,7 +14,6 @@
#include "Random.h"
#include "Strategic Pathing.h"
#include "message.h"
// #include "Sound Control.h"
#include "strategicmap.h"
#include "Game Clock.h"
#include "strategic.h"
@@ -568,11 +567,6 @@ INT32 GarrisonReinforcementsRequested( INT32 iGarrisonID, UINT8 *pubExtraReinfor
iReinforcementsRequested = min( iMaxEnemyGroupSize, iReinforcementsRequested );
if( iReinforcementsRequested + *pubExtraReinforcements + iExistingForces > iMaxEnemyGroupSize )
{
iExistingForces = iExistingForces;
}
return iReinforcementsRequested;
}
@@ -2301,6 +2295,8 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5");
//returns TRUE if the group was deleted.
BOOLEAN StrategicAILookForAdjacentGroups( GROUP *pGroup )
{
Assert(pGroup);
SECTORINFO *pSector;
GROUP *pEnemyGroup, *pPlayerGroup;
UINT8 ubNumEnemies;
@@ -3165,10 +3161,6 @@ void SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup )
if( iRandom < giReinforcementPool )
{ //use the pool and send the requested amount from SECTOR P3 (queen's palace)
iReinforcementsApproved = min( iReinforcementsRequested, giReinforcementPool );
if( !iReinforcementsApproved )
{
iReinforcementsApproved = iReinforcementsApproved;
}
pGroup = CreateNewEnemyGroupDepartingFromSector( SEC_P3, 0, (UINT8)iReinforcementsApproved, 0 );
pGroup->ubOriginalSector = (UINT8)SECTOR( ubDstSectorX, ubDstSectorY );
@@ -6487,14 +6479,8 @@ void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode,
(*pGroup)->pEnemyGroup->ubIntention = ubIntention;
(*pGroup)->ubMoveType = ONE_WAY;
if( ubIntention == PURSUIT )
{ //Make sure that the group isn't moving into a garrison sector. These sectors should be using ASSAULT intentions!
if( SectorInfo[ ubSectorID ].ubGarrisonID != NO_GARRISON )
{
//Good place for a breakpoint.
pGroup = pGroup;
}
}
//Make sure that the group isn't moving into a garrison sector. These sectors should be using ASSAULT intentions!
Assert(ubIntention != PURSUIT && SectorInfo[ ubSectorID ].ubGarrisonID != NO_GARRISON );
if( (*pGroup)->ubSectorX == ubDstSectorX && (*pGroup)->ubSectorY == ubDstSectorY )
{ //The destination sector is the current location. Instead of causing code logic problems,
+1
View File
@@ -3899,6 +3899,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
}
// save info for desired squad and and time for all single mercs leaving their squad.
Assert(pValidSoldier);
bPrevAssignment = pValidSoldier->bAssignment;
ubPrevGroupID = pValidSoldier->ubGroupID;