Skip to content

Commit

Permalink
Use getOrDefaultCall
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Jul 28, 2024
1 parent 1388f44 commit b0504d7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions addons/csw/functions/fnc_getCarryMagazine.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@

params [["_vehicleMag", "", [""]]];

private _carryMag = GVAR(vehicleMagCache) get _vehicleMag;
if (isNil "_carryMag") then {
GVAR(vehicleMagCache) getOrDefaultCall [_vehicleMag, {
private _groups = "getNumber (_x >> _vehicleMag) == 1 && {isClass (configFile >> 'CfgMagazines' >> configName _x)}" configClasses (configFile >> QGVAR(groups));
_carryMag = configName (_groups param [0, configNull]);
GVAR(vehicleMagCache) set [_vehicleMag, _carryMag];
TRACE_2("setting cache",_vehicleMag,_carryMag);
};

_carryMag
_carryMag
}, true] // return

0 comments on commit b0504d7

Please sign in to comment.