mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
iterate objects only for grail special case
This commit is contained in:
@@ -537,6 +537,8 @@ void MapController::commitObjectCreate(int level)
|
||||
}
|
||||
|
||||
bool MapController::canPlaceObject(int level, CGObjectInstance * newObj, QString & error) const
|
||||
{
|
||||
if(newObj->ID == Obj::GRAIL) //special case for grail
|
||||
{
|
||||
//find all objects of such type
|
||||
int objCounter = 0;
|
||||
@@ -548,11 +550,12 @@ bool MapController::canPlaceObject(int level, CGObjectInstance * newObj, QString
|
||||
}
|
||||
}
|
||||
|
||||
if(newObj->ID == Obj::GRAIL && objCounter >= 1) //special case for grail
|
||||
if(objCounter >= 1)
|
||||
{
|
||||
error = QObject::tr("There can only be one grail object on the map.");
|
||||
return false; //maplimit reached
|
||||
}
|
||||
}
|
||||
|
||||
if(defaultPlayer == PlayerColor::NEUTRAL && (newObj->ID == Obj::HERO || newObj->ID == Obj::RANDOM_HERO))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user