1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

More fixes:

- logical expressions should compile without cpp include
- fixed #1608 and #1610
This commit is contained in:
Ivan Savenko
2013-12-04 03:54:02 +00:00
parent b3b523b768
commit b1e638d1af
4 changed files with 14 additions and 14 deletions

View File

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

View File

@ -1109,6 +1109,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &pos) void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &pos)
{ {
EVENT_HANDLER_CALLED_BY_CLIENT; 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) for(auto & po : pos)
adventureInt->minimap.showTile(po); adventureInt->minimap.showTile(po);
if(!pos.empty()) if(!pos.empty())
@ -1571,14 +1572,9 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
adventureInt->centerOn (pos); adventureInt->centerOn (pos);
if(focusTime) if(focusTime)
{ {
bool activeAdv = (GH.topInt() == adventureInt && adventureInt->isActive()); GH.totalRedraw();
if(activeAdv) CSDL_Ext::update(screen);
adventureInt->deactivate();
SDL_Delay(focusTime); SDL_Delay(focusTime);
if(activeAdv)
adventureInt->activate();
} }
} }

View File

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

View File

@ -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 /// Prints expression in human-readable format
template <typename ContainedClass> template <typename ContainedClass>