mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-31 22:59:54 +02:00
Don't paste objects that cannot be placed, show warning only if error occurred
This commit is contained in:
parent
1246333350
commit
152962354d
@ -369,6 +369,7 @@ void MapController::pasteFromClipboard(int level)
|
|||||||
if (!canPlaceObject(level, obj, errorMsg))
|
if (!canPlaceObject(level, obj, errorMsg))
|
||||||
{
|
{
|
||||||
errors.push_back(std::move(errorMsg));
|
errors.push_back(std::move(errorMsg));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
auto newPos = objUniquePtr->pos + shift;
|
auto newPos = objUniquePtr->pos + shift;
|
||||||
if(_map->isInTheMap(newPos))
|
if(_map->isInTheMap(newPos))
|
||||||
@ -380,8 +381,8 @@ void MapController::pasteFromClipboard(int level)
|
|||||||
_scenes[level]->selectionObjectsView.selectObject(obj);
|
_scenes[level]->selectionObjectsView.selectObject(obj);
|
||||||
_mapHandler->invalidate(obj);
|
_mapHandler->invalidate(obj);
|
||||||
}
|
}
|
||||||
|
if(!errors.isEmpty())
|
||||||
QMessageBox::warning(main, QObject::tr("Can't place object"), errors.join('\n'));
|
QMessageBox::warning(main, QObject::tr("Can't place object"), errors.join('\n'));
|
||||||
|
|
||||||
_scenes[level]->objectsView.draw();
|
_scenes[level]->objectsView.draw();
|
||||||
_scenes[level]->passabilityView.update();
|
_scenes[level]->passabilityView.update();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user