Common - Improve vehicle icon caching implementation (#8318)

* Use native hashmap for common vehicle icon caching

Should be more optimised
This commit is contained in:
Kyle Mckay
2021-07-18 18:26:23 +01:00
committed by GitHub
parent 75934f883c
commit e870e2f1f9
2 changed files with 3 additions and 3 deletions

View File

@ -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) = [];

View File

@ -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