1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

fix #2080. No more articaft exchange between heroes in kingdom overview.

This commit is contained in:
AlexVinS
2015-02-14 20:24:18 +03:00
parent 420e5f055c
commit a5ebcd0f60
2 changed files with 4 additions and 9 deletions

View File

@@ -707,8 +707,7 @@ CIntObject* CKingdHeroList::createHeroItem(size_t index)
if (index < heroesCount) if (index < heroesCount)
{ {
auto hero = new CHeroItem(LOCPLINT->cb->getHeroBySerial(index, false), &artsCommonPart); auto hero = new CHeroItem(LOCPLINT->cb->getHeroBySerial(index, false));
artsCommonPart.participants.insert(hero->heroArts);
artSets.push_back(hero->heroArts); artSets.push_back(hero->heroArts);
return hero; return hero;
} }
@@ -723,7 +722,6 @@ void CKingdHeroList::destroyHeroItem(CIntObject *object)
if (CHeroItem * hero = dynamic_cast<CHeroItem*>(object)) if (CHeroItem * hero = dynamic_cast<CHeroItem*>(object))
{ {
artSets.erase(std::find(artSets.begin(), artSets.end(), hero->heroArts)); artSets.erase(std::find(artSets.begin(), artSets.end(), hero->heroArts));
artsCommonPart.participants.erase(hero->heroArts);
} }
delete object; delete object;
} }
@@ -862,7 +860,7 @@ public:
} }
}; };
CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart * artsCommonPart): CHeroItem::CHeroItem(const CGHeroInstance* Hero):
hero(Hero) hero(Hero)
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;
@@ -908,8 +906,7 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
}; };
heroArts = new CArtifactsOfHero(arts, backpack->arts, backpack->btnLeft, backpack->btnRight, false); heroArts = new CArtifactsOfHero(arts, backpack->arts, backpack->btnLeft, backpack->btnRight, true);
heroArts->commonInfo = artsCommonPart;
heroArts->setHero(hero); heroArts->setHero(hero);
artsTabs = new CTabbedInt(std::bind(&CHeroItem::onTabSelected, this, _1), std::bind(&CHeroItem::onTabDeselected, this, _1)); artsTabs = new CTabbedInt(std::bind(&CHeroItem::onTabSelected, this, _1), std::bind(&CHeroItem::onTabDeselected, this, _1));

View File

@@ -307,15 +307,13 @@ class CHeroItem : public CIntObject, public CWindowWithGarrison
public: public:
CArtifactsOfHero *heroArts; CArtifactsOfHero *heroArts;
CHeroItem(const CGHeroInstance* hero, CArtifactsOfHero::SCommonPart * artsCommonPart); CHeroItem(const CGHeroInstance* hero);
}; };
/// Tab with all hero-specific data /// Tab with all hero-specific data
class CKingdHeroList : public CIntObject, public CGarrisonHolder, public CWindowWithArtifacts class CKingdHeroList : public CIntObject, public CGarrisonHolder, public CWindowWithArtifacts
{ {
private: private:
CArtifactsOfHero::SCommonPart artsCommonPart;
std::vector<CHeroItem*> heroItems; std::vector<CHeroItem*> heroItems;
CListBox * heroes; CListBox * heroes;
CPicture * title; CPicture * title;