mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- militia equipment choosing: object status is taken into consideration for NVGs and sungoggles
- militia equipemnt choosing: do not give a 'bonus' for excess ammo we wouldn't take anyway git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5987 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3595,7 +3595,7 @@ UINT32 ItemFitness( OBJECTTYPE* pObj, UINT8 idx )
|
||||
}
|
||||
else
|
||||
{
|
||||
value += (NightTime() ? Item[ pObj->usItem ].nightvisionrangebonus : Item[ pObj->usItem ].dayvisionrangebonus );
|
||||
value = (*pObj)[idx]->data.objectStatus * (NightTime() ? Item[ pObj->usItem ].nightvisionrangebonus : Item[ pObj->usItem ].dayvisionrangebonus );
|
||||
}
|
||||
}
|
||||
else if ( Item[ pObj->usItem ].usItemClass & (IC_BLADE|IC_PUNCH) )
|
||||
@@ -3632,7 +3632,8 @@ UINT32 GetNeededTotalAmmo( UINT16 usItem )
|
||||
// special version of ItemFitness() that takes ammo count into consideration
|
||||
UINT32 ItemFitness_WithAmmo( OBJECTTYPE* pObj, UINT8 idx, UINT32 uiBullets )
|
||||
{
|
||||
return (ItemFitness(pObj, idx) * uiBullets) / max(1, GetNeededTotalAmmo(pObj->usItem));
|
||||
UINT32 optimalammo = GetNeededTotalAmmo(pObj->usItem);
|
||||
return (ItemFitness(pObj, idx) * min(uiBullets, optimalammo) ) / max(1, optimalammo);
|
||||
}
|
||||
|
||||
// retreives the next free slot in pWorldItem (we want to keep it short and not add too many items)
|
||||
@@ -3975,7 +3976,7 @@ void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16
|
||||
// This function loads the sector inventory of a given sector and fills the inventory of a SOLDIERCREATE_STRUCT according to the game settings. The soldier class is a parameter, but is currently not used
|
||||
// This function is rather lengthy, this is due to the fact that we have to loop over the entire sector inventory mulitple times. Below is a small documentation. If you change anything, please update it - Flugente
|
||||
|
||||
// We loop over the inventory 3 times. I'll briefly explain why. After each loop we do a few other things - like taking items or doin further evaluation
|
||||
// We loop over the inventory 3 times. I'll briefly explain why. After each loop we do a few other things - like taking items or doing further evaluation
|
||||
// Note that any items we checked have to be reachable AND not be 'taboo' to the militia.
|
||||
|
||||
// Preparation: load correct sector inventory
|
||||
|
||||
Reference in New Issue
Block a user