mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +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 > 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())
|
||||
o->possibleSpells.push_back(spell->id);
|
||||
for(auto const & spellId : VLC->spellh->getDefaultAllowed()) //add all regular spells to town
|
||||
{
|
||||
o->possibleSpells.push_back(spellId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,6 +369,7 @@ void MapController::pasteFromClipboard(int level)
|
||||
if (!canPlaceObject(level, obj, errorMsg))
|
||||
{
|
||||
errors.push_back(std::move(errorMsg));
|
||||
continue;
|
||||
}
|
||||
auto newPos = objUniquePtr->pos + shift;
|
||||
if(_map->isInTheMap(newPos))
|
||||
@ -380,8 +381,8 @@ void MapController::pasteFromClipboard(int level)
|
||||
_scenes[level]->selectionObjectsView.selectObject(obj);
|
||||
_mapHandler->invalidate(obj);
|
||||
}
|
||||
|
||||
QMessageBox::warning(main, QObject::tr("Can't place object"), errors.join('\n'));
|
||||
if(!errors.isEmpty())
|
||||
QMessageBox::warning(main, QObject::tr("Can't place object"), errors.join('\n'));
|
||||
|
||||
_scenes[level]->objectsView.draw();
|
||||
_scenes[level]->passabilityView.update();
|
||||
|
Loading…
x
Reference in New Issue
Block a user