1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Couple fixes

This commit is contained in:
nordsoft 2023-09-30 04:33:41 +02:00
parent 3018178956
commit cb02e221f3
2 changed files with 15 additions and 4 deletions

View File

@ -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;

View File

@ -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())
{