Michał W. Urbańczyk 15 years ago
parent
commit
9af18cf487
3 changed files with 10 additions and 3 deletions
  1. 6 0
      client/CMT.cpp
  2. 1 1
      lib/CGameState.cpp
  3. 3 2
      lib/HeroBonus.h

+ 6 - 0
client/CMT.cpp

@@ -43,6 +43,7 @@
 #include <cstdlib>
 #include <cstdlib>
 #include "../lib/NetPacks.h"
 #include "../lib/NetPacks.h"
 #include "CMessage.h"
 #include "CMessage.h"
+#include "../hch/CObjectHandler.h"
 
 
 #ifdef _WIN32
 #ifdef _WIN32
 #include "SDL_syswm.h"
 #include "SDL_syswm.h"
@@ -421,6 +422,11 @@ void processCommand(const std::string &message)
 	{
 	{
 		gOnlyAI = true;
 		gOnlyAI = true;
 	}
 	}
+	else if(cn == "mp" && adventureInt)
+	{
+		if(const CGHeroInstance *h = dynamic_cast<const CGHeroInstance *>(adventureInt->selection))
+			tlog0 << h->movement << "; max: " << h->maxMovePoints(true) << "/" << h->maxMovePoints(false) << std::endl;
+	}
 	else if(client && client->serv && client->serv->connected) //send to server
 	else if(client && client->serv && client->serv->connected) //send to server
 	{
 	{
 		PlayerMessage pm(LOCPLINT->playerID,message);
 		PlayerMessage pm(LOCPLINT->playerID,message);

+ 1 - 1
lib/CGameState.cpp

@@ -1776,7 +1776,7 @@ int CGameState::getMovementCost(const CGHeroInstance *h, const int3 &src, const
 	//get basic cost
 	//get basic cost
 	int ret = h->getTileCost(d,s);
 	int ret = h->getTileCost(d,s);
 
 
-	if(d.blocked)
+	if(d.blocked && h->hasBonusOfType(Bonus::FLYING_MOVEMENT))
 	{
 	{
 		bool freeFlying = h->getBonusesCount(Selector::typeSybtype(Bonus::FLYING_MOVEMENT, 1)) > 0;
 		bool freeFlying = h->getBonusesCount(Selector::typeSybtype(Bonus::FLYING_MOVEMENT, 1)) > 0;
 
 

+ 3 - 2
lib/HeroBonus.h

@@ -420,8 +420,9 @@ public:
 
 
 	bool operator()(const Bonus &bonus) const
 	bool operator()(const Bonus &bonus) const
 	{
 	{
-		return !turnsRequested 
-			|| ( bonus.turnsRemain > turnsRequested && bonus.duration == Bonus::N_TURNS);
+		return turnsRequested <= 0					//every present effect will last zero (or "less") turns
+			|| !(bonus.duration & Bonus::N_TURNS)	//so do every not expriing after N-turns effect
+			|| bonus.turnsRemain > turnsRequested;	
 	}
 	}
 	CWillLastTurns& operator()(const int &setVal)
 	CWillLastTurns& operator()(const int &setVal)
 	{
 	{