Michał W. Urbańczyk 15 年之前
父節點
當前提交
a346708398
共有 4 個文件被更改,包括 29 次插入9 次删除
  1. 7 1
      client/CBattleInterface.cpp
  2. 7 4
      client/CCastleInterface.cpp
  3. 14 3
      client/GUIClasses.cpp
  4. 1 1
      client/GUIClasses.h

+ 7 - 1
client/CBattleInterface.cpp

@@ -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;

+ 7 - 4
client/CCastleInterface.cpp

@@ -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);

+ 14 - 3
client/GUIClasses.cpp

@@ -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();
 }
 
 /**

+ 1 - 1
client/GUIClasses.h

@@ -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);