2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Return the captivity status of an unit.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: Unit (Object)
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings)
|
|
|
|
*/
|
2015-01-12 04:02:33 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_unit", "_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
|
|
|
|
|
|
|
|
_unit = _this select 0;
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-11 18:20:14 +00:00
|
|
|
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_unitCaptivityReasons = [];
|
|
|
|
{
|
|
|
|
if (_unitCaptivityStatus select _forEachIndex) then {
|
|
|
|
_unitCaptivityReasons pushBack _x;
|
|
|
|
};
|
|
|
|
} forEach _captivityReasons;
|
|
|
|
|
|
|
|
_unitCaptivityReasons
|