1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-22 00:27:58 +02:00

* hero placed in the town starts as visiting hero, not garrisoned

* if hero doesn't have a spell book, he can buy one in a mage guild
* improvements in closing
* fixed crash on picking artifact
* added event message when picking artifact
* fixed problems with disappearing pikemen
* InfoWindow will be properly centered
* hero portraits again visible in PreGame
* fixed problems with handling Pandora's Box
* support for Campfires
* minor changes
This commit is contained in:
Michał W. Urbańczyk
2008-08-25 10:25:16 +00:00
parent 0607ec70cf
commit 6613955463
34 changed files with 271 additions and 165 deletions

View File

@@ -128,28 +128,20 @@ void CScriptCallback::stopHeroVisitCastle(int obj, int heroID)
}
void CScriptCallback::giveHeroArtifact(int artid, int hid, int position) //pos==-1 - first free slot in backpack
{
CGHeroInstance* h = gh->gs->map->getHero(hid,0);
const CGHeroInstance* h = getHero(hid);
SetHeroArtifacts sha;
sha.hid = hid;
sha.artifacts = h->artifacts;
sha.artifWorn = h->artifWorn;
if(position<0)
{
for(unsigned i=0;i<h->artifacts.size();i++)
{
if(!h->artifacts[i])
{
h->artifacts[i] = artid;
return;
}
}
h->artifacts.push_back(artid);
return;
}
sha.artifacts.push_back(artid);
else
{
if(h->artifWorn[position]) //slot is occupied
{
giveHeroArtifact(h->artifWorn[position],hid,-1);
}
h->artifWorn[position] = artid;
}
if(!vstd::contains(sha.artifWorn,ui16(position)))
sha.artifWorn[position] = artid;
else
sha.artifacts.push_back(artid);
gh->sendAndApply(&sha);
}
void CScriptCallback::startBattle(const CCreatureSet * army1, const CCreatureSet * army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2) //use hero=NULL for no hero