MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getGrenadeFromBelt

Method getGrenadeFromBelt

src/Savegame/BattleUnit.cpp:1778–1788  ·  view source on GitHub ↗

* Get a grenade from the belt (used for AI) * @return Pointer to item. */

Source from the content-addressed store, hash-verified

1776 * @return Pointer to item.
1777 */
1778BattleItem *BattleUnit::getGrenadeFromBelt() const
1779{
1780 for (std::vector<BattleItem*>::const_iterator i = _inventory.begin(); i != _inventory.end(); ++i)
1781 {
1782 if ((*i)->getRules()->getBattleType() == BT_GRENADE)
1783 {
1784 return *i;
1785 }
1786 }
1787 return 0;
1788}
1789
1790/**
1791 * Check if we have ammo and reload if needed (used for AI).

Callers 2

setupAttackMethod · 0.80
grenadeActionMethod · 0.80

Calls 2

getBattleTypeMethod · 0.80
getRulesMethod · 0.45

Tested by

no test coverage detected