1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

Merge pull request #3145 from vcmi/fix-3142

#3142 - fi custom campaign selection screen
This commit is contained in:
Andrii Danylchenko 2023-11-05 11:12:58 +02:00 committed by GitHub
commit 0927d3e3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -209,7 +209,6 @@ void InfoCard::changeSelection()
return;
labelSaveDate->setText(mapInfo->date);
labelMapSize->setText(std::to_string(mapInfo->mapHeader->width) + "x" + std::to_string(mapInfo->mapHeader->height));
mapName->setText(mapInfo->getNameTranslated());
mapDescription->setText(mapInfo->getDescriptionTranslated());
@ -220,8 +219,11 @@ void InfoCard::changeSelection()
if(SEL->screenType == ESelectionScreen::campaignList)
return;
iconsMapSizes->setFrame(mapInfo->getMapSizeIconId());
const CMapHeader * header = mapInfo->mapHeader.get();
labelMapSize->setText(std::to_string(header->width) + "x" + std::to_string(header->height));
iconsMapSizes->setFrame(mapInfo->getMapSizeIconId());
iconsVictoryCondition->setFrame(header->victoryIconIndex);
labelVictoryConditionText->setText(header->victoryMessage.toString());
iconsLossCondition->setFrame(header->defeatIconIndex);

View File

@ -1533,7 +1533,7 @@ void CGHeroInstance::afterAddToMap(CMap * map)
{
auto existingHero = std::find_if(map->objects.begin(), map->objects.end(), [&](const CGObjectInstance * o) ->bool
{
return (o->ID == Obj::HERO || o->ID == Obj::PRISON) && o->subID == subID && o != this;
return o && (o->ID == Obj::HERO || o->ID == Obj::PRISON) && o->subID == subID && o != this;
});
if(existingHero != map->objects.end())