/* * ObstaclePlacer.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 #include "Zone.h" VCMI_LIB_NAMESPACE_BEGIN class CMap; class CMapEditManager; class RiverPlacer; class ObjectManager; class DLL_LINKAGE ObstacleProxy { public: ObstacleProxy() = default; virtual ~ObstacleProxy() = default; rmg::Area blockedArea; void collectPossibleObstacles(TerrainId terrain); void placeObstacles(CMap * map, CRandomGenerator & rand); virtual std::pair verifyCoverage(const int3 & t) const; virtual void placeObject(rmg::Object & object, std::set & instances); virtual void postProcess(const rmg::Object & object); virtual bool isProhibited(const rmg::Area & objArea) const; virtual void finalInsertion(CMapEditManager * manager, std::set & instances); protected: int getWeightedObjects(const int3 & tile, const CMap * map, CRandomGenerator & rand, std::list & allObjects, std::vector> & weightedObjects); typedef std::vector> ObstacleVector; std::map obstaclesBySize; typedef std::pair ObstaclePair; std::vector possibleObstacles; }; class ObstaclePlacer: public Modificator, public ObstacleProxy { public: MODIFICATOR(ObstaclePlacer); void process() override; void init() override; std::pair verifyCoverage(const int3 & t) const override; void placeObject(rmg::Object & object, std::set & instances) override; void postProcess(const rmg::Object & object) override; bool isProhibited(const rmg::Area & objArea) const override; void finalInsertion(CMapEditManager * manager, std::set & instances) override; private: rmg::Area prohibitedArea; RiverPlacer * riverManager; ObjectManager * manager; }; VCMI_LIB_NAMESPACE_END