Fix item count being overwritten in AdvTrade right list title

When switching back to category view the item count was overwritten
from:

12a9e9f83e

It is no longer needed to set it in changeBuySell since calcPrice runs
every time changeBuySell does. The one exception is when switching back
to category view, but in that case it stays in buy mode anyway.

You forgot to add it for single currency as well @oiad
This commit is contained in:
ebaydayz
2016-07-29 16:36:36 -04:00
parent fd2eb14c5e
commit 1d2fc3b266
2 changed files with 4 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
private ["_sellPrice","_ctrltext","_bTotal"];
#include "defines.hpp"
_bTotal = 0;
_sellPrice = 0;
if(Z_SingleCurrency) then {
@@ -15,11 +16,14 @@ if(Z_SingleCurrency) then {
_sellPrice = _sellPrice + (_x select 2);
}count Z_SellArray;
_ctrltext = format["%1 %2", _sellPrice , CurrencyName];
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray];
} else {
{
_sellPrice = _sellPrice + ((_x select 2) * (_x select 9));
_bTotal = _bTotal + (_x select 9);
}count Z_BuyingArray;
_ctrltext = format["%1 %2", _sellPrice , CurrencyName];
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_BUYING", _bTotal];
};
ctrlSetText [Z_AT_PRICEDISPLAY, _ctrltext];
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText '';
@@ -32,7 +36,6 @@ if(Z_SingleCurrency) then {
_ctrltext = _sellPrice call Z_calcDefaultCurrency;
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText format ["%1 (%2 items)", localize "STR_EPOCH_TRADE_SELLING", count Z_SellArray];
} else {
_bTotal = 0;
{
_sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9));
_bTotal = _bTotal + (_x select 9);

View File

@@ -3,13 +3,11 @@
Z_Selling = !Z_Selling;
if (Z_Selling) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_291";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText localize "STR_EPOCH_TRADE_SELLING";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER";
{ctrlShow [_x,true];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON,Z_AT_FILTERBOX]; // show
{ctrlShow [_x,false];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_BACKBUTTON]; // hide
}else{
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_292";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText localize "STR_EPOCH_TRADE_BUYING";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER";
{ctrlShow [_x,true];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_FILTERBOX,Z_AT_BACKBUTTON]; // show
{ctrlShow [_x,false];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // hide