Skip to content
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

simplify and fix 'CBA_fnc_setVarNet' and 'CBA_fnc_publicVariable' #471

Merged
merged 4 commits into from
Aug 21, 2016

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Aug 20, 2016

When merged this pull request will:

  • title
  • adjust function headers to standard
  • add warning if varName in setVarNet is not a string instead of error out
  • make functions safe to be executed in scheduled environment.

@commy2 commy2 added this to the 3.0.1 milestone Aug 20, 2016
@PabstMirror
Copy link
Contributor

Probably doesn't matter but isEqualTo is case sensitive for string comparison.
Could do missionNamespace setVariable [_varName, _value, true]; which should be the same as publicVariable

@commy2
Copy link
Contributor Author

commy2 commented Aug 20, 2016

Question is if setVar public triggers the pubVar ehs. I think BI is going back and forth with that.

@jokoho48
Copy link
Member

Could do missionNamespace setVariable [_varName, _value, true]; which should be the same as publicVariable
but i am not sure if that triggers the PVEH

@commy2
Copy link
Contributor Author

commy2 commented Aug 20, 2016

haha, ninja'd joko by 2 seconds

@commy2
Copy link
Contributor Author

commy2 commented Aug 20, 2016

Probably doesn't matter but isEqualTo is case sensitive for string comparison.

I think that's what should happen though. Not that this will ever be relevant...

@PabstMirror
Copy link
Contributor

Good point on the PVEH.
This fails when passing nil as a value and the variable is already defined:

x3 = 5;
x4 = ["x3", nil] call CBA_fnc_publicVariable

x3 is still 5, x4 is nil. With old code, x3 would be nil and x4 would be true.

@commy2
Copy link
Contributor Author

commy2 commented Aug 20, 2016

^ Oh, I missed that. I also think that it errors our in scheduled env. even before this PR.

@commy2 commy2 added the WIP label Aug 20, 2016
@commy2
Copy link
Contributor Author

commy2 commented Aug 20, 2016

before:

22:46:35 [CBA] (network) ERROR: Test FAIL File: x\cba\addons\network\test_network.sqf Line: 18
22:46:35             (not (_result)) CBA_fnc_publicVariable
22:46:35 [CBA] (network) ERROR: Test FAIL File: x\cba\addons\network\test_network.sqf Line: 36
22:46:35             (not (_result)) CBA_fnc_publicVariable
22:46:35 [CBA] (network) ERROR: Test FAIL File: x\cba\addons\network\test_network.sqf Line: 51
22:46:35             (not (_result)) CBA_fnc_setVarNet
22:46:35 [CBA] (network) ERROR: Test FAIL File: x\cba\addons\network\test_network.sqf Line: 54
22:46:35             (not (_result)) CBA_fnc_setVarNet
22:46:35 [CBA] (network) ERROR: Test FAIL File: x\cba\addons\network\test_network.sqf Line: 75
22:46:35             (not (_result)) CBA_fnc_setVarNet
22:46:36 [CBA] (network) Test OK: (CBA_fnc_publicVariable is defined) File: x\cba\addons\network\test_network.sqf Line: 12
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 21
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 24
22:46:36 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 27
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 30
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 33
22:46:36 [CBA] (network) Test OK: (CBA_fnc_setVarNet is defined) File: x\cba\addons\network\test_network.sqf Line: 43
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 57
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 60
22:46:36 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 63
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 66
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 69
22:46:36 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 72
  • has to be called, because it is accessing undefined variables in scheduled environment.
  • L18, 36, 54 and 75 are setting to nil while already being undefined. This is pointless so we save more traffic now
  • L51 fails, because it sets on objNull. This is again pointless, but idk if that even creates traffic

after:

22:39:53 [CBA] (network) Test OK: (CBA_fnc_publicVariable is defined) File: x\cba\addons\network\test_network.sqf Line: 11
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 17
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 20
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 23
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 26
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 29
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 32
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 35
22:39:53 [CBA] (network) Test OK: (CBA_fnc_setVarNet is defined) File: x\cba\addons\network\test_network.sqf Line: 42
22:39:53 [CBA] (network) WARNING: Object wrong type undefined or null File: x\cba\addons\network\fnc_setVarNet.sqf Line: 34
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 50
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 53
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 56
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 59
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 62
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 65
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 68
22:39:53 [CBA] (network) Test OK: (_result) File: x\cba\addons\network\test_network.sqf Line: 71
22:39:53 [CBA] (network) Test OK: (not (_result)) File: x\cba\addons\network\test_network.sqf Line: 74

@commy2 commy2 removed the WIP label Aug 20, 2016
@commy2 commy2 changed the title simplify 'CBA_fnc_setVarNet' and 'CBA_fnc_publicVariable' simplify and fix 'CBA_fnc_setVarNet' and 'CBA_fnc_publicVariable' Aug 20, 2016
@Killswitch00 Killswitch00 merged commit 9d4882e into master Aug 21, 2016
@Killswitch00 Killswitch00 deleted the simplify-setVarNet-publicVariable branch August 22, 2016 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants