mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
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:
@@ -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]];
|
||||||
|
|||||||
Reference in New Issue
Block a user