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

Fix for "add wall" to Wooden Tower #655

Merged
merged 1 commit into from
Nov 9, 2016
Merged

Fix for "add wall" to Wooden Tower #655

merged 1 commit into from
Nov 9, 2016

Conversation

Ignatz-HeMan
Copy link
Contributor

Add Wall on Wooden Tower was not working since 0.4.
_x params ["_recipeItem","_recipeQty"]; seem not work here and the paramterer was twice loaded.
This fix is already tested and works.

Add Wall on Wooden Tower was not working since 0.4. 
_x params ["_recipeItem","_recipeQty"];	 seem not work here and the paramterer was twice loaded.
This fix is already tested and works.
@vbawol vbawol merged commit 847b3d2 into EpochModTeam:experimental Nov 9, 2016
@vbawol
Copy link
Member

vbawol commented Nov 9, 2016

Thanks for the fix @Ignatz-HeMan!

I tested and it does seem that this behavior of params is by design as it makes the scope of the variable private making it only available within the code block it was used. in this case the if (_x isEqualType[]) then{ block.

So based on that we can actually dump the if.. code block and just use params like this:

_recipeItem = _x;
_recipeQty = 1;
_x params [["_recipeItem",_recipeItem],["_recipeQty",_recipeQty]];

TEST CODE:

EP = []; 
{ 
    _recipeItem = _x; 
    _recipeQty = 1; 
    _x params [["_recipeItem",_recipeItem],["_recipeQty",_recipeQty]]; 
    EP pushBack [_recipeItem,_recipeQty] 
} forEach [["test",2],["test2"],"test"];

RESULT:
[["test",2],["test2",1],["test",1]]

@Ignatz-HeMan Ignatz-HeMan deleted the patch-5 branch February 5, 2017 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants