Events - Improve CBA_fnc_globalEventJIP: handle object as jipID#1777
Events - Improve CBA_fnc_globalEventJIP: handle object as jipID#1777PabstMirror merged 5 commits intoCBATeam:masterfrom
CBA_fnc_globalEventJIP: handle object as jipID#1777Conversation
johnb432
left a comment
There was a problem hiding this comment.
Not sure if having the _jipID serve two different purposes is a good idea: Imagine you only put _obj as parameter, when you meant to write hashValue _obj - makes debugging much harder.
Personally I think a new separate parameter is more suited for this.
I get your point - my motivation was to mirrorhow Happy to adjust it in a more suitable way. I could rename the params variable to sth like |
johnb432
left a comment
There was a problem hiding this comment.
Just making sure you are aware: My reviews don't mean much in CBA, I'm only a contributor and not a maintainer.
addons/events/fnc_globalEventJIP.sqf
Outdated
| [QGVAR(eventJIP), [_eventName, _params]] call CBA_fnc_globalEvent; | ||
|
|
||
| // Remove JIP once obj is deleted | ||
| if (!isNil "_obj") then { [_jipID, _obj] call FUNCMAIN(removeGlobalEventJIP); }; |
There was a problem hiding this comment.
Despite it being technically correct, I wouldn't use the FUNCMAIN macro as it's not used anywhere else in CBA.
There was a problem hiding this comment.
| if (!isNil "_obj") then { [_jipID, _obj] call FUNCMAIN(removeGlobalEventJIP); }; | |
| if (!isNil "_obj") then { [_jipID, _obj] call CBA_fnc_removeGlobalEventJIP }; |
addons/events/fnc_globalEventJIP.sqf
Outdated
| params [["_eventName", "", [""]], ["_params", []], ["_jipID", "", [""]]]; | ||
| params [["_eventName", "", [""]], ["_params", []], ["_jipOrObj", "", ["", objNull]]]; | ||
|
|
||
| private ["_obj", "_jipID"]; |
There was a problem hiding this comment.
Personally, I hate this way of declaring variables in sqf.
fair. just if anyone is interacting with the PR's i am very happy to adjust simply to ensure chances of successful merge. |
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
When merged this pull request will:
Added handling for Objects as JIP:
=> Remove JIP once object is deleted