Skip to content

Commit

Permalink
Merge pull request #1335 from mharis001/compatible-items-config-case
Browse files Browse the repository at this point in the history
JR - Ensure class names returned by compatibleItems are in config case
  • Loading branch information
PabstMirror committed Oct 9, 2020
2 parents c6cf065 + e8fe924 commit 578b409
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions addons/jr/fnc_compatibleItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ private _compatibleItems = GVAR(namespace) getVariable _weapon;

if (isNil "_compatibleItems") then {
_compatibleItems = [];
private _cfgWeapon = configFile >> "CfgWeapons" >> _weapon;
private _cfgWeapons = configFile >> "CfgWeapons";
private _weaponConfig = _cfgWeapons >> _weapon;

if (isClass _cfgWeapon) then {
if (isClass _weaponConfig) then {
{
private _cfgCompatibleItems = _x >> "compatibleItems";

Expand All @@ -54,9 +55,12 @@ if (isNil "_compatibleItems") then {
} forEach configProperties [_cfgCompatibleItems, "isNumber _x"];
};
};
} forEach configProperties [_cfgWeapon >> "WeaponSlotsInfo", "isclass _x"];
} forEach configProperties [_weaponConfig >> "WeaponSlotsInfo", "isClass _x"];

GVAR(namespace) setVariable [_weapon, _compatibleItems]; //save entry in cache
// Ensure item class names are in config case
_compatibleItems = _compatibleItems apply {configName (_cfgWeapons >> _x)};

GVAR(namespace) setVariable [_weapon, _compatibleItems]; // save entry in cache
} else {
["'%1' not found in CfgWeapons", _weapon] call BIS_fnc_error;
};
Expand Down

0 comments on commit 578b409

Please sign in to comment.