-
Notifications
You must be signed in to change notification settings - Fork 149
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
Update fnc_taskPatrol func header #360
Conversation
|
@esteldunedain Thank you for the explanation. I think what is throwing me off is the scope of _this. I was thinking that _this was equal to [1,2,3,1,2,3,4] instead of [1,2,4] for every instance after that particular code block.... Looking over this I realized that sqf doesn't have a "+=" command for adding like other languages. Sorry about that. |
The position and radius parameters are optional and there is no need to change the function header for that reason. Changing the default radius from 100 to 50 in the example call could be useful for the understanding of the function. |
I figured out where it is going wrong. If all that is passed to the function is the group then `20:15:34 Error position: <addWaypoint [_position, _radius]; _wayp> Now, when Would it be best to leave the code the way it is and just change the func header as I proposed, or change the code to allow for only passing a group? |
The function header represents how the function is supposed to (and AFAIK has, at some point in time) work(ed), so the way forward here is to fix the now broken function. |
@@ -47,6 +47,11 @@ _position = _position call CBA_fnc_getPos; | |||
[_group] call CBA_fnc_clearWaypoints; | |||
|
|||
private _this =+ _this; | |||
switch (count _this) do { | |||
case 1 : {_this append [_position, _radius]}; | |||
case 2 : {_this pushback _radius}; |
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.
pushBack
(camelCase)
I noticed that an error is thrown from fnc_addWaypoint if the position and radius wasn't passed so they would not be optional.
Also, could someone explain to me the point of line 49: private _this += _this;
I've been trying to understand the point of it, but I've removed it and the function works the same with or without it from what I can tell. Is it left over code by chance?