* Get a grenade from the belt (used for AI) * @return Pointer to item. */
| 1776 | * @return Pointer to item. |
| 1777 | */ |
| 1778 | BattleItem *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). |
no test coverage detected