Skip to content

Commit

Permalink
Medical - Gracefully handle bad configs in testHitpoints (#10156)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored Jul 29, 2024
1 parent a6ab050 commit 7e93715
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addons/medical/dev/test_hitpointConfigs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgVehicles = configFile >> "CfgVehicles";

private _uniforms = "getNumber (_x >> 'scope') == 2 && {configName _x isKindOf ['Uniform_Base', _cfgWeapons]}" configClasses _cfgWeapons;
private _units = _uniforms apply {_cfgVehicles >> getText (_x >> "ItemInfo" >> "uniformClass")};
private _units = _uniforms apply {
private _unitCfg = _cfgVehicles >> getText (_x >> "ItemInfo" >> "uniformClass");
if (isNull _unitCfg) then { WARNING_2("%1 has invalid uniformClass %2",configName _x,getText (_x >> "ItemInfo" >> "uniformClass")) };
_unitCfg
};
if (param [0, false]) then { // Check all units (if naked)
INFO("checking ALL units");
_units append ((configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CAManBase'}", true]));
Expand All @@ -21,6 +25,7 @@ INFO_1("Checking uniforms for correct medical hitpoints [%1 units]",count _units
private _testPass = true;
{
private _typeOf = configName _x;
if (_typeOf == "") then { continue };
private _hitpoints = (configProperties [_x >> "HitPoints", "isClass _x", true]) apply {toLowerANSI configName _x};
private _expectedHitPoints = ["hitleftarm","hitrightarm","hitleftleg","hitrightleg","hithead","hitbody"];
private _missingHitPoints = _expectedHitPoints select {!(_x in _hitpoints)};
Expand Down

0 comments on commit 7e93715

Please sign in to comment.