2023-06-02 20:47:37 +02:00
|
|
|
/*
|
|
|
|
* IMarket.h, 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-11-08 17:49:08 +02:00
|
|
|
#include "../networkPacks/TradeItem.h"
|
|
|
|
#include "../constants/Enumerations.h"
|
2023-06-02 20:47:37 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class CGObjectInstance;
|
|
|
|
|
|
|
|
class DLL_LINKAGE IMarket
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
IMarket();
|
|
|
|
virtual ~IMarket() {}
|
|
|
|
|
|
|
|
virtual int getMarketEfficiency() const = 0;
|
2023-08-19 20:43:50 +02:00
|
|
|
virtual bool allowsTrade(EMarketMode mode) const;
|
|
|
|
virtual int availableUnits(EMarketMode mode, int marketItemSerial) const; //-1 if unlimited
|
2023-11-08 17:49:08 +02:00
|
|
|
virtual std::vector<TradeItemBuy> availableItemsIds(EMarketMode mode) const;
|
2023-06-02 20:47:37 +02:00
|
|
|
|
2023-08-19 20:43:50 +02:00
|
|
|
bool getOffer(int id1, int id2, int &val1, int &val2, EMarketMode mode) const; //val1 - how many units of id1 player has to give to receive val2 units
|
|
|
|
std::vector<EMarketMode> availableModes() const;
|
2023-06-02 20:47:37 +02:00
|
|
|
|
|
|
|
static const IMarket *castFrom(const CGObjectInstance *obj, bool verbose = true);
|
|
|
|
};
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|