diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index ab84c4498..9b626576a 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -232,7 +232,7 @@ typedef struct BOOLEAN fHavePurchasedItemsFromTony; //The selected soldier in tactical - UINT16 usSelectedSoldier; + SoldierID usSelectedSoldier; // The x and y scroll position INT16 sRenderCenterX; @@ -313,7 +313,7 @@ typedef struct INT16 sCurInterfacePanel; - UINT16 ubSMCurrentMercID; + SoldierID ubSMCurrentMercID; BOOLEAN fFirstTimeInMapScreen; @@ -321,9 +321,9 @@ typedef struct BOOLEAN fDisableMapInterfaceDueToBattle; - INT32 sBoxerGridNo[ NUM_BOXERS ]; - UINT16 ubBoxerID[ NUM_BOXERS ]; - BOOLEAN fBoxerFought[ NUM_BOXERS ]; + INT32 sBoxerGridNo[ NUM_BOXERS ]; + SoldierID ubBoxerID[ NUM_BOXERS ]; + BOOLEAN fBoxerFought[ NUM_BOXERS ]; BOOLEAN fHelicopterDestroyed; //if the chopper is destroyed BOOLEAN fShowMapScreenHelpText; //If true, displays help in mapscreen @@ -341,8 +341,8 @@ typedef struct BOOLEAN ubPlayerProgressSkyriderLastCommentedOn; - BOOLEAN gfMeanwhileTryingToStart; - BOOLEAN gfInMeanwhile; + BOOLEAN gfMeanwhileTryingToStart; + BOOLEAN gfInMeanwhile; // list of dead guys for squads...in id values->-1 means no one home INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; @@ -8536,7 +8536,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) // Save boxing info memcpy( &sGeneralInfo.sBoxerGridNo, &gsBoxerGridNo, NUM_BOXERS * sizeof( INT32 ) ); - memcpy( &sGeneralInfo.ubBoxerID, &gubBoxerID, NUM_BOXERS * sizeof( INT8 ) ); + memcpy( &sGeneralInfo.ubBoxerID, &gubBoxerID, NUM_BOXERS * sizeof( UINT16 ) ); memcpy( &sGeneralInfo.fBoxerFought, &gfBoxerFought, NUM_BOXERS * sizeof( BOOLEAN ) ); //Save the helicopter status @@ -9068,7 +9068,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) if( sGeneralInfo.ubSMCurrentMercID == NOBODY) gpSMCurrentMerc = NULL; else - gpSMCurrentMerc = &Menptr[ sGeneralInfo.ubSMCurrentMercID ]; + gpSMCurrentMerc = sGeneralInfo.ubSMCurrentMercID; //Set the interface panel to the team panel ShutdownCurrentPanel( ); diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index e5634f6d8..b7a002ab3 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -3601,7 +3601,7 @@ static int l_gubBoxerID(lua_State *L) if ( n >= 2 ) { UINT8 val = lua_tointeger( L, 1 ); - UINT8 val2 = lua_tointeger( L, 2 ); + UINT16 val2 = lua_tointeger( L, 2 ); if (val <= 2) { diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index bb161ba62..b48a44479 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -23,13 +23,13 @@ #include "message.h" #include "GameSettings.h" // added by SANDRO -INT32 gsBoxerGridNo[ NUM_BOXERS ] = { 11393, 11233, 11073 }; -UINT16 gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; -BOOLEAN gfBoxerFought[ NUM_BOXERS ] = { FALSE, FALSE, FALSE }; -BOOLEAN gfLastBoxingMatchWonByPlayer = FALSE; -UINT8 gubBoxingMatchesWon = 0; -UINT8 gubBoxersRests = 0; -BOOLEAN gfBoxersResting = FALSE; +INT32 gsBoxerGridNo[ NUM_BOXERS ] = { 11393, 11233, 11073 }; +SoldierID gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; +BOOLEAN gfBoxerFought[ NUM_BOXERS ] = { FALSE, FALSE, FALSE }; +BOOLEAN gfLastBoxingMatchWonByPlayer = FALSE; +UINT8 gubBoxingMatchesWon = 0; +UINT8 gubBoxersRests = 0; +BOOLEAN gfBoxersResting = FALSE; extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); @@ -326,8 +326,8 @@ void CountPeopleInBoxingRingAndDoActions( void ) BOOLEAN CheckOnBoxers( void ) { - UINT32 uiLoop; - UINT16 ubID; + UINT32 uiLoop; + SoldierID ubID; // repick boxer IDs every time if ( gubBoxerID[0] == NOBODY ) @@ -337,15 +337,15 @@ BOOLEAN CheckOnBoxers( void ) { ubID = WhoIsThere2( gsBoxerGridNo[ uiLoop ], 0 ); - // WANNE: Safty check! + // WANNE: Safety check! if (ubID < TOTAL_SOLDIERS) { - if ( FindObjClass( MercPtrs[ ubID ], IC_WEAPON ) == NO_SLOT && - IS_MERC_BODY_TYPE( MercPtrs[ ubID ] ) ) + if ( FindObjClass( ubID, IC_WEAPON ) == NO_SLOT && + IS_MERC_BODY_TYPE( ubID ) ) { // no weapon and not a civilian so this guy is a boxer gubBoxerID[ uiLoop ] = ubID; - DebugQuestInfo(String("CheckOnBoxers: set gubBoxerID[%d] %d", ubID, gubBoxerID[uiLoop])); + DebugQuestInfo(String("CheckOnBoxers: set gubBoxerID[%d] to %d", uiLoop, ubID.i)); } } } @@ -375,8 +375,8 @@ BOOLEAN BoxerExists( void ) BOOLEAN PickABoxer( void ) { - UINT32 uiLoop; - SOLDIERTYPE* pBoxer; + UINT32 uiLoop; + SOLDIERTYPE *pBoxer; for( uiLoop = 0; uiLoop < NUM_BOXERS; ++uiLoop ) { @@ -385,11 +385,11 @@ BOOLEAN PickABoxer( void ) if ( gfBoxerFought[ uiLoop ] ) { // pathetic attempt to prevent multiple AI boxers - MercPtrs[ gubBoxerID[ uiLoop ] ]->DeleteBoxingFlag(); + gubBoxerID[ uiLoop ]->DeleteBoxingFlag(); } else { - pBoxer = MercPtrs[ gubBoxerID[ uiLoop ] ]; + pBoxer = gubBoxerID[ uiLoop ]; // pick this boxer! if ( pBoxer->bActive && pBoxer->bInSector && pBoxer->stats.bLife >= OKLIFE ) { @@ -446,7 +446,7 @@ BOOLEAN BoxerAvailable( void ) { if ( gubBoxerID[ ubLoop ] != NOBODY && !gfBoxerFought[ ubLoop ] ) { - if( MercPtrs[ gubBoxerID[ ubLoop ] ]->bActive && MercPtrs[ gubBoxerID[ ubLoop ] ]->bInSector && MercPtrs[ gubBoxerID[ ubLoop ] ]->stats.bLife >= OKLIFE ) + if( gubBoxerID[ ubLoop ]->bActive && gubBoxerID[ ubLoop ]->bInSector && gubBoxerID[ ubLoop ]->stats.bLife >= OKLIFE ) return( TRUE ); } } @@ -458,13 +458,13 @@ BOOLEAN BoxerAvailable( void ) // SEQUEL FIGHT. Maybe we could check Kingpin's location instead! UINT8 BoxersAvailable( void ) { - UINT8 ubCount = 0; + UINT8 ubCount = 0; for (UINT8 ubLoop = 0; ubLoop < NUM_BOXERS; ++ubLoop) { if ( gubBoxerID[ ubLoop ] != NOBODY && !gfBoxerFought[ ubLoop ] ) { - if( MercPtrs[ gubBoxerID[ ubLoop ] ]->bActive && MercPtrs[ gubBoxerID[ ubLoop ] ]->bInSector && MercPtrs[ gubBoxerID[ ubLoop ] ]->stats.bLife >= OKLIFE ) + if( gubBoxerID[ ubLoop ]->bActive && gubBoxerID[ ubLoop ]->bInSector && gubBoxerID[ ubLoop ]->stats.bLife >= OKLIFE ) ++ubCount; } } diff --git a/Tactical/Boxing.h b/Tactical/Boxing.h index 4d4abf6e2..8f0dd5c51 100644 --- a/Tactical/Boxing.h +++ b/Tactical/Boxing.h @@ -19,14 +19,14 @@ enum DisqualificationReasons BAD_ATTACK } ; -extern INT32 gsBoxerGridNo[ NUM_BOXERS ]; -extern UINT16 gubBoxerID[ NUM_BOXERS ]; -extern BOOLEAN gfBoxerFought[ NUM_BOXERS ]; -extern INT8 gbBoxingState; -extern BOOLEAN gfLastBoxingMatchWonByPlayer; -extern UINT8 gubBoxingMatchesWon; -extern UINT8 gubBoxersRests; -extern BOOLEAN gfBoxersResting; +extern INT32 gsBoxerGridNo[ NUM_BOXERS ]; +extern SoldierID gubBoxerID[ NUM_BOXERS ]; +extern BOOLEAN gfBoxerFought[ NUM_BOXERS ]; +extern INT8 gbBoxingState; +extern BOOLEAN gfLastBoxingMatchWonByPlayer; +extern UINT8 gubBoxingMatchesWon; +extern UINT8 gubBoxersRests; +extern BOOLEAN gfBoxersResting; extern void BoxingPlayerDisqualified( SOLDIERTYPE * pOffender, INT8 bReason ); extern BOOLEAN PickABoxer( void ); @@ -43,4 +43,4 @@ extern BOOLEAN BoxerExists( void ); extern UINT8 CountPeopleInBoxingRing( void ); extern void ClearAllBoxerFlags( void ); -#endif \ No newline at end of file +#endif