ACE3/addons/common/functions/fnc_getNumberMagazinesIn.sqf
PabstMirror 00b91bed45 Minor fixes, cleanup, add lint ignore directives (#5176)
- Fix bug in getNumberMagazinesIn (func not used)
- Fix bug in seekerFindLaserSpot (func not used yet)
- Everything else is just cleanup
2017-05-31 22:09:36 +01:00

35 lines
696 B
Plaintext

/*
* Author: Glowbal
* Count magazines of unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Magazine <STRING>
*
* Return Value:
* Magazine amount <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_magazine"];
private _return = 0;
if (_unit isKindOf "CAManBase") then {
_return = {_x == _magazine} count magazines _unit;
} else {
{
_return = _return + ({_x == _magazine} count magazines _x);
false
} count crew _unit;
(getMagazineCargo _unit) params [["_magNames", []], ["_magCount", []]];
{
if (_magazine == _x) exitWith {_return = _return + (_magCount select _forEachIndex)};
} forEach _magNames;
};
_return