- 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
This commit is contained in:
Flugente
2013-03-24 00:52:19 +00:00
parent 728d2f7cfe
commit 401323b524
2 changed files with 15 additions and 17 deletions
+13 -16
View File
@@ -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 ))
{
+2 -1
View File
@@ -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 );