wip, fbcb2_assets, init, util
This commit is contained in:
27
framework/util/functions/fn_recurseSubclasses.sqf
Normal file
27
framework/util/functions/fn_recurseSubclasses.sqf
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_cfg", configNull, [configNull]],
|
||||
["_code", {}, [{}]]
|
||||
];
|
||||
|
||||
if (isNull _cfg) exitWith {["Provided config is null!"] call BIS_fnc_error};
|
||||
|
||||
|
||||
private _recurseFnc = {
|
||||
params ["_cfg", "_code", ["_recurseCounter", 0]];
|
||||
[_cfg, _recurseCounter] call _code;
|
||||
// get children and recurse
|
||||
private _childCfgs = _cfg call BIS_fnc_returnChildren;
|
||||
if (count _childCfgs isEqualTo 0) exitWith {false};
|
||||
|
||||
{
|
||||
[_x, _code, _recurseCounter + 1] call _recurseFnc;
|
||||
} forEach _childCfgs;
|
||||
false;
|
||||
};
|
||||
|
||||
private _continue = true;
|
||||
while {_continue} do {
|
||||
_continue = [_cfg, _code] call _recurseFnc;
|
||||
};
|
||||
Reference in New Issue
Block a user