-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[medical] Code cleanup using SQFLint #6485
Changes from 6 commits
91d2f0b
607b747
98b2a49
0759efb
903c4df
9c9787f
b134507
c2c5d58
3a52e7d
ac749a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Dedmen | ||
* Return how many items of type _itemType the player has in his containers (Uniform, Vest, Backpack) | ||
* Doesn't count assignedItems, weapons, weapon attachments, magazines in weapons | ||
* | ||
* Arguments: | ||
* 0: unit <OBJECT> | ||
* 1: Classname of item (Case-Sensitive) <STRING> | ||
* | ||
* Return Value: | ||
* itemCount <NUMBER> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Item Count |
||
* | ||
* Example: | ||
* [bob, "FirstAidKit"] call ace_common_fnc_getCountOfItem | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params ["_unit", "_itemType"]; | ||
|
||
private _countItemsInContainer = { | ||
(getItemCargo _this) params ["_itemTypes", "_itemCounts"]; | ||
|
||
private _index = _itemTypes find _itemType; | ||
_itemCounts param [_index, 0] | ||
}; | ||
|
||
((uniformContainer _unit) call _countItemsInContainer) + | ||
((vestContainer _unit) call _countItemsInContainer) + | ||
((backpackContainer _unit) call _countItemsInContainer) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
* Return Value: | ||
* None | ||
*/ | ||
|
||
params ["_enable", "_bloodloss"]; | ||
if (isNull findDisplay 46) exitWith {}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
* Return Value: | ||
* None | ||
*/ | ||
|
||
params ["_heartRate"]; | ||
|
||
if (_heartRate == 0) exitWith { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
* Return Value: | ||
* None | ||
*/ | ||
|
||
params ["_enable", "_mode"]; | ||
|
||
switch (_mode) do { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
* | ||
* Public: No | ||
*/ | ||
|
||
#define MAX_DISTANCE 10 | ||
|
||
params ["_target", ["_show", 0], ["_selectionN", 0]]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
* | ||
* Public: No | ||
*/ | ||
|
||
#define MAX_DISTANCE 10 | ||
|
||
params ["_display"]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_unit"]; | ||
|
||
_unit setVariable [QEGVAR(medical,deathBlocked), true]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,10 @@ | |
* Public: Yes | ||
*/ | ||
|
||
private ["_unit","_return","_status"]; | ||
params ["_unit"]; | ||
_status = _unit getVariable [QEGVAR(medical,triageLevel), -1]; | ||
_return = switch (_status) do { | ||
|
||
private _status = _unit getVariable [QEGVAR(medical,triageLevel), -1]; | ||
private _return = switch (_status) do { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of a return variable is pointless in this function since the switch is at the end anyway 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about replacing the switch by an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah. Would then call |
||
case 1: {[localize ELSTRING(medical_treatment,Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]}; | ||
case 2: {[localize ELSTRING(medical_treatment,Triage_Status_Delayed), 2, [0.7, 0.5, 0, 0.9]]}; | ||
case 3: {[localize ELSTRING(medical_treatment,Triage_Status_Immediate), 3, [0.4, 0.07, 0.07, 0.9]]}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
*/ | ||
|
||
params ["_unit"]; | ||
|
||
private _vehicle = vehicle _unit; | ||
|
||
if (_unit == _vehicle) exitWith {false}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought the same actually. But I just copied it from another function :D