mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
* battle funcs added to ICallback
* initing visiting heroes * merging stacks in town screen * available creature amount handled
This commit is contained in:
@@ -56,12 +56,18 @@ void CGarrisonSlot::hover (bool on)
|
||||
temp = CGI->townh->tcommands[2];
|
||||
boost::algorithm::replace_first(temp,"%s",creature->nameSing);
|
||||
}
|
||||
else
|
||||
else if (owner->highlighted->creature)
|
||||
{
|
||||
temp = CGI->townh->tcommands[7];
|
||||
boost::algorithm::replace_first(temp,"%s",owner->highlighted->creature->nameSing);
|
||||
boost::algorithm::replace_first(temp,"%s",creature->nameSing);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Warning - shouldn't be - highlighted void slot "<<owner->highlighted<<std::endl;
|
||||
std::cout << "Highlighted set to NULL"<<std::endl;
|
||||
owner->highlighted = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -109,10 +115,26 @@ void CGarrisonSlot::clickLeft(tribool down)
|
||||
{
|
||||
if(owner->highlighted)
|
||||
{
|
||||
LOCPLINT->cb->swapCreatures(
|
||||
(!upg)?(owner->oup):(owner->odown),
|
||||
(!owner->highlighted->upg)?(owner->oup):(owner->odown),
|
||||
ID,owner->highlighted->ID);
|
||||
if(owner->highlighted == this)
|
||||
{
|
||||
//TODO: view creature info
|
||||
owner->highlighted = NULL;
|
||||
show();
|
||||
}
|
||||
else if(creature != owner->highlighted->creature) //swap
|
||||
{
|
||||
LOCPLINT->cb->swapCreatures(
|
||||
(!upg)?(owner->oup):(owner->odown),
|
||||
(!owner->highlighted->upg)?(owner->oup):(owner->odown),
|
||||
ID,owner->highlighted->ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOCPLINT->cb->mergeStacks(
|
||||
(!owner->highlighted->upg)?(owner->oup):(owner->odown),
|
||||
(!upg)?(owner->oup):(owner->odown),
|
||||
owner->highlighted->ID,ID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1861,6 +1883,11 @@ void CPlayerInterface::garrisonChanged(const CGObjectInstance * obj)
|
||||
SDL_FreeSurface(heroWins[hh->subID]);
|
||||
heroWins[hh->subID] = infoWin(hh);
|
||||
}
|
||||
if(castleInt == curint) //opened town window - redraw town garrsion slots (change is within hero garr)
|
||||
{
|
||||
castleInt->garr->highlighted = NULL;
|
||||
castleInt->garr->recreateSlots();
|
||||
}
|
||||
}
|
||||
else if (obj->ID == 98) //town
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user