mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
* updated project files for MSVC
* fixed a few includes paths * it's possible to enter Tavern via Brotherhood of Sword * fixes for statusbar * fixes for townlist * fixed crashes on building / clicking some buildings * bumped version number to 0.71c * bonuses from wearing more than one same artifact won't cumulate
This commit is contained in:
@@ -316,11 +316,31 @@ DLL_EXPORT void SetHeroArtifacts::applyGs( CGameState *gs )
|
||||
if(!vstd::contains(h->artifWorn,i->first) || h->artifWorn[i->first] != i->second)
|
||||
equiped.push_back(i->second);
|
||||
|
||||
BOOST_FOREACH(ui32 id, equiped)
|
||||
{
|
||||
//if hero already had equipped at least one artifact of that type, don't give any new bonuses
|
||||
if(h->getArtPos(id) >= 0)
|
||||
continue;
|
||||
|
||||
CArtifact &art = VLC->arth->artifacts[id];
|
||||
for(std::list<HeroBonus>::iterator i = art.bonuses.begin(); i != art.bonuses.end(); i++)
|
||||
{
|
||||
gained.push_back(&*i);
|
||||
h->bonuses.push_back(*i);
|
||||
}
|
||||
}
|
||||
|
||||
//update hero data
|
||||
h->artifacts = artifacts;
|
||||
h->artifWorn = artifWorn;
|
||||
|
||||
//remove bonus from unequipped artifact
|
||||
BOOST_FOREACH(ui32 id, unequiped)
|
||||
{
|
||||
//if hero still has equipped at least one artifact of that type, don't remove bonuses
|
||||
if(h->getArtPos(id) >= 0)
|
||||
continue;
|
||||
|
||||
while(1)
|
||||
{
|
||||
std::list<HeroBonus>::iterator hlp = std::find_if(h->bonuses.begin(),h->bonuses.end(),boost::bind(HeroBonus::IsFrom,_1,HeroBonus::ARTIFACT,id));
|
||||
@@ -335,16 +355,6 @@ DLL_EXPORT void SetHeroArtifacts::applyGs( CGameState *gs )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(ui32 id, equiped)
|
||||
{
|
||||
CArtifact &art = VLC->arth->artifacts[id];
|
||||
for(std::list<HeroBonus>::iterator i = art.bonuses.begin(); i != art.bonuses.end(); i++)
|
||||
{
|
||||
gained.push_back(&*i);
|
||||
h->bonuses.push_back(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT void SetHeroArtifacts::setArtAtPos(ui16 pos, int art)
|
||||
|
||||
Reference in New Issue
Block a user