mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Loading a gear template also fills up canteens if the sector has drinkable water
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8441 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -9228,6 +9228,13 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
|
||||
UINT16 usReloadSound = 0;
|
||||
BOOLEAN attachmentsound = FALSE;
|
||||
|
||||
// refill canteens (for convenience only with drinkable, non-poisonous water)
|
||||
UINT8 waterquality = GetWaterQuality( sSelMapX, sSelMapY, iCurrentMapSectorZ );
|
||||
BOOLEAN refillwaterfromsector = (waterquality == WATER_DRINKABLE);
|
||||
|
||||
// the temperature of the water in this sector (temperature reflects the quality)
|
||||
FLOAT wateraddtemperature = OVERHEATING_MAX_TEMPERATURE;
|
||||
|
||||
// 1. loop over the gear we should pick up and remove mismatching items if we can find a fitting one in the sector
|
||||
for (std::vector<GEAR_NODE>::iterator it = vec.begin(); it != vec.end(); ++it)
|
||||
@@ -9627,6 +9634,22 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
DistributeStatus( &(pInventoryPoolList[poolslot].object), &(pSoldier->inv[slot]), 100);
|
||||
}
|
||||
}
|
||||
|
||||
// if there is water in this sector, refill canteens
|
||||
if ( refillwaterfromsector && Item[(pSoldier->inv[slot]).usItem].canteen && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 )
|
||||
{
|
||||
OBJECTTYPE* pObj = &(pSoldier->inv[slot]);
|
||||
|
||||
for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i )
|
||||
{
|
||||
UINT16 status = (*pObj)[i]->data.objectStatus;
|
||||
UINT16 statusmmissing = max( 0, 100 - status );
|
||||
FLOAT temperature = (*pObj)[i]->data.bTemperature;
|
||||
|
||||
(*pObj)[i]->data.objectStatus = 100;
|
||||
(*pObj)[i]->data.bTemperature = (status * temperature + statusmmissing * wateraddtemperature) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (Item[(pSoldier->inv[slot]).usItem].usItemClass & (IC_GUN | IC_AMMO)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user