1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00
This commit is contained in:
Michał W. Urbańczyk 2010-10-31 19:56:37 +00:00
parent dc5370ad6e
commit a346708398
4 changed files with 29 additions and 9 deletions

View File

@ -986,7 +986,13 @@ bool CShootingAnim::init()
spi.step = 0;
spi.frameNum = 0;
spi.spin = CGI->creh->idToProjectileSpin.find(spi.creID)->second;
if(vstd::contains(CGI->creh->idToProjectileSpin, spi.creID))
spi.spin = CGI->creh->idToProjectileSpin[spi.creID];
else
{
tlog2 << "Warning - no projectile spin for spi.creID " << spi.creID << std::endl;
spi.spin = false;
}
Point xycoord = CBattleHex::getXYUnitAnim(shooter->position, true, shooter, owner);
Point destcoord;

View File

@ -485,10 +485,13 @@ CCastleInterface::~CCastleInterface()
void CCastleInterface::close()
{
if(town->visitingHero)
adventureInt->select(town->visitingHero);
else
adventureInt->select(town);
if(town->tempOwner == LOCPLINT->playerID) //we may have opened window for an allied town
{
if(town->visitingHero)
adventureInt->select(town->visitingHero);
else
adventureInt->select(town);
}
LOCPLINT->castleInt = NULL;
GH.popIntTotally(this);
CGI->musich->stopMusic(5000);

View File

@ -3079,6 +3079,14 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
else
printAtMiddle(market->o->getHoverText(), 300, 27, FONT_BIG, tytulowy, *bg); //title
}
else if(mode == RESOURCE_ARTIFACT || mode == ARTIFACT_RESOURCE)
{
const std::string &title = market->o->ID == TOWNI_TYPE
? CGI->buildh->buildings[market->o->subID][17]->Name()
: market->o->getHoverText();
printAtMiddle(title, 300, 27, FONT_BIG, tytulowy, *bg); //title
}
else
{
printAtMiddle(CGI->generaltexth->allTexts[158],300,27,FONT_BIG,tytulowy,*bg); //marketplace
@ -3261,7 +3269,7 @@ void CMarketplaceWindow::selectionChanged(bool side)
bool CMarketplaceWindow::printButtonFor(EMarketMode M) const
{
return market->allowsTrade(M) && M != mode && (hero || mode != CREATURE_RESOURCE && mode != RESOURCE_ARTIFACT && mode != ARTIFACT_RESOURCE);
return market->allowsTrade(M) && M != mode && (hero || M != CREATURE_RESOURCE && M != RESOURCE_ARTIFACT && M != ARTIFACT_RESOURCE);
}
void CMarketplaceWindow::garrisonChanged()
@ -4927,6 +4935,8 @@ void CArtifactsOfHero::setHero(const CGHeroInstance * hero)
void CArtifactsOfHero::dispose()
{
delNull(curHero);
unmarkSlots(false);
CGI->curh->dragAndDropCursor(NULL);
}
void CArtifactsOfHero::scrollBackpack(int dir)
@ -5010,7 +5020,7 @@ void CArtifactsOfHero::markPossibleSlots (const CArtifact* art)
/**
* Unamarks all slots.
*/
void CArtifactsOfHero::unmarkSlots ()
void CArtifactsOfHero::unmarkSlots(bool withRedraw /*= true*/)
{
for (std::set<CArtifactsOfHero *>::iterator it = commonInfo->participants.begin();
it != commonInfo->participants.end();
@ -5022,7 +5032,8 @@ void CArtifactsOfHero::unmarkSlots ()
}
}
safeRedraw();
if(withRedraw)
safeRedraw();
}
/**

View File

@ -947,7 +947,7 @@ public:
void safeRedraw();
void markPossibleSlots (const CArtifact* art);
void unmarkSlots ();
void unmarkSlots(bool withRedraw = true);
void setSlotData (CArtPlace* artPlace, int slotID);
void eraseSlotData (CArtPlace* artPlace, int slotID);