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.
This commit is contained in:
ebaydayz
2016-05-11 15:07:58 -04:00
parent 5ad1697308
commit e60175b30c

View File

@@ -1,8 +1,10 @@
private ["_amount","_index","_index2","_temp"];
#include "defines.sqf"; #include "defines.sqf";
_index = _this select 0; _index = _this select 0;
_amount = parseNumber(_this select 1); _amount = parseNumber(_this select 1);
if(!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR") && _amount > 0 )then { 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)]; _temp set [9,(ceil _amount)];
Z_BuyingArray set [count(Z_BuyingArray),_temp]; Z_BuyingArray set [count(Z_BuyingArray),_temp];
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]]; _index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];