From 401323b524d225b19904d962a22e94b356fc5f29 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 24 Mar 2013 00:52:19 +0000 Subject: [PATCH] - Fix: the food system doesn't aply to EPCs anymore, thus wont die from lack of food/water - Fix: MERCS_CAN_DO_ADVANCED_REPAIRS did not work as intended git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5950 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 29 +++++++++++++---------------- Tactical/Food.cpp | 3 ++- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 90dd12d61..3afc45f25 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -3905,33 +3905,30 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ ) { + // Flugente: if using the new advanced repair system, we can only repair up to the repair threshold + INT16 threshold = 100; + if ( gGameExternalOptions.fAdvRepairSystem && (Item[pObj->usItem].usItemClass & (IC_WEAPON|IC_ARMOUR)) ) + { + if ( !gGameExternalOptions.fMercsCanDoAdvancedRepairs || !HAS_SKILL_TRAIT( pSoldier, TECHNICIAN_NT ) ) + { + threshold = (*pObj)[ubLoop]->data.sRepairThreshold; + } + } + // if it's repairable and NEEDS repairing - if ( IsItemRepairable( pObj->usItem, (*pObj)[ubLoop]->data.objectStatus, (*pObj)[ubLoop]->data.sRepairThreshold ) ) + if ( IsItemRepairable( pObj->usItem, (*pObj)[ubLoop]->data.objectStatus, threshold ) ) { /////////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - merc records, num items repaired // Actually we check if we repaired at least 5% of status, otherwise the item is not considered broken ubBeforeRepair = (UINT8)((*pObj)[ubLoop]->data.objectStatus); - - // Flugente: if using the new advanced repair system, we can only repair up to the repair threshold - INT16 threshold = 100; - if ( gGameExternalOptions.fAdvRepairSystem && (Item[pObj->usItem].usItemClass & (IC_WEAPON|IC_ARMOUR)) ) - { - if ( !gGameExternalOptions.fMercsCanDoAdvancedRepairs || !HAS_SKILL_TRAIT( pSoldier, TECHNICIAN_NT ) ) - { - threshold = (*pObj)[ubLoop]->data.sRepairThreshold; - } - } - + // repairable, try to repair it DoActualRepair( pSoldier, pObj->usItem, &((*pObj)[ubLoop]->data.objectStatus), threshold, pubRepairPtsLeft ); if ( gGameExternalOptions.fAdvRepairSystem && gGameExternalOptions.fMercsCanDoAdvancedRepairs && ( HAS_SKILL_TRAIT( pSoldier, TECHNICIAN_NT ) ) && ( (Item[pObj->usItem].usItemClass & (IC_WEAPON|IC_ARMOUR)) ) ) (*pObj)[ubLoop]->data.sRepairThreshold = max((*pObj)[ubLoop]->data.sRepairThreshold, (*pObj)[ubLoop]->data.objectStatus); - - // repairable, try to repair it - DoActualRepair( pSoldier, pObj->usItem, &((*pObj)[ubLoop]->data.objectStatus), threshold, pubRepairPtsLeft ); - + // if the item was repaired to full status and the repair wa at least 5%, add a point if ( (*pObj)[ubLoop]->data.objectStatus == threshold && (((*pObj)[ubLoop]->data.objectStatus - ubBeforeRepair) > 4 )) { diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 81ff95d96..8b9b14fc3 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -24,6 +24,7 @@ #include "environment.h" #include "WorldDat.h" #include "Facilities.h" + #include "Soldier macros.h" #endif //forward declarations of common classes to eliminate includes @@ -714,7 +715,7 @@ void HourlyFoodUpdate( void ) for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier) { //if the merc is active, and in Arulco - if ( pSoldier && pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ROBOT && !IsVehicle(pSoldier) && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) + if ( pSoldier && pSoldier->bActive && !AM_AN_EPC(pSoldier) && pSoldier->ubProfile != ROBOT && !IsVehicle(pSoldier) && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { // digestion HourlyFoodSituationUpdate( pSoldier );