mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +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:
		| @@ -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,7 +381,7 @@ void MapController::pasteFromClipboard(int level) | ||||
| 		_scenes[level]->selectionObjectsView.selectObject(obj); | ||||
| 		_mapHandler->invalidate(obj); | ||||
| 	} | ||||
|  | ||||
| 	if(!errors.isEmpty()) | ||||
| 		QMessageBox::warning(main, QObject::tr("Can't place object"), errors.join('\n')); | ||||
| 	 | ||||
| 	_scenes[level]->objectsView.draw(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user