-
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
[medical] Code cleanup using SQFLint #6485
Conversation
Last commit has my proposed solution for 3. Still waiting for feedback about 2. but we can probably just leave that out for now. We want to do a optimization and cleanup run later anyway. |
_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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
How about replacing the switch by an ARRAY param [_status, default]
?
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.
Nah. Would then call localize
for all entries everytime
I like the common function solution 👍 |
* Doesn't count assignedItems, weapons, weapon attachments, magazines in weapons | ||
* | ||
* Arguments: | ||
* 0: unit <OBJECT> |
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
* 1: Classname of item (Case-Sensitive) <STRING> | ||
* | ||
* Return Value: | ||
* itemCount <NUMBER> |
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.
Item Count
I don't like the empty line between header and file local defines. Include above header has no newline, amd header separates it nicely already. |
@jonpas so.. #define directly after header without newline? Or before header? |
After, without the newline I'd say. |
@dedmen Is this ready for review? |
yes. I'll fix the conflicts now. Nothing else I want to do here. |
* Use private * Fix wrong spacing * Fix wrong variable being used * Cleanup empty line after header * ace_common_fnc_getCountOfItem * Remove useless _return variable * Naming
This is some minor cleanup of SQFLint warnings. And one actual bug of a wrong variable being used.
I also want to cleanup the spacing after the header.
Tasks left that I want in here.
1.
We have mixed
Through the files. I'd clean it up to a single newline after the header. Then maybe file local #defines, another newline and then params. But for that I need #6484 merged first.
2.
Also there are tons of unused variables. Especially
params
with all entries defined although not all are needed.I'd clean them up like this
params ["_var1", "_var2" /*, "_var3", "_var4" */]
in case where the last ones aren't needed.Or
params ["" /*_var1*/, "" /*_var2*/, "_var3", "_var4"]
in case where ones in the middle aren't needed. What do you think about that?
3.
ACE3/addons/medical_treatment/functions/fnc_checkItems.sqf
Line 17 in c9ad92e
This is horrible. As I already wrote in Slack.
4.
ACE3/addons/medical_treatment/functions/fnc_actionUnloadUnit.sqf
Line 20 in c9ad92e
the
_drag
thing is not implemented. Shouldn't such things be marked as//#TODO
in the code to make them easier to find and harder to forget?