1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-09 13:14:02 +02:00

Throw exception when there are not enough two-way monoliths available.

This commit is contained in:
DjWarmonger 2014-07-04 14:46:02 +02:00
parent 05c2a4e716
commit d942858ef9

View File

@ -11,6 +11,7 @@
#include "CRmgTemplate.h" #include "CRmgTemplate.h"
#include "CRmgTemplateZone.h" #include "CRmgTemplateZone.h"
#include "CZonePlacer.h" #include "CZonePlacer.h"
#include "../mapObjects/CObjectClassesHandler.h"
void CMapGenerator::foreach_neighbour(const int3 &pos, std::function<void(int3& pos)> foo) void CMapGenerator::foreach_neighbour(const int3 &pos, std::function<void(int3& pos)> foo)
{ {
@ -429,5 +430,8 @@ int CMapGenerator::getNearestObjectDistance(const int3 &tile) const
int CMapGenerator::getNextMonlithIndex() int CMapGenerator::getNextMonlithIndex()
{ {
if (monolithIndex >= VLC->objtypeh->knownSubObjects(Obj::MONOLITH_TWO_WAY).size())
throw rmgException(boost::to_string(boost::format("There is no Monolith Two Way with index %d available!") % monolithIndex));
else
return monolithIndex++; return monolithIndex++;
} }