2017-07-13 10:26:03 +02:00
|
|
|
/*
|
|
|
|
* CTradeWindow.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2014-07-13 16:31:00 +03:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CTradeWindow.h"
|
|
|
|
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../gui/CGuiHandler.h"
|
2023-01-05 19:34:37 +02:00
|
|
|
#include "../gui/CursorHandler.h"
|
2023-06-02 15:42:18 +02:00
|
|
|
#include "../render/Canvas.h"
|
2023-04-27 19:21:06 +02:00
|
|
|
#include "../gui/Shortcut.h"
|
2023-05-16 14:10:26 +02:00
|
|
|
#include "../gui/WindowHandler.h"
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "../widgets/Buttons.h"
|
2023-05-30 16:31:45 +02:00
|
|
|
#include "../widgets/Slider.h"
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "../widgets/TextControls.h"
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
#include "../CGameInfo.h"
|
|
|
|
#include "../CPlayerInterface.h"
|
|
|
|
|
|
|
|
#include "../../CCallback.h"
|
|
|
|
|
|
|
|
#include "../../lib/CGeneralTextHandler.h"
|
|
|
|
#include "../../lib/CHeroHandler.h"
|
|
|
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
|
|
|
#include "../../lib/mapObjects/CGMarket.h"
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2023-09-28 00:17:05 +02:00
|
|
|
CTradeWindow::CTradeWindow(const ImagePath & bgName, const IMarket *Market, const CGHeroInstance *Hero, const std::function<void()> & onWindowClosed, EMarketMode Mode):
|
2023-11-05 00:53:37 +02:00
|
|
|
CTradeBase(Market, Hero),
|
2016-03-12 03:41:27 +02:00
|
|
|
CWindowObject(PLAYER_COLORED, bgName),
|
2023-09-28 00:17:05 +02:00
|
|
|
onWindowClosed(onWindowClosed),
|
2016-03-12 03:41:27 +02:00
|
|
|
readyToTrade(false)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
|
|
|
|
2014-07-13 16:31:00 +03:00
|
|
|
mode = Mode;
|
|
|
|
initTypes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CTradeWindow::initTypes()
|
|
|
|
{
|
|
|
|
switch(mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::RESOURCE_RESOURCE:
|
|
|
|
itemsType[1] = RESOURCE;
|
|
|
|
itemsType[0] = RESOURCE;
|
|
|
|
break;
|
|
|
|
case EMarketMode::RESOURCE_PLAYER:
|
|
|
|
itemsType[1] = RESOURCE;
|
|
|
|
itemsType[0] = PLAYER;
|
|
|
|
break;
|
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
|
|
|
itemsType[1] = CREATURE;
|
|
|
|
itemsType[0] = RESOURCE;
|
|
|
|
break;
|
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
|
|
|
itemsType[1] = RESOURCE;
|
|
|
|
itemsType[0] = ARTIFACT_TYPE;
|
|
|
|
break;
|
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
|
|
|
itemsType[1] = ARTIFACT_INSTANCE;
|
|
|
|
itemsType[0] = RESOURCE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CTradeWindow::initItems(bool Left)
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
|
|
|
|
|
2014-07-13 16:31:00 +03:00
|
|
|
if(Left && (itemsType[1] == ARTIFACT_TYPE || itemsType[1] == ARTIFACT_INSTANCE))
|
|
|
|
{
|
|
|
|
if(mode == EMarketMode::ARTIFACT_RESOURCE)
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
auto item = std::make_shared<CTradeableItem>(Point(137, 469), itemsType[Left], -1, 1, 0);
|
|
|
|
item->recActions &= ~(UPDATE | SHOWALL);
|
|
|
|
items[Left].push_back(item);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
2018-04-07 13:34:11 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::vector<int> *ids = getItemsIds(Left);
|
|
|
|
std::vector<Rect> pos;
|
|
|
|
int amount = -1;
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
getPositionsFor(pos, Left, itemsType[Left]);
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
if(Left || !ids)
|
|
|
|
amount = 7;
|
|
|
|
else
|
2020-10-01 10:38:06 +02:00
|
|
|
amount = static_cast<int>(ids->size());
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
if(ids)
|
|
|
|
vstd::amin(amount, ids->size());
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
for(int j=0; j<amount; j++)
|
|
|
|
{
|
|
|
|
int id = (ids && ids->size()>j) ? (*ids)[j] : j;
|
|
|
|
if(id < 0 && mode != EMarketMode::ARTIFACT_EXP) //when sacrificing artifacts we need to prepare empty slots
|
|
|
|
continue;
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
auto item = std::make_shared<CTradeableItem>(pos[j].topLeft(), itemsType[Left], id, Left, j);
|
|
|
|
item->pos = pos[j] + this->pos.topLeft();
|
2023-11-05 00:53:37 +02:00
|
|
|
if(mode != EMarketMode::ARTIFACT_EXP)
|
|
|
|
item->clickPressedCallback = [this](std::shared_ptr<CTradeableItem> altarSlot) -> void
|
|
|
|
{
|
|
|
|
if(altarSlot->left)
|
|
|
|
{
|
|
|
|
if(hLeft != altarSlot)
|
|
|
|
hLeft = altarSlot;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(hRight != altarSlot)
|
|
|
|
hRight = altarSlot;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
selectionChanged(altarSlot->left);
|
|
|
|
};
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
items[Left].push_back(item);
|
|
|
|
}
|
|
|
|
vstd::clear_pointer(ids);
|
|
|
|
initSubs(Left);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<int> *CTradeWindow::getItemsIds(bool Left)
|
|
|
|
{
|
|
|
|
std::vector<int> *ids = nullptr;
|
|
|
|
|
2023-11-05 02:01:23 +02:00
|
|
|
if(!Left)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
switch(itemsType[0])
|
|
|
|
{
|
|
|
|
case PLAYER:
|
|
|
|
ids = new std::vector<int>;
|
|
|
|
for(int i = 0; i < PlayerColor::PLAYER_LIMIT_I; i++)
|
|
|
|
if(PlayerColor(i) != LOCPLINT->playerID && LOCPLINT->cb->getPlayerStatus(PlayerColor(i)) == EPlayerStatus::INGAME)
|
|
|
|
ids->push_back(i);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARTIFACT_TYPE:
|
|
|
|
ids = new std::vector<int>(market->availableItemsIds(mode));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ids;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CTradeWindow::getPositionsFor(std::vector<Rect> &poss, bool Left, EType type) const
|
|
|
|
{
|
2023-11-05 02:01:23 +02:00
|
|
|
//seven boxes:
|
|
|
|
// X X X
|
|
|
|
// X X X
|
|
|
|
// X
|
2023-11-06 15:21:40 +02:00
|
|
|
int h = 0, w = 0, x = 0, y = 0, dx = 0, dy = 0;
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case RESOURCE:
|
|
|
|
dx = 82;
|
|
|
|
dy = 79;
|
|
|
|
x = 39;
|
|
|
|
y = 180;
|
|
|
|
h = 68;
|
|
|
|
w = 70;
|
|
|
|
break;
|
|
|
|
case PLAYER:
|
|
|
|
dx = 83;
|
|
|
|
dy = 118;
|
|
|
|
h = 64;
|
|
|
|
w = 58;
|
|
|
|
x = 44;
|
|
|
|
y = 83;
|
|
|
|
assert(!Left);
|
|
|
|
break;
|
|
|
|
case CREATURE://45,123
|
|
|
|
x = 45;
|
|
|
|
y = 123;
|
|
|
|
w = 58;
|
|
|
|
h = 64;
|
|
|
|
dx = 83;
|
|
|
|
dy = 98;
|
|
|
|
assert(Left);
|
|
|
|
break;
|
|
|
|
case ARTIFACT_TYPE://45,123
|
|
|
|
x = 340 - 289;
|
|
|
|
y = 180;
|
|
|
|
w = 44;
|
|
|
|
h = 44;
|
|
|
|
dx = 83;
|
|
|
|
dy = 79;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int leftToRightOffset = 289;
|
2023-11-05 02:01:23 +02:00
|
|
|
|
|
|
|
const std::vector<Rect> tmp =
|
|
|
|
{
|
|
|
|
Rect(Point(x + 0 * dx, y + 0 * dx), Point(w, h) ),
|
|
|
|
Rect(Point(x + 1 * dx, y + 0 * dx), Point(w, h) ),
|
|
|
|
Rect(Point(x + 2 * dx, y + 0 * dx), Point(w, h) ),
|
|
|
|
Rect(Point(x + 0 * dx, y + 1 * dy), Point(w, h) ),
|
|
|
|
Rect(Point(x + 1 * dx, y + 1 * dy), Point(w, h) ),
|
|
|
|
Rect(Point(x + 2 * dx, y + 1 * dy), Point(w, h) ),
|
|
|
|
Rect(Point(x + 1 * dx, y + 2 * dy), Point(w, h) )
|
|
|
|
};
|
|
|
|
|
|
|
|
vstd::concatenate(poss, tmp);
|
|
|
|
|
|
|
|
if(!Left)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2023-11-05 02:01:23 +02:00
|
|
|
for(Rect &r : poss)
|
|
|
|
r.x += leftToRightOffset;
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CTradeWindow::initSubs(bool Left)
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
for(auto item : items[Left])
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
if(Left)
|
|
|
|
{
|
|
|
|
switch(itemsType[1])
|
|
|
|
{
|
|
|
|
case CREATURE:
|
2023-03-09 15:36:46 +02:00
|
|
|
item->subtitle = std::to_string(hero->getStackCount(SlotID(item->serial)));
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
case RESOURCE:
|
2023-04-05 02:26:29 +02:00
|
|
|
item->subtitle = std::to_string(LOCPLINT->cb->getResourceAmount(static_cast<EGameResID>(item->serial)));
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //right side
|
|
|
|
{
|
|
|
|
if(itemsType[0] == PLAYER)
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
item->subtitle = CGI->generaltexth->capColors[item->id];
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
else if(hLeft)//artifact, creature
|
|
|
|
{
|
|
|
|
int h1, h2; //hlp variables for getting offer
|
2018-04-07 13:34:11 +02:00
|
|
|
market->getOffer(hLeft->id, item->id, h1, h2, mode);
|
|
|
|
if(item->id != hLeft->id || mode != EMarketMode::RESOURCE_RESOURCE) //don't allow exchanging same resources
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
std::ostringstream oss;
|
|
|
|
oss << h2;
|
|
|
|
if(h1!=1)
|
|
|
|
oss << "/" << h1;
|
2018-04-07 13:34:11 +02:00
|
|
|
item->subtitle = oss.str();
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
else
|
2018-04-07 13:34:11 +02:00
|
|
|
item->subtitle = CGI->generaltexth->allTexts[164]; // n/a
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
else
|
2018-04-07 13:34:11 +02:00
|
|
|
item->subtitle = "";
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-02 15:42:18 +02:00
|
|
|
void CTradeWindow::showAll(Canvas & to)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
CWindowObject::showAll(to);
|
|
|
|
|
|
|
|
if(hRight)
|
2023-06-02 15:42:18 +02:00
|
|
|
to.drawBorder(Rect::createAround(hRight->pos, 1), Colors::BRIGHT_YELLOW, 2);
|
2014-07-13 16:31:00 +03:00
|
|
|
if(hLeft && hLeft->type != ARTIFACT_INSTANCE)
|
2023-06-02 15:42:18 +02:00
|
|
|
to.drawBorder(Rect::createAround(hLeft->pos, 1), Colors::BRIGHT_YELLOW, 2);
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
if(readyToTrade)
|
|
|
|
{
|
2017-07-29 19:22:58 +02:00
|
|
|
if(hLeft)
|
2023-11-05 02:01:23 +02:00
|
|
|
hLeft->showAllAt(pos.topLeft() + selectionOffset(true), updateSlotSubtitle(true), to);
|
2017-07-29 19:22:58 +02:00
|
|
|
if(hRight)
|
2023-11-05 02:01:23 +02:00
|
|
|
hRight->showAllAt(pos.topLeft() + selectionOffset(false), updateSlotSubtitle(false), to);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-28 00:17:05 +02:00
|
|
|
void CTradeWindow::close()
|
|
|
|
{
|
|
|
|
if (onWindowClosed)
|
|
|
|
onWindowClosed();
|
|
|
|
|
|
|
|
CWindowObject::close();
|
|
|
|
}
|
|
|
|
|
2023-08-19 20:43:50 +02:00
|
|
|
void CTradeWindow::setMode(EMarketMode Mode)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
const IMarket *m = market;
|
|
|
|
const CGHeroInstance *h = hero;
|
2023-09-28 00:17:05 +02:00
|
|
|
const auto functor = onWindowClosed;
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2023-09-28 00:17:05 +02:00
|
|
|
onWindowClosed = nullptr; // don't call on closing of this window - pass it to next window
|
2018-07-25 00:36:48 +02:00
|
|
|
close();
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
switch(Mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::CREATURE_EXP:
|
|
|
|
case EMarketMode::ARTIFACT_EXP:
|
|
|
|
break;
|
|
|
|
default:
|
2023-09-28 00:17:05 +02:00
|
|
|
GH.windows().createAndPushWindow<CMarketplaceWindow>(m, h, functor, Mode);
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-04 18:54:09 +02:00
|
|
|
void CTradeWindow::artifactSelected(CHeroArtPlace *slot)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
assert(mode == EMarketMode::ARTIFACT_RESOURCE);
|
2023-04-23 13:33:47 +02:00
|
|
|
items[1][0]->setArtInstance(slot->getArt());
|
|
|
|
if(slot->getArt())
|
2014-07-13 16:31:00 +03:00
|
|
|
hLeft = items[1][0];
|
|
|
|
else
|
|
|
|
hLeft = nullptr;
|
|
|
|
|
|
|
|
selectionChanged(true);
|
|
|
|
}
|
|
|
|
|
2023-08-23 14:07:50 +02:00
|
|
|
ImagePath CMarketplaceWindow::getBackgroundForMode(EMarketMode mode)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
switch(mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::RESOURCE_RESOURCE:
|
2023-08-23 14:07:50 +02:00
|
|
|
return ImagePath::builtin("TPMRKRES.bmp");
|
2014-07-13 16:31:00 +03:00
|
|
|
case EMarketMode::RESOURCE_PLAYER:
|
2023-08-23 14:07:50 +02:00
|
|
|
return ImagePath::builtin("TPMRKPTS.bmp");
|
2014-07-13 16:31:00 +03:00
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
2023-08-23 14:07:50 +02:00
|
|
|
return ImagePath::builtin("TPMRKCRS.bmp");
|
2014-07-13 16:31:00 +03:00
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
2023-08-23 14:07:50 +02:00
|
|
|
return ImagePath::builtin("TPMRKABS.bmp");
|
2014-07-13 16:31:00 +03:00
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
2023-08-23 14:07:50 +02:00
|
|
|
return ImagePath::builtin("TPMRKASS.bmp");
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
assert(0);
|
2023-08-23 14:07:50 +02:00
|
|
|
return {};
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
|
2023-09-28 00:17:05 +02:00
|
|
|
CMarketplaceWindow::CMarketplaceWindow(const IMarket * Market, const CGHeroInstance * Hero, const std::function<void()> & onWindowClosed, EMarketMode Mode)
|
|
|
|
: CTradeWindow(getBackgroundForMode(Mode), Market, Hero, onWindowClosed, Mode)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
madeTransaction = false;
|
2023-04-29 14:10:30 +02:00
|
|
|
bool sliderNeeded = (mode != EMarketMode::RESOURCE_ARTIFACT && mode != EMarketMode::ARTIFACT_RESOURCE);
|
2014-07-13 16:31:00 +03:00
|
|
|
|
2022-11-29 17:07:21 +02:00
|
|
|
statusBar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
std::string title;
|
|
|
|
|
2023-04-26 22:18:43 +02:00
|
|
|
if(auto * o = dynamic_cast<const CGTownInstance *>(market))
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
switch (mode)
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
2023-01-04 15:17:50 +02:00
|
|
|
title = (*CGI->townh)[ETownType::STRONGHOLD]->town->buildings[BuildingID::FREELANCERS_GUILD]->getNameTranslated();
|
2018-04-07 13:34:11 +02:00
|
|
|
break;
|
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
2023-10-28 11:27:10 +02:00
|
|
|
title = (*CGI->townh)[o->getFaction()]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->getNameTranslated();
|
2018-04-07 13:34:11 +02:00
|
|
|
break;
|
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
2023-10-28 11:27:10 +02:00
|
|
|
title = (*CGI->townh)[o->getFaction()]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->getNameTranslated();
|
2022-12-02 18:52:05 +02:00
|
|
|
|
|
|
|
// create image that copies part of background containing slot MISC_1 into position of slot MISC_5
|
|
|
|
// this is workaround for bug in H3 files where this slot for ragdoll on this screen is missing
|
2023-01-30 13:58:13 +02:00
|
|
|
images.push_back(std::make_shared<CPicture>(background->getSurface(), Rect(20, 187, 47, 47), 18, 339 ));
|
2018-04-07 13:34:11 +02:00
|
|
|
break;
|
|
|
|
default:
|
2014-07-13 16:31:00 +03:00
|
|
|
title = CGI->generaltexth->allTexts[158];
|
2018-04-07 13:34:11 +02:00
|
|
|
break;
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
}
|
2023-04-29 14:10:30 +02:00
|
|
|
else if(auto * o = dynamic_cast<const CGMarket *>(market))
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2023-04-29 17:08:42 +02:00
|
|
|
title = o->title;
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
|
2022-11-26 23:12:20 +02:00
|
|
|
titleLabel = std::make_shared<CLabel>(300, 27, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, title);
|
2023-07-06 20:37:18 +02:00
|
|
|
if(mode == EMarketMode::ARTIFACT_RESOURCE)
|
|
|
|
{
|
|
|
|
arts = std::make_shared<CArtifactsOfHeroMarket>(Point(-361, 46));
|
|
|
|
arts->selectArtCallback = std::bind(&CTradeWindow::artifactSelected, this, _1);
|
|
|
|
arts->setHero(hero);
|
2023-09-18 21:58:08 +02:00
|
|
|
addSetAndCallbacks(arts);
|
2023-07-06 20:37:18 +02:00
|
|
|
}
|
2014-07-13 16:31:00 +03:00
|
|
|
initItems(false);
|
|
|
|
initItems(true);
|
|
|
|
|
2023-08-23 14:07:50 +02:00
|
|
|
ok = std::make_shared<CButton>(Point(516, 520), AnimationPath::builtin("IOK6432.DEF"), CGI->generaltexth->zelp[600], [&](){ close(); }, EShortcut::GLOBAL_RETURN);
|
|
|
|
deal = std::make_shared<CButton>(Point(307, 520), AnimationPath::builtin("TPMRKB.DEF"), CGI->generaltexth->zelp[595], [&](){ makeDeal(); } );
|
2014-07-13 16:31:00 +03:00
|
|
|
deal->block(true);
|
|
|
|
|
|
|
|
if(sliderNeeded)
|
|
|
|
{
|
2023-06-22 22:49:38 +02:00
|
|
|
slider = std::make_shared<CSlider>(Point(231, 490), 137, std::bind(&CMarketplaceWindow::sliderMoved, this, _1), 0, 0, 0, Orientation::HORIZONTAL);
|
2023-08-23 14:07:50 +02:00
|
|
|
max = std::make_shared<CButton>(Point(229, 520), AnimationPath::builtin("IRCBTNS.DEF"), CGI->generaltexth->zelp[596], [&](){ setMax(); });
|
2014-07-13 16:31:00 +03:00
|
|
|
max->block(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
deal->moveBy(Point(-30, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
//left side
|
|
|
|
switch(Mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::RESOURCE_RESOURCE:
|
|
|
|
case EMarketMode::RESOURCE_PLAYER:
|
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
2022-11-26 23:12:20 +02:00
|
|
|
labels.push_back(std::make_shared<CLabel>(154, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[270]));
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
|
|
|
//%s's Creatures
|
2023-01-02 13:27:03 +02:00
|
|
|
labels.push_back(std::make_shared<CLabel>(152, 102, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->getNameTranslated())));
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
|
|
|
//%s's Artifacts
|
2023-01-02 13:27:03 +02:00
|
|
|
labels.push_back(std::make_shared<CLabel>(152, 56, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->getNameTranslated())));
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
Rect traderTextRect;
|
|
|
|
|
2014-07-13 16:31:00 +03:00
|
|
|
//right side
|
|
|
|
switch(Mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::RESOURCE_RESOURCE:
|
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
2022-11-26 23:12:20 +02:00
|
|
|
labels.push_back(std::make_shared<CLabel>(445, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168]));
|
2014-07-13 16:31:00 +03:00
|
|
|
traderTextRect = Rect(316, 48, 260, 75);
|
|
|
|
break;
|
|
|
|
case EMarketMode::RESOURCE_PLAYER:
|
2022-11-26 23:12:20 +02:00
|
|
|
labels.push_back(std::make_shared<CLabel>(445, 55, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169]));
|
2014-07-13 16:31:00 +03:00
|
|
|
traderTextRect = Rect(28, 48, 260, 75);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-11-26 23:12:20 +02:00
|
|
|
traderText = std::make_shared<CTextBox>("", traderTextRect, 0, FONT_SMALL, ETextAlignment::CENTER);
|
2014-07-13 16:31:00 +03:00
|
|
|
int specialOffset = mode == EMarketMode::ARTIFACT_RESOURCE ? 35 : 0; //in selling artifacts mode we need to move res-res and art-res buttons down
|
|
|
|
|
|
|
|
if(printButtonFor(EMarketMode::RESOURCE_PLAYER))
|
2023-08-23 14:07:50 +02:00
|
|
|
buttons.push_back(std::make_shared<CButton>(Point(18, 520),AnimationPath::builtin("TPMRKBU1.DEF"), CGI->generaltexth->zelp[612], [&](){ setMode(EMarketMode::RESOURCE_PLAYER);}));
|
2014-07-13 16:31:00 +03:00
|
|
|
if(printButtonFor(EMarketMode::RESOURCE_RESOURCE))
|
2023-08-23 14:07:50 +02:00
|
|
|
buttons.push_back(std::make_shared<CButton>(Point(516, 450 + specialOffset),AnimationPath::builtin("TPMRKBU5.DEF"), CGI->generaltexth->zelp[605], [&](){ setMode(EMarketMode::RESOURCE_RESOURCE);}));
|
2014-07-13 16:31:00 +03:00
|
|
|
if(printButtonFor(EMarketMode::CREATURE_RESOURCE))
|
2023-08-23 14:07:50 +02:00
|
|
|
buttons.push_back(std::make_shared<CButton>(Point(516, 485),AnimationPath::builtin("TPMRKBU4.DEF"), CGI->generaltexth->zelp[599], [&](){ setMode(EMarketMode::CREATURE_RESOURCE);}));
|
2014-07-13 16:31:00 +03:00
|
|
|
if(printButtonFor(EMarketMode::RESOURCE_ARTIFACT))
|
2023-08-23 14:07:50 +02:00
|
|
|
buttons.push_back(std::make_shared<CButton>(Point(18, 450 + specialOffset),AnimationPath::builtin("TPMRKBU2.DEF"), CGI->generaltexth->zelp[598], [&](){ setMode(EMarketMode::RESOURCE_ARTIFACT);}));
|
2014-07-13 16:31:00 +03:00
|
|
|
if(printButtonFor(EMarketMode::ARTIFACT_RESOURCE))
|
2023-08-23 14:07:50 +02:00
|
|
|
buttons.push_back(std::make_shared<CButton>(Point(18, 485),AnimationPath::builtin("TPMRKBU3.DEF"), CGI->generaltexth->zelp[613], [&](){ setMode(EMarketMode::ARTIFACT_RESOURCE);}));
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
updateTraderText();
|
|
|
|
}
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CMarketplaceWindow::~CMarketplaceWindow() = default;
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
void CMarketplaceWindow::setMax()
|
|
|
|
{
|
2023-05-30 17:10:22 +02:00
|
|
|
slider->scrollToMax();
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMarketplaceWindow::makeDeal()
|
|
|
|
{
|
|
|
|
int sliderValue = 0;
|
|
|
|
if(slider)
|
2014-08-03 17:31:56 +03:00
|
|
|
sliderValue = slider->getValue();
|
2014-07-13 16:31:00 +03:00
|
|
|
else
|
|
|
|
sliderValue = !deal->isBlocked(); //should always be 1
|
|
|
|
|
|
|
|
if(!sliderValue)
|
|
|
|
return;
|
|
|
|
|
2023-03-21 20:02:58 +02:00
|
|
|
bool allowDeal = true;
|
2023-03-20 01:18:32 +02:00
|
|
|
int leftIdToSend = hLeft->id;
|
2014-07-13 16:31:00 +03:00
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case EMarketMode::CREATURE_RESOURCE:
|
|
|
|
leftIdToSend = hLeft->serial;
|
|
|
|
break;
|
|
|
|
case EMarketMode::ARTIFACT_RESOURCE:
|
2023-07-03 22:11:56 +02:00
|
|
|
leftIdToSend = hLeft->getArtInstance()->getId().getNum();
|
2014-07-13 16:31:00 +03:00
|
|
|
break;
|
2023-03-20 01:18:32 +02:00
|
|
|
case EMarketMode::RESOURCE_ARTIFACT:
|
2023-03-21 12:13:53 +02:00
|
|
|
if(!ArtifactID(hRight->id).toArtifact()->canBePutAt(hero))
|
2023-03-20 01:18:32 +02:00
|
|
|
{
|
2023-03-21 20:02:58 +02:00
|
|
|
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("core.genrltxt.326"));
|
|
|
|
allowDeal = false;
|
2023-03-20 01:18:32 +02:00
|
|
|
}
|
|
|
|
break;
|
2014-07-13 16:31:00 +03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-03-21 20:02:58 +02:00
|
|
|
if(allowDeal)
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2023-03-20 01:18:32 +02:00
|
|
|
if(slider)
|
|
|
|
{
|
2023-04-28 03:14:27 +02:00
|
|
|
LOCPLINT->cb->trade(market, mode, leftIdToSend, hRight->id, slider->getValue() * r1, hero);
|
2023-05-30 17:10:22 +02:00
|
|
|
slider->scrollTo(0);
|
2023-03-20 01:18:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-04-28 03:14:27 +02:00
|
|
|
LOCPLINT->cb->trade(market, mode, leftIdToSend, hRight->id, r2, hero);
|
2023-03-20 01:18:32 +02:00
|
|
|
}
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
|
2023-03-21 20:02:58 +02:00
|
|
|
madeTransaction = true;
|
2014-07-13 16:31:00 +03:00
|
|
|
hLeft = nullptr;
|
|
|
|
hRight = nullptr;
|
|
|
|
selectionChanged(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMarketplaceWindow::sliderMoved( int to )
|
|
|
|
{
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMarketplaceWindow::selectionChanged(bool side)
|
|
|
|
{
|
|
|
|
readyToTrade = hLeft && hRight;
|
|
|
|
if(mode == EMarketMode::RESOURCE_RESOURCE)
|
|
|
|
readyToTrade = readyToTrade && (hLeft->id != hRight->id); //for resource trade, two DIFFERENT resources must be selected
|
|
|
|
|
2020-10-06 01:27:04 +02:00
|
|
|
if(mode == EMarketMode::ARTIFACT_RESOURCE && !hLeft)
|
2023-04-23 13:33:47 +02:00
|
|
|
arts->unmarkSlots();
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
if(readyToTrade)
|
|
|
|
{
|
|
|
|
int soldItemId = hLeft->id;
|
|
|
|
market->getOffer(soldItemId, hRight->id, r1, r2, mode);
|
|
|
|
|
|
|
|
if(slider)
|
|
|
|
{
|
|
|
|
int newAmount = -1;
|
|
|
|
if(itemsType[1] == RESOURCE)
|
2023-04-05 02:26:29 +02:00
|
|
|
newAmount = LOCPLINT->cb->getResourceAmount(static_cast<EGameResID>(soldItemId));
|
2014-07-13 16:31:00 +03:00
|
|
|
else if(itemsType[1] == CREATURE)
|
2015-12-24 20:30:57 +02:00
|
|
|
newAmount = hero->getStackCount(SlotID(hLeft->serial)) - (hero->stacksCount() == 1 && hero->needsLastStack());
|
2014-07-13 16:31:00 +03:00
|
|
|
else
|
|
|
|
assert(0);
|
|
|
|
|
|
|
|
slider->setAmount(newAmount / r1);
|
2023-05-30 17:10:22 +02:00
|
|
|
slider->scrollTo(0);
|
2014-07-13 16:31:00 +03:00
|
|
|
max->block(false);
|
|
|
|
deal->block(false);
|
|
|
|
}
|
|
|
|
else if(itemsType[1] == RESOURCE) //buying -> check if we can afford transaction
|
|
|
|
{
|
2023-04-05 02:26:29 +02:00
|
|
|
deal->block(LOCPLINT->cb->getResourceAmount(static_cast<EGameResID>(soldItemId)) < r1);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
deal->block(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(slider)
|
|
|
|
{
|
|
|
|
max->block(true);
|
|
|
|
slider->setAmount(0);
|
2023-05-30 17:10:22 +02:00
|
|
|
slider->scrollTo(0);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
deal->block(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(side && itemsType[0] != PLAYER) //items[1] selection changed, recalculate offers
|
|
|
|
initSubs(false);
|
|
|
|
|
|
|
|
updateTraderText();
|
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
2023-08-19 20:43:50 +02:00
|
|
|
bool CMarketplaceWindow::printButtonFor(EMarketMode M) const
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
2023-09-18 16:22:30 +02:00
|
|
|
if (!market->allowsTrade(M))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (M == mode)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( M == EMarketMode::RESOURCE_RESOURCE || M == EMarketMode::RESOURCE_PLAYER)
|
|
|
|
{
|
|
|
|
auto * town = dynamic_cast<const CGTownInstance *>(market);
|
|
|
|
|
|
|
|
if (town)
|
|
|
|
return town->getOwner() == LOCPLINT->playerID;
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return hero != nullptr;
|
|
|
|
}
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
|
2023-11-05 02:01:23 +02:00
|
|
|
void CMarketplaceWindow::updateGarrison()
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
if(mode != EMarketMode::CREATURE_RESOURCE)
|
|
|
|
return;
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::set<std::shared_ptr<CTradeableItem>> toRemove;
|
2014-07-13 16:31:00 +03:00
|
|
|
getEmptySlots(toRemove);
|
|
|
|
removeItems(toRemove);
|
|
|
|
initSubs(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMarketplaceWindow::artifactsChanged(bool Left)
|
|
|
|
{
|
|
|
|
assert(!Left);
|
|
|
|
if(mode != EMarketMode::RESOURCE_ARTIFACT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::vector<int> available = market->availableItemsIds(mode);
|
2018-04-07 13:34:11 +02:00
|
|
|
std::set<std::shared_ptr<CTradeableItem>> toRemove;
|
|
|
|
for(auto item : items[0])
|
|
|
|
if(!vstd::contains(available, item->id))
|
|
|
|
toRemove.insert(item);
|
2014-07-13 16:31:00 +03:00
|
|
|
|
|
|
|
removeItems(toRemove);
|
2023-03-25 23:31:14 +02:00
|
|
|
|
|
|
|
// clear set to erase final instance of shared_ptr - we want to redraw screen only after it has been deleted
|
|
|
|
toRemove.clear();
|
2014-07-13 16:31:00 +03:00
|
|
|
redraw();
|
|
|
|
}
|
|
|
|
|
2023-11-05 02:01:23 +02:00
|
|
|
std::string CMarketplaceWindow::updateSlotSubtitle(bool Left) const
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
if(Left)
|
|
|
|
{
|
|
|
|
switch(itemsType[1])
|
|
|
|
{
|
|
|
|
case RESOURCE:
|
|
|
|
case CREATURE:
|
|
|
|
{
|
|
|
|
int val = slider
|
2014-08-03 17:31:56 +03:00
|
|
|
? slider->getValue() * r1
|
2014-07-13 16:31:00 +03:00
|
|
|
: (((deal->isBlocked())) ? 0 : r1);
|
|
|
|
|
2023-03-09 15:36:46 +02:00
|
|
|
return std::to_string(val);
|
2014-07-13 16:31:00 +03:00
|
|
|
}
|
|
|
|
case ARTIFACT_INSTANCE:
|
|
|
|
return ((deal->isBlocked()) ? "0" : "1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(itemsType[0])
|
|
|
|
{
|
|
|
|
case RESOURCE:
|
|
|
|
if(slider)
|
2023-03-09 15:36:46 +02:00
|
|
|
return std::to_string( slider->getValue() * r2 );
|
2014-07-13 16:31:00 +03:00
|
|
|
else
|
2023-03-09 15:36:46 +02:00
|
|
|
return std::to_string(r2);
|
2014-07-13 16:31:00 +03:00
|
|
|
case ARTIFACT_TYPE:
|
|
|
|
return ((deal->isBlocked()) ? "0" : "1");
|
|
|
|
case PLAYER:
|
|
|
|
return (hRight ? CGI->generaltexth->capColors[hRight->id] : "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
|
|
|
|
Point CMarketplaceWindow::selectionOffset(bool Left) const
|
|
|
|
{
|
|
|
|
if(Left)
|
|
|
|
{
|
|
|
|
switch(itemsType[1])
|
|
|
|
{
|
|
|
|
case RESOURCE:
|
|
|
|
return Point(122, 446);
|
|
|
|
case CREATURE:
|
|
|
|
return Point(128, 450);
|
|
|
|
case ARTIFACT_INSTANCE:
|
|
|
|
return Point(134, 466);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(itemsType[0])
|
|
|
|
{
|
|
|
|
case RESOURCE:
|
|
|
|
if(mode == EMarketMode::ARTIFACT_RESOURCE)
|
|
|
|
return Point(410, 469);
|
|
|
|
else
|
|
|
|
return Point(410, 446);
|
|
|
|
case ARTIFACT_TYPE:
|
|
|
|
return Point(425, 447);
|
|
|
|
case PLAYER:
|
|
|
|
return Point(417, 451);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(0);
|
|
|
|
return Point(0,0);
|
|
|
|
}
|
|
|
|
|
2016-11-26 14:14:43 +02:00
|
|
|
void CMarketplaceWindow::resourceChanged()
|
2014-07-13 16:31:00 +03:00
|
|
|
{
|
|
|
|
initSubs(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMarketplaceWindow::updateTraderText()
|
|
|
|
{
|
|
|
|
if(readyToTrade)
|
|
|
|
{
|
|
|
|
if(mode == EMarketMode::RESOURCE_PLAYER)
|
|
|
|
{
|
|
|
|
//I can give %s to the %s player.
|
|
|
|
traderText->setText(boost::str(boost::format(CGI->generaltexth->allTexts[165]) % hLeft->getName() % hRight->getName()));
|
|
|
|
}
|
|
|
|
else if(mode == EMarketMode::RESOURCE_ARTIFACT)
|
|
|
|
{
|
|
|
|
//I can offer you the %s for %d %s of %s.
|
|
|
|
traderText->setText(boost::str(boost::format(CGI->generaltexth->allTexts[267]) % hRight->getName() % r1 % CGI->generaltexth->allTexts[160 + (r1==1)] % hLeft->getName()));
|
|
|
|
}
|
|
|
|
else if(mode == EMarketMode::RESOURCE_RESOURCE)
|
|
|
|
{
|
|
|
|
//I can offer you %d %s of %s for %d %s of %s.
|
|
|
|
traderText->setText(boost::str(boost::format(CGI->generaltexth->allTexts[157]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % r1 % CGI->generaltexth->allTexts[160 + (r1==1)] % hLeft->getName()));
|
|
|
|
}
|
|
|
|
else if(mode == EMarketMode::CREATURE_RESOURCE)
|
|
|
|
{
|
|
|
|
//I can offer you %d %s of %s for %d %s.
|
|
|
|
traderText->setText(boost::str(boost::format(CGI->generaltexth->allTexts[269]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % r1 % hLeft->getName(r1)));
|
|
|
|
}
|
|
|
|
else if(mode == EMarketMode::ARTIFACT_RESOURCE)
|
|
|
|
{
|
|
|
|
//I can offer you %d %s of %s for your %s.
|
|
|
|
traderText->setText(boost::str(boost::format(CGI->generaltexth->allTexts[268]) % r2 % CGI->generaltexth->allTexts[160 + (r2==1)] % hRight->getName() % hLeft->getName(r1)));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int gnrtxtnr = -1;
|
|
|
|
if(madeTransaction)
|
|
|
|
{
|
|
|
|
if(mode == EMarketMode::RESOURCE_PLAYER)
|
|
|
|
gnrtxtnr = 166; //Are there any other resources you'd like to give away?
|
|
|
|
else
|
|
|
|
gnrtxtnr = 162; //You have received quite a bargain. I expect to make no profit on the deal. Can I interest you in any of my other wares?
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(mode == EMarketMode::RESOURCE_PLAYER)
|
|
|
|
gnrtxtnr = 167; //If you'd like to give any of your resources to another player, click on the item you wish to give and to whom.
|
|
|
|
else
|
|
|
|
gnrtxtnr = 163; //Please inspect our fine wares. If you feel like offering a trade, click on the items you wish to trade with and for.
|
|
|
|
}
|
|
|
|
traderText->setText(CGI->generaltexth->allTexts[gnrtxtnr]);
|
|
|
|
}
|