Skip to content

Fix versioning#290

Merged
Killswitch00 merged 4 commits intomasterfrom
fixVersioning
Mar 6, 2016
Merged

Fix versioning#290
Killswitch00 merged 4 commits intomasterfrom
fixVersioning

Conversation

@PabstMirror
Copy link
Copy Markdown
Contributor

Fix versioning system
setVariable doesn't seem to work on local variables.

@PabstMirror PabstMirror added this to the 2.3.2 milestone Mar 2, 2016
@commy2
Copy link
Copy Markdown
Contributor

commy2 commented Mar 2, 2016

👍

@PabstMirror
Copy link
Copy Markdown
Contributor Author

missionNamespace setVariable ["_dependencyIsPresent", _dependencyInfo select 2];
if (_dependencyIsPresent) then {

Old code was doing this, as far as I know we still need the call compile to convert the string into a bool.

@commy2
Copy link
Copy Markdown
Contributor

commy2 commented Mar 3, 2016

I believe there is another method other than call compile, right?

missionNamespace getVariable can not replace all call compile. It only works when you have the name of a (global) variable.
missionNamespace getVariable "CBA_Gvar" == call compile "CBA_Gvar" == CBA_Gvar

It does not work when you compile a whole expression like here.

@NouberNou
Copy link
Copy Markdown
Contributor

OK I think I need a better explanation of what those lines are doing, because I am confused as hell... what is _dependencyInfo select 2?

@PabstMirror
Copy link
Copy Markdown
Contributor Author

@NouberNou
_dependecyInfo should be something like

["cba_main_a3",[1,0,0],"isClass(configFile >> 'CfgPatches' >> 'A3_Map_Stratis')"]
//but someone could put "true" which could mistakenly compile to `1` and get
["cba_xeh",[1,0,0],1]],["CBA",["cba_main",[1,0,0],1]

@ViperMaul setVariable won't work here because we need to convert the conditional string

"isClass(configFile >> 'CfgPatches' >> 'A3_Map_Stratis')"

into a boolean for the if, setVariable would just store the raw string into the var, it needs to be evaluated with call

Tested with a dependency of XEH[] = {"cba_xeh", {6,0,0}, 1}; which was handled without script error, but will write warning to rpt.

Comment thread addons/versioning/XEH_postInit.sqf Outdated
missionNamespace setVariable ["_dependencyIsPresent", _dependencyInfo select 2];
private _dependencyIsPresent = call compile format ["%1", (_dependencyInfo select 2)];
if ((isNil "_dependencyIsPresent") || {!(_dependencyIsPresent isEqualType false)}) then {
//https://dev.withsix.com/issues/74516 - The code could return non-bool, if "true" is converted to "1" durring binerization
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binarization

Killswitch00 added a commit that referenced this pull request Mar 6, 2016
@Killswitch00 Killswitch00 merged commit b6fa7ef into master Mar 6, 2016
@thojkooi thojkooi deleted the fixVersioning branch April 25, 2016 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants