1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fix: RMG issues: 1) hota 2) assertions

This commit is contained in:
Dmitry Orlov
2020-10-25 01:03:32 +03:00
parent c0a5d1ccf0
commit 3cb0dfb143
2 changed files with 26 additions and 9 deletions

View File

@@ -610,15 +610,16 @@ void CMapGenerator::createConnections2()
std::vector<int3> commonTiles;
//required for set_intersection
boost::sort(tilesA);
boost::sort(tilesB);
boost::set_intersection(tilesA, tilesB, std::back_inserter(commonTiles), [](const int3 &lhs, const int3 &rhs) -> bool
auto lambda = [](const int3 & lhs, const int3 & rhs) -> bool
{
//ignore z coordinate
return lhs.x < rhs.x || lhs.y < rhs.y;
});
//https://stackoverflow.com/questions/45966807/c-invalid-comparator-assert
return std::tie(lhs.x, lhs.y) < std::tie(rhs.x, rhs.y); //ignore z coordinate
};
//required for set_intersection
boost::sort(tilesA, lambda);
boost::sort(tilesB, lambda);
boost::set_intersection(tilesA, tilesB, std::back_inserter(commonTiles), lambda);
vstd::erase_if(commonTiles, [](const int3 &tile) -> bool
{