MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / PlayerHasWeapon

Function PlayerHasWeapon

Descent3/multisafe.cpp:2419–2427  ·  view source on GitHub ↗

Returns true if the player has this weapon (this fuction should be moved)

Source from the content-addressed store, hash-verified

2417#define ENERGY_BONUS 12.0f
2418// Returns true if the player has this weapon (this fuction should be moved)
2419bool PlayerHasWeapon(int slot, int weapon_index) {
2420 if (Players[slot].weapon_flags & HAS_FLAG(weapon_index))
2421 if (weapon_index >= SECONDARY_INDEX)
2422 return (Players[slot].weapon_ammo[weapon_index] > 0); // have secondary only if have ammo
2423 else
2424 return true; // primaries don't check for ammo
2425 else
2426 return false;
2427}
2428// Adds weapon ammo to a player, returns 0 if it couldn't
2429// This function should be moved!
2430int AddWeaponAmmo(int slot, int weap_index, int ammo) {

Callers 2

msafe_CallFunctionFunction · 0.85
HandleWeaponPowerupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected