mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Common - Improve vehicle icon caching implementation (#8318)
* Use native hashmap for common vehicle icon caching Should be more optimised
This commit is contained in:
@ -9,7 +9,7 @@ PREP_RECOMPILE_END;
|
|||||||
|
|
||||||
GVAR(syncedEvents) = [] call CBA_fnc_hashCreate;
|
GVAR(syncedEvents) = [] call CBA_fnc_hashCreate;
|
||||||
GVAR(showHudHash) = [] call CBA_fnc_hashCreate;
|
GVAR(showHudHash) = [] call CBA_fnc_hashCreate;
|
||||||
GVAR(vehicleIconCache) = call CBA_fnc_createNamespace; // for getVehicleIcon
|
GVAR(vehicleIconCache) = createHashMap; // for getVehicleIcon
|
||||||
|
|
||||||
GVAR(settingsInitFinished) = false;
|
GVAR(settingsInitFinished) = false;
|
||||||
GVAR(runAtSettingsInitialized) = [];
|
GVAR(runAtSettingsInitialized) = [];
|
||||||
|
@ -25,7 +25,7 @@ private _objectType = if (_object isEqualType objNull) then {
|
|||||||
} else {
|
} else {
|
||||||
_object
|
_object
|
||||||
};
|
};
|
||||||
private _cachedValue = GVAR(vehicleIconCache) getVariable _objectType;
|
private _cachedValue = GVAR(vehicleIconCache) get _objectType;
|
||||||
|
|
||||||
if (isNil "_cachedValue") then {
|
if (isNil "_cachedValue") then {
|
||||||
private _vehicleValue = getText (configfile >> "CfgVehicles" >> _objectType >> "icon");
|
private _vehicleValue = getText (configfile >> "CfgVehicles" >> _objectType >> "icon");
|
||||||
@ -41,7 +41,7 @@ if (isNil "_cachedValue") then {
|
|||||||
_cachedValue = _vehicleIconValue;
|
_cachedValue = _vehicleIconValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(vehicleIconCache) setVariable [_objectType, _cachedValue];
|
GVAR(vehicleIconCache) set [_objectType, _cachedValue];
|
||||||
};
|
};
|
||||||
|
|
||||||
_cachedValue
|
_cachedValue
|
||||||
|
Reference in New Issue
Block a user