IMarket.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * IMarket.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../networkPacks/TradeItem.h"
  12. #include "../constants/Enumerations.h"
  13. #include "../entities/artifact/CArtifactSet.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
  16. {
  17. public:
  18. explicit IMarket(IGameInfoCallback *cb);
  19. ~IMarket();
  20. class CArtifactSetAltar : public CArtifactSet
  21. {
  22. IGameInfoCallback *cb;
  23. public:
  24. CArtifactSetAltar(IGameInfoCallback *cb)
  25. : CArtifactSet(cb)
  26. , cb(cb)
  27. {}
  28. IGameInfoCallback * getCallback() const override {return cb;};
  29. ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
  30. };
  31. virtual ObjectInstanceID getObjInstanceID() const = 0; // The market is always an object on the map
  32. virtual int getMarketEfficiency() const = 0;
  33. virtual bool allowsTrade(const EMarketMode mode) const;
  34. virtual int availableUnits(const EMarketMode mode, const int marketItemSerial) const; //-1 if unlimited
  35. virtual std::vector<TradeItemBuy> availableItemsIds(const EMarketMode mode) const;
  36. virtual std::set<EMarketMode> availableModes() const = 0;
  37. CArtifactSet * getArtifactsStorage() const;
  38. 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
  39. private:
  40. std::unique_ptr<CArtifactSetAltar> altarArtifactsStorage;
  41. };
  42. VCMI_LIB_NAMESPACE_END