IMarket.h 964 B

1234567891011121314151617181920212223242526272829303132333435
  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 "../GameConstants.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CGObjectInstance;
  14. class DLL_LINKAGE IMarket
  15. {
  16. public:
  17. IMarket();
  18. virtual ~IMarket() {}
  19. virtual int getMarketEfficiency() const = 0;
  20. virtual bool allowsTrade(EMarketMode mode) const;
  21. virtual int availableUnits(EMarketMode mode, int marketItemSerial) const; //-1 if unlimited
  22. virtual std::vector<int> availableItemsIds(EMarketMode mode) const;
  23. 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
  24. std::vector<EMarketMode> availableModes() const;
  25. static const IMarket *castFrom(const CGObjectInstance *obj, bool verbose = true);
  26. };
  27. VCMI_LIB_NAMESPACE_END