From e60175b30cccfe51c2cf1097b30ecb0457a87320 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 11 May 2016 15:07:58 -0400 Subject: [PATCH] Fix wrong price when adding multiples of same item to buy list Modifying _temp was also modifying Z_BuyableArray. An independent copy of the array was needed. --- .../actions/AdvancedTrading/functions/z_at_toBuyingList.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf index b8db00790..12ffd868c 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf @@ -1,8 +1,10 @@ +private ["_amount","_index","_index2","_temp"]; + #include "defines.sqf"; _index = _this select 0; _amount = parseNumber(_this select 1); if(!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR") && _amount > 0 )then { - _temp = Z_BuyableArray select _index; + _temp = [] + (Z_BuyableArray select _index); _temp set [9,(ceil _amount)]; Z_BuyingArray set [count(Z_BuyingArray),_temp]; _index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];