1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

1.Support for Keymaster Tent & Borderguard, Eye & Hut of The Magi, Stables.

2.Partially done support for creature banks. ToDo: load config file, start battle with surrounding enemies
3.Attempt to increase hero exp capacity. You may ignore it at the moment.
4.Fixed negative countdown in timeHandler.
This commit is contained in:
DjWarmonger
2009-08-11 07:50:29 +00:00
parent 575840f641
commit 4653396d76
19 changed files with 647 additions and 29 deletions

View File

@@ -1431,6 +1431,35 @@ void CGameHandler::giveResource(int player, int which, int val)
sr.val = gs->players.find(player)->second.resources[which]+val;
sendAndApply(&sr);
}
void CGameHandler::giveCreatures (int objid, const CGHeroInstance * h, CCreatureSet *creatures)
{
CCreatureSet heroArmy = h->army;
while(creatures)
{
int slot = heroArmy.getSlotFor(creatures->slots.begin()->second.first);
if(slot < 0)
break;
heroArmy.slots[slot].first = creatures->slots.begin()->second.first;
heroArmy.slots[slot].second += creatures->slots.begin()->second.second;
creatures->slots.erase(creatures->slots.begin());
}
if(!creatures) //all creatures can be moved to hero army - do that
{
SetGarrisons sg;
sg.garrs[h->id] = heroArmy;
sendAndApply(&sg);
}
else //show garrison window and let player pick creatures
{
SetGarrisons sg;
sg.garrs[objid] = *creatures;
sendAndApply(&sg);
showGarrisonDialog(objid, h->id, 0);
return;
}
}
void CGameHandler::showCompInfo(ShowInInfobox * comp)
{
sendToAllClients(comp);