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
+3
View File
@@ -42,6 +42,7 @@ class Cursor {
, m_hdcWindow(hdcWindow)
, m_crCursorColor(crCursorColor)
, m_bActive(TRUE)
, m_uiTimer(0)
{};
virtual ~Cursor(){};
@@ -336,10 +337,12 @@ class FadeBlockCursor : public Cursor {
HMODULE m_hUser32;
BLENDFUNCTION m_bfn;
HDC m_hMemDC;
#if 0
HBITMAP m_hBmp;
HBITMAP m_hBmpOld;
int m_nBmpWidth;
int m_nBmpHeight;
#endif
};
/////////////////////////////////////////////////////////////////////////////
-2
View File
@@ -929,7 +929,6 @@ BOOLEAN EnterAIMMembers()
SetButtonCursor(giNextButton, CURSOR_WWW );
}
gbCurrentSoldier = AimMercArray[gbCurrentIndex];
gbCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId;
gbCurrentSoldierBio = gAimAvailability[AimMercArray[gbCurrentIndex]].AimBio;
@@ -3294,7 +3293,6 @@ void SelectShutUpMercRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
fInCallBack = FALSE;
gfStopMercFromTalking = TRUE;
fInCallBack = TRUE;
}
+1 -1
View File
@@ -2297,7 +2297,7 @@ UINT16 DisplayProtection(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight)
break;
}
swprintf(sTemp, L"%d", iProtection, Armour[ Item[ usIndex ].ubClassIndex ].ubProtection);
swprintf(sTemp, L"%d", iProtection, Armour[ Item[ usIndex ].ubClassIndex ].ubProtection); // FIXME: param4 is unused
wcscat( sTemp, L"%%" );
swprintf( sTemp2, L"(%d)", Armour[ Item[ usIndex ].ubClassIndex ].ubProtection );
wcscat( sTemp, sTemp2 );
+2 -5
View File
@@ -2188,10 +2188,7 @@ INT32 DetermineNewValue( INT32 iNewX )
INT32 iNewValue=0;
INT32 iStartLoc = SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X;
INT32 iPositionX = iNewX - iStartLoc;
FLOAT fPercentOfBar=0.0f;
fPercentOfBar = iPositionX / ( FLOAT)( BAR_WIDTH - SLIDER_BAR_WIDTH );
FLOAT fPercentOfBar = iPositionX / ( FLOAT)( BAR_WIDTH - SLIDER_BAR_WIDTH );
iNewValue = (INT32)( fPercentOfBar * ( iMaxAttribute - (FLOAT)iMinAttribute ) );
@@ -2235,4 +2232,4 @@ INT8 StartingLevelChosen()
return(iStartingLevel);
else
return(1);
}
}
-1
View File
@@ -483,7 +483,6 @@ void AssignCharacterTraitHelpText( UINT8 ubNumber )
{
CHAR16 apStr[ 2000 ];
swprintf( apStr, L"" );
swprintf( apStr, gzIMPNewCharacterTraitsHelpTexts[ubNumber] );
// Set region help text
+1 -1
View File
@@ -409,7 +409,7 @@ UINT32 PlayVoice( void )
char caVoiceSample[] = "Speech\\%03d_001.wav";
Assert((iSlot >= 0) && (iSlot <= 999));
sprintf(caVoiceSample, caVoiceSample, iSlot);
sprintf(caVoiceSample, "Speech\\%03d_001.wav", iSlot);
return( PlayJA2SampleFromFile( caVoiceSample, RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) );
}
-2
View File
@@ -5546,8 +5546,6 @@ BOOLEAN DisplayNumberOfPagesToThisEmail( INT32 iViewerY )
// BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + INDENT_X_OFFSET, VIEWER_Y + iViewerY + INDENT_Y_OFFSET - 10, VO_BLT_SRCTRANSPARENCY,NULL );
// DeleteVideoObjectFromIndex( uiMailIndent );
giNumberOfPagesToCurrentEmail = ( giNumberOfPagesToCurrentEmail );
// parse current page and max number of pages to email
swprintf( sString,L"%d / %d", ( giMessagePage + 1 ), ( giNumberOfPagesToCurrentEmail - 1 ) );
+1 -1
View File
@@ -1465,7 +1465,7 @@ void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance)
break;
case PAY_SPECK_FOR_MERC:
swprintf(pString, L"%s", pTransactionText[ PAY_SPECK_FOR_MERC ], gMercProfiles[pFinance->ubSecondCode].zName);
swprintf(pString, L"%s", pTransactionText[ PAY_SPECK_FOR_MERC ], gMercProfiles[pFinance->ubSecondCode].zName); // FIXME: param4 unused
break;
case MEDICAL_DEPOSIT:
+3 -1
View File
@@ -401,7 +401,9 @@ void ChangingFloristGallerySubPage( UINT8 ubSubPageNumber )
//there are 3 flowers per page
if( ubSubPageNumber == FLOR_GALLERY_NUMBER_FLORAL_IMAGES )
ubSubPageNumber = 4;
{
ubSubPageNumber = 4; Assert(false); // FIXME: out-of-bounds (FloristGallerySubPagesVisitedFlag[4])
}
else
ubSubPageNumber = ubSubPageNumber / 3;
+37 -40
View File
@@ -1,40 +1,37 @@
#include "../include/Plan.h"
#include "../../TacticalAI/ai.h"
#include "../../TacticalAI/AIInternals.h" // ACTING_ON_SCHEDULE
#include "../../TacticalAI/NPC.h" // NPCReachedDestination
#include "../../Tactical/Animation Control.h" // defines ANIM_...
#include "../../Tactical/Soldier Macros.h" // CREATURE_OR_BLOODCAT
#include "../../Tactical/opplist.h" // EndMuzzleFlash
#include "../../Tactical/Dialogue Control.h" // DialogueQueueIsEmpty
#include "../../TileEngine/Isometric Utils.h" // defines NOWHERE
#include "../../Utils/Debug Control.h" // LiveMessage
#include "../../Utils/Font Control.h" // ScreenMsg about deadlock
#include "../../Utils/message.h" // ditto
#include "../../TileEngine/Render Fun.h" // defines InARoom
#include "../../Strategic/quests.h" // IN_BROTHEL
// FIXME uagh, these need to go
extern BOOLEAN gfUIInDeadlock;
extern UINT8 gUIDeadlockedSoldier;
void HandleAITacticalTraversal(SOLDIERTYPE* pSoldier); // defined in TacticalAI/AIMain.cpp
namespace AI
{
namespace tactical
{
PlanInputData::PlanInputData(bool turn_based, const TacticalStatusType& tactical_status)
: turn_based_(turn_based),
tactical_status_(tactical_status)
{
}
Plan::Plan(SOLDIERTYPE* npc)
: npc_(npc)
{
}
}
}
#include "../include/Plan.h"
#include "../../TacticalAI/ai.h"
#include "../../TacticalAI/AIInternals.h" // ACTING_ON_SCHEDULE
#include "../../TacticalAI/NPC.h" // NPCReachedDestination
#include "../../Tactical/Animation Control.h" // defines ANIM_...
#include "../../Tactical/Soldier Macros.h" // CREATURE_OR_BLOODCAT
#include "../../Tactical/opplist.h" // EndMuzzleFlash
#include "../../Tactical/Dialogue Control.h" // DialogueQueueIsEmpty
#include "../../TileEngine/Isometric Utils.h" // defines NOWHERE
#include "../../Utils/Debug Control.h" // LiveMessage
#include "../../Utils/Font Control.h" // ScreenMsg about deadlock
#include "../../Utils/message.h" // ditto
#include "../../TileEngine/Render Fun.h" // defines InARoom
#include "../../Strategic/quests.h" // IN_BROTHEL
void HandleAITacticalTraversal(SOLDIERTYPE* pSoldier); // defined in TacticalAI/AIMain.cpp
namespace AI
{
namespace tactical
{
PlanInputData::PlanInputData(bool turn_based, const TacticalStatusType& tactical_status)
: turn_based_(turn_based),
tactical_status_(tactical_status)
{
}
Plan::Plan(SOLDIERTYPE* npc)
: npc_(npc)
{
}
}
}
+2 -2
View File
@@ -21,7 +21,7 @@ void ZFree( voidpf opaque, voidpf address )
MemFree( address );
}
PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize )
PTR DecompressInit( PTR pCompressedData, UINT32 uiDataSize )
{
z_stream * pZStream;
int iZRetCode;
@@ -47,7 +47,7 @@ PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize )
}
// set up our parameters
pZStream->next_in = pCompressedData;
pZStream->next_in = (BYTE*)pCompressedData;
pZStream->avail_in = uiDataSize;
return( (PTR) pZStream );
}
@@ -504,7 +504,7 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe
else if ( uiFlags & DDBLT_KEYSRC )
{
// Get 16 bpp color key.....
ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey);
ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey); // FIXME: pSrcSurface might be NULL
if (ReturnCode == DD_OK)
{
+2 -2
View File
@@ -569,7 +569,7 @@ INT CompareFileNames( CHAR8 *arg1[], FileHeaderStruct **arg2 )
TempFileHeader = ( FileHeaderStruct * ) arg2;
sprintf( sSearchKey, "%s", arg1);
sprintf( sSearchKey, "%s", arg1); // FIXME: arg1 must be a string pointer
sprintf( sFileNameWithPath, "%s%s", gFileDataBase.pLibraries[ gsCurrentLibrary ].sLibraryPath, TempFileHeader->pFileName );
@@ -1111,7 +1111,7 @@ INT32 CompareDirEntryFileNames( CHAR8 *arg1[], DIRENTRY **arg2 )
TempDirEntry = ( DIRENTRY * ) arg2;
sprintf( sSearchKey, "%s", arg1);
sprintf( sSearchKey, "%s", arg1); // FIXME: arg1 must be a string pointer
sprintf( sFileNameWithPath, "%s", TempDirEntry->sFileName );
+2 -2
View File
@@ -426,7 +426,7 @@ BOOLEAN CopyImageToBuffer( HIMAGE hImage, UINT32 fBufferType, BYTE *pDestBuf, UI
if ( hImage->ubBitDepth == 24 && fBufferType == BUFFER_16BPP )
{
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_3, "Copying 24 BPP Imagery to 16BPP Buffer." );
SGP_THROW("not yet implemented");
AssertMsg(false,"not yet implemented");
return( FALSE );
}
@@ -583,7 +583,7 @@ BOOLEAN Copy8BPPCompressedImageTo16BPPBuffer( HIMAGE hImage, BYTE *pDestBuf, UIN
CHECKF( pDecompPtr );
// Allocate memory for one scanline
pScanLine = MemAlloc( hImage->usWidth );
pScanLine = (UINT8*) MemAlloc( hImage->usWidth );
CHECKF( pScanLine );
memset( pScanLine, 0, hImage->usWidth );
+2 -2
View File
@@ -1852,13 +1852,13 @@ BOOLEAN RemoveVSurfaceRegion( HVSURFACE hVSurface, UINT16 usIndex )
BOOLEAN ClearAllVSurfaceRegions( HVSURFACE hVSurface )
{
UINT32 uiListSize, cnt;
UINT32 uiListSize;
Assert( hVSurface != NULL );
uiListSize = ListSize( hVSurface->RegionList );
for ( cnt = uiListSize - 1; cnt >= 0; cnt-- )
for ( INT32 cnt = uiListSize - 1; cnt >= 0; cnt-- )
{
RemoveVSurfaceRegion( hVSurface, (UINT16)cnt );
}
+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;
+2 -2
View File
@@ -1284,7 +1284,7 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent )
// Just try/catch (ugly, but works).
__try
{
for(UINT32 i=0; i<WORLD_MAX ;i+=4)
for(UINT32 i=0; i<(UINT32)WORLD_MAX ;i+=4)
{
gubWorldTileInLight[i] = InLightAtNight(i, gpWorldLevelData[ i ].sHeight);
gubIsCorpseThere[i] = IsCorpseAtGridNo( i, gpWorldLevelData[ i ].sHeight );
@@ -7049,4 +7049,4 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec
}
return( FALSE );
}
}
+1 -2
View File
@@ -6,7 +6,6 @@
#include "builddefines.h"
#include <stdio.h>
#include "sgp.h"
//#include "soldier control.h"
#include "Encrypted File.h"
#include "faces.h"
#include "wcheck.h"
@@ -25,7 +24,6 @@
#include "items.h"
#include "text.h"
#include "overhead.h"
//#include "soldier control.h"
#include "assignments.h"
#include "strategic.h"
#include "strategicmap.h"
@@ -4160,6 +4158,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
{
pSoldier = ChangeSoldierTeam( pSoldier, CIV_TEAM );
}
Assert(pSoldier);
// remove profile from map
gMercProfiles[ pSoldier->ubProfile ].sSectorX = 0;
gMercProfiles[ pSoldier->ubProfile ].sSectorY = 0;
+1 -3
View File
@@ -3515,13 +3515,11 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier
UINT8 ubNumMercs = 0;
UINT8 ubChosenMerc;
BOOLEAN fDoSomeoneElse = FALSE;
BOOLEAN fCanWeSeeLocation = FALSE;
gfLastMercTalkedAboutKillingID = pKilledSoldier->ubID;
// Can we see location?
fCanWeSeeLocation = ( SoldierTo3DLocationLineOfSightTest( pKillerSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) != 0 );
BOOLEAN fCanWeSeeLocation = ( SoldierTo3DLocationLineOfSightTest( pKillerSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) != 0 );
// Are we killing mike?
if ( pKilledSoldier->ubProfile == MIKE && pKillerSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC )
+7 -3
View File
@@ -1715,7 +1715,7 @@ public:
// Copy Constructor
OLDSOLDIERTYPE_101(const OLDSOLDIERTYPE_101& src) {
memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD);
memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD); // FIXME: memcpy std::vector
inv = src.inv;
bNewItemCount = src.bNewItemCount;
bNewItemCycleCount = src.bNewItemCycleCount;
@@ -1725,7 +1725,7 @@ public:
OLDSOLDIERTYPE_101& operator=(const OLDSOLDIERTYPE_101& src)
{
if (this != &src) {
memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD);
memcpy(this, &src, SIZEOF_OLDSOLDIERTYPE_101_POD); // FIXME: memcpy std::vector
inv = src.inv;
bNewItemCount = src.bNewItemCount;
bNewItemCycleCount = src.bNewItemCycleCount;
@@ -1741,7 +1741,7 @@ public:
// Use this instead of the old method of calling memset!
// Note that the constructor does this automatically.
void initialize() {
memset( this, 0, SIZEOF_OLDSOLDIERTYPE_101_POD);
memset( this, 0, SIZEOF_OLDSOLDIERTYPE_101_POD); // FIXME: memcpy std::vector
inv.clear();
for (int idx=0; idx < (int)inv.size(); ++idx) {
bNewItemCount[idx] = 0;
@@ -2402,6 +2402,10 @@ public:
INT32 sPlotSrcGrid;
}; // OLDSOLDIERTYPE_101;
void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReason );
#endif
+1 -1
View File
@@ -219,7 +219,7 @@ public:
UINT16 GetChecksum();
SOLDIERCREATE_STRUCT& SOLDIERCREATE_STRUCT::operator=(const _OLD_SOLDIERCREATE_STRUCT& src);//dnl ch42 250909
SOLDIERCREATE_STRUCT& operator=(const _OLD_SOLDIERCREATE_STRUCT& src);//dnl ch42 250909
// Initialize the soldier.
// Use this instead of the old method of calling memset!
+1 -4
View File
@@ -15,7 +15,6 @@
#include "math.h"
#include "jascreens.h"
#include "pathai.h"
//#include "Soldier Control.h"
#include "Animation Control.h"
#include "Animation Data.h"
#include "Event Pump.h"
@@ -356,11 +355,9 @@ void QueryTBLeftButton( UINT32 *puiNewEvent )
// If we're on terrain,
if ( gusSelectedSoldier != NOBODY )
{
INT8 bReturnVal = FALSE;
GetSoldier( &pSoldier, gusSelectedSoldier );
bReturnVal = HandleMoveModeInteractiveClick( usMapPos, puiNewEvent );
INT8 bReturnVal = HandleMoveModeInteractiveClick( usMapPos, puiNewEvent );
// All's OK for interactive tile?
if ( bReturnVal == -2 )
+1
View File
@@ -1739,6 +1739,7 @@ void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridN
#endif
pSoldier = GetSoldierStructureForVehicle( ubID );
Assert(pSoldier);
if ( sDmg > pSoldier->stats.bLife )
{
+1
View File
@@ -4304,6 +4304,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
OBJECTTYPE * pObj;
pBullet = GetBulletPtr( iBullet );
Assert(pBullet);
// Flugente: check for underbarrel weapons and use that object if necessary
pObj = MercPtrs[ ubAttackerID ]->GetUsedWeapon( &MercPtrs [ ubAttackerID ]->inv[MercPtrs[ubAttackerID]->ubAttackingHand] );
+3 -2
View File
@@ -349,7 +349,8 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
if ( gubGridNoValue == 255 )
{
// Reset!
memset( gubGridNoMarkers, 0, sizeof( gubGridNoMarkers ) );
Assert(gubGridNoMarkers);
memset(gubGridNoMarkers, 0, sizeof(UINT8)*WORLD_MAX);
gubGridNoValue = 1;
}
@@ -373,7 +374,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
range = pSoldier->bViewRange;
// Flugente: adjust sightrange
range = (UINT16)( (range * (100 + pSoldier->GetSightRangeBonus()) ) / 100);
range = (UINT8)( (range * (100 + pSoldier->GetSightRangeBonus()) ) / 100);
// balance item viewing range between normal and the limit set by opplist-type functions -- CJC
range = (AdjustMaxSightRangeForEnvEffects( pSoldier, LightTrueLevel( pSoldier->sGridNo, pSoldier->pathing.bLevel), range ) + range) / 2;
+1 -1
View File
@@ -155,7 +155,7 @@ NPCQuoteInfo * LoadQuoteFile( UINT8 ubNPC )
//new profiles by Jazz
else if ( gProfilesIMP[ubNPC].ProfilId == ubNPC || gProfilesAIM[ubNPC].ProfilId == ubNPC || gProfilesMERC[ubNPC].ProfilId == ubNPC || ( gProfilesRPC[ubNPC].ProfilId == ubNPC && gMercProfiles[ ubNPC ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) )
{
sprintf( zFileName, "NPCData\\000.npc", ubNPC );
sprintf( zFileName, "NPCData\\000.npc", ubNPC ); // FIXME: extra/unused argument
}
else
{
-4
View File
@@ -1271,10 +1271,6 @@ void ChooseRandomEdgepoints()
}
else
{
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData < 0 || gMercPlacement[ i ].pSoldier->usStrategicInsertionData > WORLD_MAX )
{
i = i;
}
gMercPlacement[ i ].pSoldier->ubStrategicInsertionCode = gMercPlacement[ i ].ubStrategicInsertionCode;
}
}
+1
View File
@@ -827,6 +827,7 @@ BOOLEAN IsNotRestrictedWindow(STRUCTURE * pStructure)
GetTileType( pNode->usIndex, &uiTileType );
UINT16 RestrSubIndex;
Assert(pNode);
GetSubIndexFromTileIndex( pNode->usIndex, (UINT16 *)&RestrSubIndex );
//этот тип окон не содержится в 0 тайлсете, проверка нулевого тайлсета в этом случае не нужна
+2 -2
View File
@@ -1777,7 +1777,7 @@ BOOLEAN registerPopupRegion(UINT16 rID, UINT32 cID)
pi->regionId = rID;
pi->classId = cID;
gPopupRegionIndex.push_back(*pi);
gPopupRegionIndex.push_back(*pi); // FIXME: memory leak
gPopupRegionIndexCounter++;
return TRUE;
@@ -1851,4 +1851,4 @@ void popupMouseClickCallback(MOUSE_REGION *pRegion, INT32 iReason)
if (p) {
p->MenuBtnCallBack(pRegion, iReason);
}
}
}