2023-05-19 20:30:15 +02:00
|
|
|
/*
|
|
|
|
* MapProxy.cpp, 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "MapProxy.h"
|
|
|
|
#include "../../TerrainHandler.h"
|
2024-05-17 00:05:51 +02:00
|
|
|
#include "../../VCMI_Lib.h"
|
2023-05-19 20:30:15 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
MapProxy::MapProxy(RmgMap & map):
|
2023-12-22 23:22:33 +02:00
|
|
|
map(map)
|
2023-05-19 20:30:15 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void MapProxy::insertObject(CGObjectInstance * obj)
|
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
|
|
|
map.getEditManager()->insertObject(obj);
|
2023-05-19 20:30:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MapProxy::insertObjects(std::set<CGObjectInstance*>& objects)
|
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
|
|
|
map.getEditManager()->insertObjects(objects);
|
2023-05-19 20:30:15 +02:00
|
|
|
}
|
|
|
|
|
2023-08-11 20:13:25 +02:00
|
|
|
void MapProxy::removeObject(CGObjectInstance * obj)
|
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
|
|
|
map.getEditManager()->removeObject(obj);
|
2023-08-11 20:13:25 +02:00
|
|
|
}
|
|
|
|
|
2024-06-01 17:28:17 +02:00
|
|
|
void MapProxy::drawTerrain(vstd::RNG & generator, std::vector<int3> & tiles, TerrainId terrain)
|
2023-05-19 20:30:15 +02:00
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
2023-05-19 20:30:15 +02:00
|
|
|
map.getEditManager()->getTerrainSelection().setSelection(tiles);
|
2023-12-22 17:41:30 +02:00
|
|
|
map.getEditManager()->drawTerrain(terrain, map.getDecorationsPercentage(), &generator);
|
2023-05-19 20:30:15 +02:00
|
|
|
}
|
|
|
|
|
2024-06-01 17:28:17 +02:00
|
|
|
void MapProxy::drawRivers(vstd::RNG & generator, std::vector<int3> & tiles, TerrainId terrain)
|
2023-05-19 20:30:15 +02:00
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
2023-05-19 20:30:15 +02:00
|
|
|
map.getEditManager()->getTerrainSelection().setSelection(tiles);
|
|
|
|
map.getEditManager()->drawRiver(VLC->terrainTypeHandler->getById(terrain)->river, &generator);
|
|
|
|
}
|
|
|
|
|
2024-06-01 17:28:17 +02:00
|
|
|
void MapProxy::drawRoads(vstd::RNG & generator, std::vector<int3> & tiles, RoadId roadType)
|
2023-05-19 20:30:15 +02:00
|
|
|
{
|
2023-12-22 23:22:33 +02:00
|
|
|
Lock lock(mx);
|
|
|
|
map.getEditManager()->getTerrainSelection().setSelection(tiles);
|
2023-05-19 20:30:15 +02:00
|
|
|
map.getEditManager()->drawRoad(roadType, &generator);
|
|
|
|
}
|
|
|
|
|
2023-12-22 17:41:30 +02:00
|
|
|
VCMI_LIB_NAMESPACE_END
|