ACE3/addons/common/functions/fnc_toBitmask.sqf

23 lines
322 B
Plaintext
Raw Normal View History

/*
* Author: commy2
* Convert an array of booleans into a number.
*
2015-09-17 16:25:02 +00:00
* Arguments:
2015-09-19 22:55:58 +00:00
* N: Booleans <ARRAY>
*
2015-09-17 16:25:02 +00:00
* Return Value:
2015-09-19 22:55:58 +00:00
* Bitmask <NUMBER>
2015-09-17 16:25:02 +00:00
*
* Public: Yes
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-09-20 13:52:40 +00:00
private "_result";
_result = 0;
2015-09-19 22:55:58 +00:00
{
2015-05-14 18:06:06 +00:00
if (_x) then {_result = _result + 2 ^ _forEachIndex};
2015-09-20 13:52:40 +00:00
} forEach _this;
_result