Selaa lähdekoodia

More fixes:
- logical expressions should compile without cpp include
- fixed #1608 and #1610

Ivan Savenko 12 vuotta sitten
vanhempi
sitoutus
b1e638d1af
4 muutettua tiedostoa jossa 14 lisäystä ja 14 poistoa
  1. 0 1
      client/CCastleInterface.cpp
  2. 3 7
      client/CPlayerInterface.cpp
  3. 10 5
      lib/CGameState.cpp
  4. 1 1
      lib/LogicalExpression.h

+ 0 - 1
client/CCastleInterface.cpp

@@ -24,7 +24,6 @@
 #include "../lib/GameConstants.h"
 #include "gui/CGuiHandler.h"
 #include "gui/CIntObjectClasses.h"
-#include "../lib/LogicalExpression.cpp"
 
 using namespace boost::assign;
 

+ 3 - 7
client/CPlayerInterface.cpp

@@ -1109,6 +1109,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
 void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &pos)
 {
 	EVENT_HANDLER_CALLED_BY_CLIENT;
+	//FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas
 	for(auto & po : pos)
 		adventureInt->minimap.showTile(po);
 	if(!pos.empty())
@@ -1571,14 +1572,9 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
 	adventureInt->centerOn (pos);
 	if(focusTime)
 	{
-		bool activeAdv = (GH.topInt() == adventureInt  &&  adventureInt->isActive());
-		if(activeAdv)
-			adventureInt->deactivate();
-
+		GH.totalRedraw();
+		CSDL_Ext::update(screen);
 		SDL_Delay(focusTime);
-
-		if(activeAdv)
-			adventureInt->activate();
 	}
 }
 

+ 10 - 5
lib/CGameState.cpp

@@ -2287,12 +2287,17 @@ struct statsHLP
 
 void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 {
+	auto playerInactive = [&](PlayerColor color)
+	{
+		return color == PlayerColor::NEUTRAL || players.at(color).status != EPlayerStatus::INGAME;
+	};
+
 #define FILL_FIELD(FIELD, VAL_GETTER) \
 	{ \
 		std::vector< std::pair< PlayerColor, si64 > > stats; \
 		for(auto g = players.begin(); g != players.end(); ++g) \
 		{ \
-			if(g->second.color == PlayerColor::NEUTRAL) \
+			if(playerInactive(g->second.color)) \
 				continue; \
 			std::pair< PlayerColor, si64 > stat; \
 			stat.first = g->second.color; \
@@ -2304,7 +2309,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 
 	for(auto & elem : players)
 	{
-		if(elem.second.color != PlayerColor::NEUTRAL)
+		if(!playerInactive(elem.second.color))
 			tgi.playerColors.push_back(elem.second.color);
 	}
 
@@ -2317,7 +2322,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 		//best hero's portrait
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == PlayerColor::NEUTRAL)
+			if(playerInactive(g->second.color))
 				continue;
 			const CGHeroInstance * best = statsHLP::findBestHero(this, g->second.color);
 			InfoAboutHero iah;
@@ -2362,7 +2367,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 	{
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == PlayerColor::NEUTRAL) //do nothing for neutral player
+			if(playerInactive(g->second.color)) //do nothing for neutral player
 				continue;
 			if(g->second.human)
 			{
@@ -2380,7 +2385,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
 		//best creatures belonging to player (highest AI value)
 		for(auto g = players.cbegin(); g != players.cend(); ++g)
 		{
-			if(g->second.color == PlayerColor::NEUTRAL) //do nothing for neutral player
+			if(playerInactive(g->second.color)) //do nothing for neutral player
 				continue;
 			int bestCre = -1; //best creature's ID
 			for(auto & elem : g->second.heroes)

+ 1 - 1
lib/LogicalExpression.h

@@ -185,7 +185,7 @@ namespace LogicalExpressionDetail
 		}
 	};
 
-	std::string getTextForOperator(std::string operation);
+	std::string DLL_LINKAGE getTextForOperator(std::string operation);
 
 	/// Prints expression in human-readable format
 	template <typename ContainedClass>