mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
Merge pull request #4825 from godric3/map-editor-fix-copying-town
Map editor: fix duplicated spells in copy-pasted town
This commit is contained in:
commit
2fa0021c28
@ -172,10 +172,12 @@ void Initializer::initialize(CGTownInstance * o)
|
|||||||
if(lvl > 2) o->addBuilding(BuildingID::CASTLE);
|
if(lvl > 2) o->addBuilding(BuildingID::CASTLE);
|
||||||
if(lvl > 3) o->addBuilding(BuildingID::CAPITOL);
|
if(lvl > 3) o->addBuilding(BuildingID::CAPITOL);
|
||||||
|
|
||||||
for(auto const & spell : VLC->spellh->objects) //add all regular spells to town
|
if(o->possibleSpells.empty())
|
||||||
{
|
{
|
||||||
if(!spell->isSpecial() && !spell->isCreatureAbility())
|
for(auto const & spellId : VLC->spellh->getDefaultAllowed()) //add all regular spells to town
|
||||||
o->possibleSpells.push_back(spell->id);
|
{
|
||||||
|
o->possibleSpells.push_back(spellId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,7 +381,7 @@ 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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user