diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index db2b48fe..ec379823 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -118,7 +118,7 @@ enum{ REPAIR_MENU_VEHICLE1 = 0, REPAIR_MENU_VEHICLE2, REPAIR_MENU_VEHICLE3, -// REPAIR_MENU_SAM_SITE, + REPAIR_MENU_SAM_SITE, REPAIR_MENU_ROBOT, REPAIR_MENU_ITEMS, REPAIR_MENU_CANCEL, @@ -379,14 +379,6 @@ UINT8 gubFacilityLineForSubmenu; // Which line to highlight in the facility menu #define MAX_DISTANCE_FOR_TRAINING 5 */ -/* -// controls how easily SAM sites are repaired -// NOTE: A repairman must generate a least this many points / hour to be ABLE to repair a SAM site at all! -#define SAM_SITE_REPAIR_DIVISOR 10 - -// minimum condition a SAM site must be in to be fixable -#define MIN_CONDITION_TO_FIX_SAM 20 -*/ void MakeSoldierKnownAsMercInPrison(SOLDIERTYPE *pSoldier, INT16 sMapX, INT16 sMapY); @@ -649,12 +641,8 @@ void HaveMercSayWhyHeWontLeave( SOLDIERTYPE *pSoldier ); //Ja25 UB BOOLEAN CanMercBeAllowedToLeaveTeam( SOLDIERTYPE *pSoldier ); //JA25 UB #endif -/* No point in allowing SAM site repair any more. Jan/13/99. ARM BOOLEAN IsTheSAMSiteInSectorRepairable( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); -BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ); -BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints ); -BOOLEAN IsSoldierCloseEnoughToSAMControlPanel( SOLDIERTYPE *pSoldier ); -*/ +BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier ); /* Assignment distance limits removed. Sep/11/98. ARM BOOLEAN IsSoldierCloseEnoughToADoctor( SOLDIERTYPE *pPatient ); @@ -979,6 +967,12 @@ BOOLEAN IsAnythingAroundForSoldierToRepair( SOLDIERTYPE * pSoldier ) return( TRUE ); } + // SAM site? + if ( CanSoldierRepairSAM( pSoldier ) ) + { + return(TRUE); + } + // vehicles? if ( pSoldier->bSectorZ == 0 ) { @@ -1026,6 +1020,10 @@ BOOLEAN HasCharacterFinishedRepairing( SOLDIERTYPE * pSoldier ) { fCanStillRepair = CanCharacterRepairRobot( pSoldier ); } + else if ( pSoldier->flags.fFixingSAMSite ) + { + fCanStillRepair = CanSoldierRepairSAM( pSoldier ); + } else // repairing items { fCanStillRepair = DoesCharacterHaveAnyItemsToRepair( pSoldier, FINAL_REPAIR_PASS ); @@ -4786,6 +4784,31 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) ubRepairPtsLeft -= HandleRepairOfRobotBySoldier( pSoldier, ubRepairPtsLeft, &fNothingLeftToRepair ); } } + else if ( pSoldier->flags.fFixingSAMSite ) + { + if ( CanSoldierRepairSAM( pSoldier ) ) + { + // repair the SAM + INT16 sStrategicSector = CALCULATE_STRATEGIC_INDEX( pSoldier->sSectorX, pSoldier->sSectorY ); + + INT8 samrepairptsused = min( ubRepairPtsLeft / SAM_SITE_REPAIR_DIVISOR, 100 - StrategicMap[sStrategicSector].bSAMCondition ); + + StrategicMap[sStrategicSector].bSAMCondition += samrepairptsused; + + if ( StrategicMap[sStrategicSector].bSAMCondition > MIN_CONDITION_SHOW_SAM_CONTROLLER ) + { + // Bring Hit points back up to full, adjust graphic to full graphic..... + UpdateSAMDoneRepair( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); + } + else + { + // SAM site may have been put back into working order... + UpdateAirspaceControl( ); + } + + ubRepairPtsLeft -= samrepairptsused * SAM_SITE_REPAIR_DIVISOR; + } + } else { if (gGameExternalOptions.fAdditionalRepairMode) @@ -8537,15 +8560,12 @@ BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ) } } - -/* No point in allowing SAM site repair any more. Jan/13/99. ARM // is there a SAM SITE Here? - if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) + if ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { // SAM site - AddMonoString(&hStringHandle, pRepairStrings[ 1 ] ); + AddMonoString( (UINT32 *)&hStringHandle, pRepairStrings[1] ); } -*/ // is the ROBOT here? if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) @@ -8613,19 +8633,17 @@ void HandleShadingOfLinesForRepairMenu( void ) ShadeStringInBox( ghRepairBox, iCount ); } - iCount++; + ++iCount; } } } } } - - -/* No point in allowing SAM site repair any more. Jan/13/99. ARM - if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) + + if ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { // handle enable disable of repair sam option - if( CanSoldierRepairSAM( pSoldier, SAM_SITE_REPAIR_DIVISOR ) ) + if( CanSoldierRepairSAM( pSoldier ) ) { // unshade SAM line UnShadeStringInBox( ghRepairBox, iCount ); @@ -8636,9 +8654,8 @@ void HandleShadingOfLinesForRepairMenu( void ) ShadeStringInBox( ghRepairBox, iCount ); } - iCount++; + ++iCount; } -*/ if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { @@ -8654,7 +8671,7 @@ void HandleShadingOfLinesForRepairMenu( void ) ShadeStringInBox( ghRepairBox, iCount ); } - iCount++; + ++iCount; } if ( DoesCharacterHaveAnyItemsToRepair( pSoldier, FINAL_REPAIR_PASS ) ) @@ -8668,7 +8685,7 @@ void HandleShadingOfLinesForRepairMenu( void ) ShadeStringInBox( ghRepairBox, iCount ); } - iCount++; + ++iCount; } @@ -8746,17 +8763,18 @@ void CreateDestroyMouseRegionForRepairMenu( void ) } } -/* No point in allowing SAM site repair any more. Jan/13/99. ARM + // Now there is. Flugente 2016-10-13 + // No point in allowing SAM site repair any more. Jan/13/99. ARM // SAM site - if( ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == TRUE ) && ( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) ) + if ( IsThisSectorASAMSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { MSYS_DefineRegion( &gRepairMenuRegion[ iCount ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * iCount ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + GetTopMarginSize( ghAssignmentBox ) + ( iFontHeight ) * ( iCount + 1 ) ), MSYS_PRIORITY_HIGHEST - 4 , MSYS_NO_CURSOR, RepairMenuMvtCallback, RepairMenuBtnCallback ); - MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, REPAIR_MENU_SAM_SITE ); - iCount++; + MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 0, iCount ); + MSYS_SetRegionUserData( &gRepairMenuRegion[ iCount ], 1, REPAIR_MENU_SAM_SITE ); + ++iCount; } -*/ // robot if( IsRobotInThisSector( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) @@ -8871,10 +8889,18 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fShowAssignmentMenu = FALSE; } -/* No point in allowing SAM site repair any more. Jan/13/99. ARM + // Now there is. Flugente 2016-10-13 + // No point in allowing SAM site repair any more. Jan/13/99. ARM else if( iRepairWhat == REPAIR_MENU_SAM_SITE ) { // repair SAM site + pSoldier->bOldAssignment = pSoldier->bAssignment; + + // remove from squad + if ( pSoldier->bOldAssignment == VEHICLE ) + { + TakeSoldierOutOfVehicle( pSoldier ); + } // remove from squad RemoveCharacterFromSquads( pSoldier ); @@ -8897,7 +8923,6 @@ void RepairMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) // assign to a movement group AssignMercToAMovementGroup( pSoldier ); } -*/ else if( iRepairWhat == REPAIR_MENU_ROBOT ) { // repair ROBOT @@ -15706,33 +15731,21 @@ void SetSoldierAssignment( SOLDIERTYPE *pSoldier, INT8 bAssignment, INT32 iParam } - -/* No point in allowing SAM site repair any more. Jan/13/99. ARM -BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints) +// Now there is. Flugente 2016-10-13 +// No point in allowing SAM site repair any more. Jan/13/99. ARM +BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier ) { - INT16 sGridNoA = 0, sGridNoB = 0; - - // is the soldier in the sector as the SAM - if( SoldierInSameSectorAsSAM( pSoldier ) == FALSE ) + // Flugente: certain traits are required for this + if ( gGameOptions.fNewTraitSystem ) { - return( FALSE ); + if ( !HAS_SKILL_TRAIT( pSoldier, TECHNICIAN_NT ) ) + return(FALSE); } - - // is the soldier close enough to the control panel? - if( IsSoldierCloseEnoughToSAMControlPanel( pSoldier ) == FALSE ) - { - return( FALSE ); - } - + else if ( !HAS_SKILL_TRAIT( pSoldier, ELECTRONICS_OT ) ) + return(FALSE); + //can it be fixed? - if( IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) == FALSE ) - { - return( FALSE ); - } - - // is he good enough? (Because of the division of repair pts in SAM repair formula, a guy with any less that this - // can't make any headway - if (bRepairPoints < SAM_SITE_REPAIR_DIVISOR ) + if( !IsTheSAMSiteInSectorRepairable( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) ) { return( FALSE ); } @@ -15741,24 +15754,20 @@ BOOLEAN CanSoldierRepairSAM( SOLDIERTYPE *pSoldier, INT8 bRepairPoints) } BOOLEAN IsTheSAMSiteInSectorRepairable( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) -{ - INT32 iCounter = 0; - INT8 bSAMCondition; - - +{ // is the guy above ground, if not, it can't be fixed, now can it? if( sSectorZ != 0 ) { return( FALSE ); } - for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < NUMBER_OF_SAMS; ++iCounter ) { if( pSamList[ iCounter ] == SECTOR( sSectorX, sSectorY ) ) { - bSAMCondition = StrategicMap[ CALCULATE_STRATEGIC_INDEX( sSectorX, sSectorY ) ].bSAMCondition; + INT8 bSAMCondition = StrategicMap[CALCULATE_STRATEGIC_INDEX( sSectorX, sSectorY )].bSAMCondition; - if( ( bSAMCondition < 100 ) && ( bSAMCondition >= MIN_CONDITION_TO_FIX_SAM ) ) + if ( bSAMCondition < 100 ) { return( TRUE ); } @@ -15774,52 +15783,6 @@ BOOLEAN IsTheSAMSiteInSectorRepairable( INT16 sSectorX, INT16 sSectorY, INT16 sS return( FALSE ); } -BOOLEAN SoldierInSameSectorAsSAM( SOLDIERTYPE *pSoldier ) -{ - INT32 iCounter = 0; - - // is the soldier on the surface? - if( pSoldier->bSectorZ != 0 ) - { - return( FALSE ); - } - - // now check each sam site in the list - for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) - { - if( pSamList[ iCounter] == SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) - { - return( TRUE ); - } - } - - return( FALSE ); -} - -BOOLEAN IsSoldierCloseEnoughToSAMControlPanel( SOLDIERTYPE *pSoldier ) -{ - - INT32 iCounter = 0; - - // now check each sam site in the list - for( iCounter = 0; iCounter < NUMBER_OF_SAMS; iCounter++ ) - { - if( pSamList[ iCounter ] == SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ) - { -// Assignment distance limits removed. Sep/11/98. ARM -// if( ( PythSpacesAway( pSamGridNoAList[ iCounter ], pSoldier->sGridNo ) < MAX_DISTANCE_FOR_REPAIR )||( PythSpacesAway( pSamGridNoBList[ iCounter ], pSoldier->sGridNo ) < MAX_DISTANCE_FOR_REPAIR ) ) - { - return( TRUE ); - } - } - } - - return( FALSE ); -} -*/ - - - BOOLEAN HandleAssignmentExpansionAndHighLightForAssignMenu( SOLDIERTYPE *pSoldier ) { if( fShowSquadMenu ) @@ -17089,15 +17052,12 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) BOOLEAN fCanFixSpecificTarget = TRUE; // make sure he can repair the SPECIFIC thing being repaired too (must be in its sector, for example) - - /* + if ( pSelectedSoldier->flags.fFixingSAMSite ) { - fCanFixSpecificTarget = CanSoldierRepairSAM( pSoldier, SAM_SITE_REPAIR_DIVISOR ); + fCanFixSpecificTarget = CanSoldierRepairSAM( pSoldier ); } - else - */ - if (pSelectedSoldier->bVehicleUnderRepairID != -1) + else if (pSelectedSoldier->bVehicleUnderRepairID != -1) { fCanFixSpecificTarget = CanCharacterRepairVehicle( pSoldier, pSelectedSoldier->bVehicleUnderRepairID ) && (pSoldier->sFacilityTypeOperated <= 0 || CanCharacterFacility( pSoldier, bParam, FAC_REPAIR_VEHICLE )); } @@ -20757,18 +20717,21 @@ void FacilityAssignmentMenuBtnCallback ( MOUSE_REGION * pRegion, INT32 iReason ) MakeSureToolKitIsInHand( pSoldier ); ChangeSoldiersAssignment( pSoldier, FACILITY_REPAIR ); pSoldier->flags.fFixingRobot = FALSE; + pSoldier->flags.fFixingSAMSite = FALSE; pSoldier->bVehicleUnderRepairID = -1; break; case FAC_REPAIR_VEHICLE: MakeSureToolKitIsInHand( pSoldier ); ChangeSoldiersAssignment( pSoldier, FACILITY_REPAIR ); pSoldier->flags.fFixingRobot = FALSE; + pSoldier->flags.fFixingSAMSite = FALSE; pSoldier->bVehicleUnderRepairID = (INT8)ubVehicleID; break; case FAC_REPAIR_ROBOT: MakeSureToolKitIsInHand( pSoldier ); ChangeSoldiersAssignment( pSoldier, FACILITY_REPAIR ); pSoldier->flags.fFixingRobot = TRUE; + pSoldier->flags.fFixingSAMSite = FALSE; pSoldier->bVehicleUnderRepairID = -1; break; case FAC_DOCTOR: diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 46b1eab6..5f15562d 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -26,6 +26,12 @@ #define VEHICLE_REPAIR_POINTS_DIVISOR 10 +// controls how easily SAM sites are repaired +// NOTE: A repairman must generate a least this many points / hour to be ABLE to repair a SAM site at all! +#define SAM_SITE_REPAIR_DIVISOR 4 // Flugente: changed from 10 to 4 + +// minimum condition at which a destroyed SAM site controller is visible in tactical again +#define MIN_CONDITION_SHOW_SAM_CONTROLLER 20 // Assignments Defines enum diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index 388216e4..dd4e6ef5 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -51,10 +51,8 @@ INT8 bCurrentTownMineSectorY = 0; INT8 bCurrentTownMineSectorZ = 0; // inventory button -UINT32 guiMapButtonInventoryImage[3]; -UINT32 guiMapButtonInventory[3]; - -BOOLEAN guiSAMButtonDefined = FALSE; +UINT32 guiMapButtonInventoryImage[2]; +UINT32 guiMapButtonInventory[2]; UINT16 sTotalButtonWidth = 0; @@ -98,7 +96,6 @@ void RemoveInventoryButtonForMapPopUpBox( void ); // callback to turn on sector inventory list void MapTownMineInventoryButtonCallBack( GUI_BUTTON *btn, INT32 reason ); void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason ); -void MapTownSAMRepairButtonCallBack( GUI_BUTTON *btn, INT32 reason ); void MinWidthOfTownMineInfoBox( void ); extern INT32 GetCurrentBalance( void ); @@ -1094,34 +1091,7 @@ void AddInventoryButtonForMapPopUpBox( void ) TEXT_CJUSTIFIED, (INT16)(sX ), (INT16)( sY ), BUTTON_TOGGLE , MSYS_PRIORITY_HIGHEST - 1, DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownMineExitButtonCallBack ); - - // Flugente: if this is SAM site we control, we have the option to repair it if it is damagged - guiSAMButtonDefined = FALSE; - - for ( UINT16 x = 0; x < MAX_NUMBER_OF_SAMS; ++x ) - { - if ( pSamList[x] == SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ) - { - StrategicMapElement *pSAMStrategicMap = &(StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX(pSamList[x])]); - - sX = pPosition.iX + (pDimensions.iRight - sTotalBoxWidth) / 3; - sY = pPosition.iY + pDimensions.iBottom - ((BOX_BUTTON_HEIGHT + 5)) - BOX_BUTTON_HEIGHT; - - guiMapButtonInventoryImage[2] = LoadButtonImage( "INTERFACE\\mapinvbtns.sti", -1, 1, -1, 3, -1 ); - - guiMapButtonInventory[2] = CreateIconAndTextButton( guiMapButtonInventoryImage[2], pMapPopUpInventoryText[2], BLOCKFONT2, - FONT_WHITE, FONT_BLACK, - FONT_WHITE, FONT_BLACK, - TEXT_CJUSTIFIED, - (INT16)(sX), (INT16)(sY), BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, - DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)MapTownSAMRepairButtonCallBack ); - - guiSAMButtonDefined = TRUE; - - break; - } - } - + // delete video object DeleteVideoObjectFromIndex( uiObject ); } @@ -1134,12 +1104,6 @@ void RemoveInventoryButtonForMapPopUpBox( void ) RemoveButton( guiMapButtonInventory[1] ); UnloadButtonImage( guiMapButtonInventoryImage[1] ); - - if ( guiSAMButtonDefined ) - { - RemoveButton( guiMapButtonInventory[2] ); - UnloadButtonImage( guiMapButtonInventoryImage[2] ); - } } @@ -1192,100 +1156,6 @@ void MapTownMineExitButtonCallBack( GUI_BUTTON *btn, INT32 reason ) } } -void SAMRepairCallBack( UINT8 bExitValue ) -{ - if ( bExitValue == MSG_BOX_RETURN_YES ) - { - for ( UINT16 x = 0; x < MAX_NUMBER_OF_SAMS; ++x ) - { - if ( pSamList[x] == SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ) - { - StrategicMapElement *pSAMStrategicMap = &(StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX( pSamList[x] )]); - - if ( !pSAMStrategicMap->fEnemyControlled && pSAMStrategicMap->bSAMCondition < 100 ) - { - UINT32 cost = (100 - pSAMStrategicMap->bSAMCondition) * 100; - - AddTransactionToPlayersBook( SAM_REPAIR, 0, GetWorldTotalMin( ), -cost ); - - // remember this, so we don't accidentally pay for repair again - pSAMStrategicMap->usFlags |= SAMSITE_REPAIR_ORDERED; - - UINT32 time = (100 - pSAMStrategicMap->bSAMCondition) / 4 + 1; - - AddStrategicEvent( EVENT_SAMSITE_REPAIRED, GetWorldTotalMin( ) + 60 * time, pSamList[x] ); - } - - break; - } - } - } -} - -void MapTownSAMRepairButtonCallBack( GUI_BUTTON *btn, INT32 reason ) -{ - if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { - btn->uiFlags |= (BUTTON_CLICKED_ON); - } - else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if ( btn->uiFlags & BUTTON_CLICKED_ON ) - { - btn->uiFlags &= ~(BUTTON_CLICKED_ON); - - // done - fMapPanelDirty = TRUE; - fMapScreenBottomDirty = TRUE; - fShowTownInfo = FALSE; - - for ( UINT16 x = 0; x < MAX_NUMBER_OF_SAMS; ++x ) - { - if ( pSamList[x] == SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ) - { - StrategicMapElement *pSAMStrategicMap = &(StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX( pSamList[x] )]); - - if ( pSAMStrategicMap->fEnemyControlled ) - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, szEnemyHeliText[1], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); - break; - } - - if ( pSAMStrategicMap->bSAMCondition >= 100 ) - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, szEnemyHeliText[2], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); - break; - } - - if ( pSAMStrategicMap->usFlags & SAMSITE_REPAIR_ORDERED ) - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, szEnemyHeliText[3], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); - break; - } - - UINT32 cost = (100 - pSAMStrategicMap->bSAMCondition) * 100; - - if ( cost > GetCurrentBalance( ) ) - { - DoMapMessageBox( MSG_BOX_BASIC_STYLE, szEnemyHeliText[4], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); - break; - } - - UINT32 time = (100 - pSAMStrategicMap->bSAMCondition) / 4 + 1; - - CHAR16 sSamSiteRepairPromptText[320]; - swprintf( sSamSiteRepairPromptText, szEnemyHeliText[5], cost, time ); - - // ask the player whether he really wants to do this - DoMapMessageBox( MSG_BOX_BASIC_STYLE, sSamSiteRepairPromptText, MAP_SCREEN, MSG_BOX_FLAG_YESNO, SAMRepairCallBack ); - - break; - } - } - } - } -} - // get the min width of the town mine info pop up box void MinWidthOfTownMineInfoBox( void ) { diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index c549216d..a03d6259 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -2885,13 +2885,11 @@ void DrawCharacterInfo(INT16 sCharNumber) // robot wcscpy( sString, pRepairStrings[ 3 ] ); } -/* else if ( pSoldier->flags.fFixingSAMSite ) { // SAM site wcscpy( sString, pRepairStrings[ 1 ] ); } -*/ else if ( pSoldier->bVehicleUnderRepairID != -1 ) { // vehicle diff --git a/Strategic/strategicmap.h b/Strategic/strategicmap.h index fd0d704a..24c706fa 100644 --- a/Strategic/strategicmap.h +++ b/Strategic/strategicmap.h @@ -66,7 +66,7 @@ extern BOOLEAN gfUseAlternateMap; */ // min condition for sam site to be functional -#define MIN_CONDITION_FOR_SAM_SITE_TO_WORK 80 +#define MIN_CONDITION_FOR_SAM_SITE_TO_WORK 50 // Flugente: changed from 80 to 50 // FUNCTIONS FOR DERTERMINING GOOD SECTOR EXIT DATA diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 24ffa8cc..0ea1f237 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -42,6 +42,7 @@ #include "Strategic Event Handler.h" #include "Food.h" // added by Flugente #include "Queen Command.h" // added by Flugente for FindUnderGroundSector(...) + #include "strategic.h" // added by Flugente #endif #ifdef JA2UB @@ -2336,6 +2337,14 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sPtsAvailable -= ( sPtsAvailable % VEHICLE_REPAIR_POINTS_DIVISOR ); usMaximumPts -= ( usMaximumPts % VEHICLE_REPAIR_POINTS_DIVISOR ); } + else if ( Menptr[pFace->ubSoldierID].flags.fFixingSAMSite ) + { + sPtsAvailable = (sPtsAvailable / SAM_SITE_REPAIR_DIVISOR); + + INT16 sector = CALCULATE_STRATEGIC_INDEX( Menptr[pFace->ubSoldierID].sSectorX, Menptr[pFace->ubSoldierID].sSectorY ); + + usMaximumPts = 100 - StrategicMap[sector].bSAMCondition; + } break;