Skip to content

Commit

Permalink
Add macros, reduce function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rekterakathom committed Feb 26, 2024
1 parent 9814ada commit f1831e6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions addons/main/functions/fnc_getLauncherUnits.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ private _suitableUnits = [];

private _unitsMagazines = (magazines _currentUnit) + (secondaryWeaponMagazine _currentUnit);
{
if (
(_offensiveVeh && ([_x, LIGHT_VEHICLE] call lambs_main_fnc_checkMagazineAiUsageFlags))
|| {_offensiveAir && ([_x, AIR_VEHICLE] call lambs_main_fnc_checkMagazineAiUsageFlags)}
|| {_offensiveArmor && ([_x, HEAVY_VEHICLE] call lambs_main_fnc_checkMagazineAiUsageFlags)}
) exitWith {_suitableUnits pushBackUnique _currentUnit};
private _flags = 0;
if (_offensiveVeh) then {_flags = _flags + LIGHT_VEHICLE};
if (_offensiveArmor) then {_flags = _flags + HEAVY_VEHICLE};
if (_offensiveAir) then {_flags = _flags + AIR_VEHICLE};

if ([_x, _flags] call FUNC(checkMagazineAiUsageFlags)) exitWith {
_suitableUnits pushBackUnique _currentUnit
};

// Optionally go through submunitions. More info in header.
if !(_checkSubmunition) then {continue}; // Invert & continue to reduce indentation
Expand Down

0 comments on commit f1831e6

Please sign in to comment.