2015-05-01 17:37:17 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-02-22 14:20:36 +00:00
|
|
|
#include "XEH_PREP.hpp"
|
2019-02-16 23:05:24 +00:00
|
|
|
|
|
|
|
// cache refuel vehicles, see XEH_postInit.sqf
|
|
|
|
private _staticClasses = [];
|
2024-05-23 19:47:19 +00:00
|
|
|
private _baseStaticClasses = [];
|
|
|
|
private _baseDynamicClasses = [];
|
|
|
|
private _cacheRefuelCargo = createHashMap;
|
2019-02-16 23:05:24 +00:00
|
|
|
|
|
|
|
{
|
2024-05-23 19:47:19 +00:00
|
|
|
private _transportFuel = getNumber (_x >> "transportFuel");
|
|
|
|
private _fuelCargo = [_x >> QGVAR(fuelCargo), "NUMBER", _transportFuel] call CBA_fnc_getConfigEntry;
|
2019-02-16 23:05:24 +00:00
|
|
|
if (_fuelCargo > 0 || {_fuelCargo == REFUEL_INFINITE_FUEL}) then {
|
|
|
|
private _sourceClass = configName _x;
|
2024-05-23 19:47:19 +00:00
|
|
|
private _noXEH = !isText (_x >> "EventHandlers" >> "CBA_Extended_EventHandlers" >> "init");
|
|
|
|
private _isPublic = getNumber (_x >> "scope") == 2;
|
2019-02-16 23:05:24 +00:00
|
|
|
// check if we can use actions with inheritance
|
|
|
|
if (
|
2024-05-23 19:47:19 +00:00
|
|
|
_noXEH // addActionToClass relies on XEH init
|
|
|
|
|| {_sourceClass isKindOf "Static"} // CBA_fnc_addClassEventHandler doesn't support "Static" class
|
2019-02-16 23:05:24 +00:00
|
|
|
) then {
|
2024-05-23 19:47:19 +00:00
|
|
|
if (_isPublic) then {
|
|
|
|
if (_noXEH) then {
|
|
|
|
WARNING_3("Class %1: %2 [%3] needs XEH",_sourceClass,configName inheritsFrom _x,configSourceMod _x);
|
|
|
|
};
|
|
|
|
_staticClasses pushBack _sourceClass;
|
|
|
|
if (_baseStaticClasses findIf {_sourceClass isKindOf _x} == -1) then {
|
|
|
|
_baseStaticClasses pushBack _sourceClass;
|
|
|
|
};
|
2019-02-16 23:05:24 +00:00
|
|
|
};
|
|
|
|
} else {
|
2024-05-23 19:47:19 +00:00
|
|
|
if (_baseDynamicClasses findIf {_sourceClass isKindOf _x} == -1) then {
|
|
|
|
_baseDynamicClasses pushBack _sourceClass;
|
2019-02-16 23:05:24 +00:00
|
|
|
};
|
|
|
|
};
|
2024-05-23 19:47:19 +00:00
|
|
|
if (_isPublic) then {
|
|
|
|
_cacheRefuelCargo set [_sourceClass, _fuelCargo];
|
|
|
|
};
|
2019-02-16 23:05:24 +00:00
|
|
|
};
|
2024-05-23 19:47:19 +00:00
|
|
|
} forEach ("true" configClasses (configFile >> "CfgVehicles"));
|
2019-02-16 23:05:24 +00:00
|
|
|
|
2024-05-23 19:47:19 +00:00
|
|
|
TRACE_3("found",count _staticClasses,count _baseStaticClasses,count _baseDynamicClasses);
|
|
|
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesStatic), compileFinal (_staticClasses createHashMapFromArray [])];
|
|
|
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseStatic), compileFinal (_baseStaticClasses createHashMapFromArray [])];
|
|
|
|
uiNamespace setVariable [QGVAR(cacheRefuelClassesBaseDynamic), compileFinal (_baseDynamicClasses createHashMapFromArray [])];
|
|
|
|
uiNamespace setVariable [QGVAR(cacheRefuelCargo), compileFinal _cacheRefuelCargo];
|