IMarket.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "../CArtHandler.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
  16. {
  17. public:
  18. IMarket();
  19. ~IMarket();
  20. class CArtifactSetAltar : public CArtifactSet
  21. {
  22. public:
  23. ArtBearer::ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
  24. };
  25. virtual ObjectInstanceID getObjInstanceID() const = 0; // The market is always an object on the map
  26. virtual int getMarketEfficiency() const = 0;
  27. virtual bool allowsTrade(const EMarketMode mode) const;
  28. virtual int availableUnits(const EMarketMode mode, const int marketItemSerial) const; //-1 if unlimited
  29. virtual std::vector<TradeItemBuy> availableItemsIds(const EMarketMode mode) const;
  30. virtual std::set<EMarketMode> availableModes() const = 0;
  31. CArtifactSet * getArtifactsStorage() const;
  32. 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
  33. template <typename Handler> void serializeArtifactsAltar(Handler &h)
  34. {
  35. h & *altarArtifactsStorage;
  36. }
  37. private:
  38. std::unique_ptr<CArtifactSetAltar> altarArtifactsStorage;
  39. };
  40. VCMI_LIB_NAMESPACE_END