diff --git a/mapeditor/mapcontroller.cpp b/mapeditor/mapcontroller.cpp index b1b86212a..0007da3b1 100644 --- a/mapeditor/mapcontroller.cpp +++ b/mapeditor/mapcontroller.cpp @@ -105,7 +105,9 @@ void MapController::repairMap() } //fix owners for objects - for(auto obj : _map->objects) + auto allImpactedObjects(_map->objects); + allImpactedObjects.insert(allImpactedObjects.end(), _map->predefinedHeroes.begin(), _map->predefinedHeroes.end()); + for(auto obj : allImpactedObjects) { //setup proper names (hero name will be fixed later if(obj->ID != Obj::HERO && obj->ID != Obj::PRISON && (obj->typeName.empty() || obj->subTypeName.empty())) @@ -154,12 +156,16 @@ void MapController::repairMap() if(nih->spellbookContainsSpell(SpellID::PRESET)) { nih->removeSpellFromSpellbook(SpellID::PRESET); - } - else - { for(auto spellID : type->spells) nih->addSpellToSpellbook(spellID); } + if(nih->spellbookContainsSpell(SpellID::SPELLBOOK_PRESET)) + { + nih->removeSpellFromSpellbook(SpellID::SPELLBOOK_PRESET); + if(!nih->getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook) + nih->putArtifact(ArtifactPosition::SPELLBOOK, ArtifactUtils::createNewArtifactInstance(ArtifactID::SPELLBOOK)); + } + //fix portrait if(nih->portrait < 0 || nih->portrait == 255) nih->portrait = type->imageIndex; diff --git a/mapeditor/windownewmap.cpp b/mapeditor/windownewmap.cpp index 6fdd404b8..68e3b70a7 100644 --- a/mapeditor/windownewmap.cpp +++ b/mapeditor/windownewmap.cpp @@ -90,6 +90,11 @@ void WindowNewMap::loadUserSettings() { ui->heightTxt->setText(height.toString()); } + for(auto & sz : mapSizes) + { + if(sz.second.first == width.toInt() && sz.second.second == height.toInt()) + ui->sizeCombo->setCurrentIndex(sz.first); + } auto twoLevel = s.value(newMapTwoLevel); if (twoLevel.isValid()) {