Skip to content

Commit

Permalink
refactor index logic
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim committed Dec 14, 2024
1 parent 92b9cdb commit 19f1883
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions addons/medical_treatment/functions/fnc_stitchWound.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ params ["_patient", "_bodyPart", ["_treatedWound", []]];
private _bandagedWounds = GET_BANDAGED_WOUNDS(_patient);
private _bandagedWoundsOnPart = _bandagedWounds get _bodyPart;

// Get the first stitchable wound from bandaged wounds, or make sure the passed wound exists
private _bandagedIndex = (count _bandagedWoundsOnPart) - 1;
// Get the first stitchable wound from bandaged wounds if none is passed
if (_treatedWound isEqualTo []) then {
_treatedWound = _bandagedWoundsOnPart select -1;
} else {
_bandagedIndex = _bandagedWoundsOnPart find _treatedWound;
};

private _bandagedIndex = _bandagedWoundsOnPart find _treatedWound;

// Wound doesn't exist or there are no bandaged wounds to stitch
if (_bandagedIndex == -1) exitWith {false};

Expand Down

0 comments on commit 19f1883

Please sign in to comment.