DwellingInstanceConstructor.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * DwellingInstanceConstructor.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 "CDefaultObjectTypeHandler.h"
  12. #include "../json/JsonNode.h"
  13. #include "../mapObjects/CGDwelling.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class CGDwelling;
  16. class DwellingInstanceConstructor : public CDefaultObjectTypeHandler<CGDwelling>
  17. {
  18. std::vector<std::vector<const CCreature *>> availableCreatures;
  19. JsonNode guards;
  20. bool bannedForRandomDwelling = false;
  21. protected:
  22. bool objectFilter(const CGObjectInstance * obj, std::shared_ptr<const ObjectTemplate> tmpl) const override;
  23. void initTypeData(const JsonNode & input) override;
  24. public:
  25. bool hasNameTextID() const override;
  26. void initializeObject(CGDwelling * object) const override;
  27. void randomizeObject(CGDwelling * object, vstd::RNG & rng) const override;
  28. bool isBannedForRandomDwelling() const;
  29. bool producesCreature(const CCreature * crea) const;
  30. std::vector<const CCreature *> getProducedCreatures() const;
  31. };
  32. VCMI_LIB_NAMESPACE_END