mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
parent
2f4aabca52
commit
236345e61d
@ -1009,7 +1009,7 @@ InfoAboutTown::~InfoAboutTown()
|
||||
void InfoAboutTown::initFromTown( const CGTownInstance *t, bool detailed )
|
||||
{
|
||||
obj = t;
|
||||
army = ArmyDescriptor(t, detailed);
|
||||
army = ArmyDescriptor(t->getUpperArmy(), detailed);
|
||||
built = t->builded;
|
||||
fortLevel = t->fortLevel();
|
||||
name = t->name;
|
||||
|
@ -3484,7 +3484,7 @@ static bool immobile(const CStack *s)
|
||||
void CBattleInterface::bTacticNextStack()
|
||||
{
|
||||
TStacks stacksOfMine = curInt->cb->battleGetStacks(IBattleCallback::ONLY_MINE);
|
||||
stacksOfMine.erase(std::remove_if(stacksOfMine.begin(), stacksOfMine.end(), &immobile));
|
||||
stacksOfMine.erase(std::remove_if(stacksOfMine.begin(), stacksOfMine.end(), &immobile), stacksOfMine.end());
|
||||
TStacks::iterator it = vstd::find(stacksOfMine, activeStack);
|
||||
if(it != stacksOfMine.end() && ++it != stacksOfMine.end())
|
||||
stackActivated(*it);
|
||||
|
@ -385,7 +385,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, int listPos)
|
||||
winMode = 1;
|
||||
|
||||
//garrison
|
||||
garr = new CGarrisonInt(pos.x+305,pos.y+387,4,Point(0,96),townInt,Point(62,374),town,town->visitingHero);
|
||||
garr = new CGarrisonInt(pos.x+305,pos.y+387,4,Point(0,96),townInt,Point(62,374),town->getUpperArmy(),town->visitingHero);
|
||||
|
||||
townlist = new CTownList(3,pos.x+744,pos.y+414,"IAM014.DEF","IAM015.DEF");//744,526);
|
||||
exit = new AdventureMapButton
|
||||
|
@ -176,7 +176,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals
|
||||
AdventureMapButton * split = NULL;
|
||||
{
|
||||
BLOCK_CAPTURING;
|
||||
split = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::bind(&CGarrisonInt::splitClick,garr), 604, 527, "hsbtns9.def", false, NULL, false); //deleted by garrison destructor
|
||||
split = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::bind(&CGarrisonInt::splitClick,garr), pos.x + 539, pos.y + 519, "hsbtns9.def", false, NULL, false); //deleted by garrison destructor
|
||||
boost::algorithm::replace_first(split->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]);
|
||||
}
|
||||
//delete garr;
|
||||
|
@ -123,7 +123,7 @@ CPlayerInterface::~CPlayerInterface()
|
||||
{
|
||||
howManyPeople--;
|
||||
//delete pim;
|
||||
delNull(pim);
|
||||
//delNull(pim);
|
||||
delete showingDialog;
|
||||
delete mainFPSmng;
|
||||
if(adventureInt)
|
||||
@ -481,19 +481,13 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
||||
wanderingHeroes.push_back(town->visitingHero);
|
||||
}
|
||||
|
||||
//adventureInt->heroList.updateHList();
|
||||
|
||||
CCastleInterface *c = castleInt;
|
||||
if(c)
|
||||
if(CCastleInterface *c = castleInt)
|
||||
{
|
||||
c->garr->highlighted = NULL;
|
||||
c->hslotup.hero = town->garrisonHero;
|
||||
c->hslotdown.hero = town->visitingHero;
|
||||
const CArmedInstance *upperArmy = town;
|
||||
if(town->garrisonHero)
|
||||
upperArmy = town->garrisonHero;
|
||||
|
||||
c->garr->setArmy(upperArmy, 0);
|
||||
c->garr->setArmy(town->getUpperArmy(), 0);
|
||||
c->garr->setArmy(town->visitingHero, 1);
|
||||
c->garr->recreateSlots();
|
||||
}
|
||||
|
@ -2399,6 +2399,13 @@ CBonusSystemNode * CGTownInstance::whatShouldBeAttached()
|
||||
return &townAndVis;
|
||||
}
|
||||
|
||||
const CArmedInstance * CGTownInstance::getUpperArmy() const
|
||||
{
|
||||
if(garrisonHero)
|
||||
return garrisonHero;
|
||||
return this;
|
||||
}
|
||||
|
||||
void CGVisitableOPH::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
if(visitors.find(h->id)==visitors.end())
|
||||
|
@ -612,6 +612,7 @@ public:
|
||||
bool addBonusIfBuilt(int building, int type, int val, int subtype = -1); //convienence version of above
|
||||
void setVisitingHero(CGHeroInstance *h);
|
||||
void setGarrisonedHero(CGHeroInstance *h);
|
||||
const CArmedInstance *getUpperArmy() const; //garrisoned hero if present or the town itself
|
||||
// void getParents(TCNodes &out, const CBonusSystemNode *root = NULL) const;
|
||||
// void getBonuses(BonusList &out, const CSelector &selector, const CBonusSystemNode *root = NULL) const;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2306,7 +2306,7 @@ bool CGameHandler::recruitCreatures( si32 objid, ui32 crid, ui32 cram, si32 from
|
||||
//TODO: test for owning
|
||||
|
||||
if(dw->ID == TOWNI_TYPE)
|
||||
dst = dw;
|
||||
dst = (static_cast<const CGTownInstance *>(dw))->getUpperArmy();
|
||||
else if(dw->ID == 17 || dw->ID == 20 || dw->ID == 78) //advmap dwelling
|
||||
dst = getHero(gs->getPlayer(dw->tempOwner)->currentSelection); //TODO: check if current hero is really visiting dwelling
|
||||
else if(dw->ID == 106)
|
||||
|
Loading…
Reference in New Issue
Block a user