浏览代码

MSVS compiler doesn't allow default arguments for Lambdas.

DjWarmonger 10 年之前
父节点
当前提交
8820bc05a9
共有 3 个文件被更改,包括 12 次插入12 次删除
  1. 6 6
      AI/VCAI/VCAI.cpp
  2. 5 5
      client/CPlayerInterface.cpp
  3. 1 1
      server/CGameHandler.cpp

+ 6 - 6
AI/VCAI/VCAI.cpp

@@ -1730,12 +1730,12 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 			throw goalFulfilledException (sptr(Goals::VisitTile(dst).sethero(h)));
 		}
 
-		auto getObj = [&](int3 coord, bool ignoreHero = false)
+		auto getObj = [&](int3 coord, bool ignoreHero)
 		{
 			return cb->getTile(coord,false)->topVisitableObj(ignoreHero);
 		};
 
-		auto doMovement = [&](int3 dst, bool transit = false)
+		auto doMovement = [&](int3 dst, bool transit)
 		{
 			cb->moveHero(*h, CGHeroInstance::convertPosition(dst, true), transit);
 		};
@@ -1750,7 +1750,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 
 		auto doChannelProbing = [&]() -> void
 		{
-			auto currentExit = getObj(CGHeroInstance::convertPosition(h->pos,false));
+			auto currentExit = getObj(CGHeroInstance::convertPosition(h->pos,false), false);
 			assert(currentExit);
 
 			status.setChannelProbing(true);
@@ -1768,7 +1768,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 			int3 nextCoord = path.nodes[i-1].coord;
 
 			auto currentObject = getObj(currentCoord, currentCoord == CGHeroInstance::convertPosition(h->pos,false));
-			auto nextObject = getObj(nextCoord);
+			auto nextObject = getObj(nextCoord, false);
 			if(CGTeleport::isConnected(currentObject, nextObject))
 			{ //we use special login if hero standing on teleporter it's mean we need
 				doTeleportMovement(currentCoord, nextObject->id);
@@ -1790,13 +1790,13 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 				continue;
 
 			if((i-2 >= 0) // Check there is node after next one; otherwise transit is pointless
-				&& (CGTeleport::isConnected(nextObject, getObj(path.nodes[i-2].coord))
+				&& (CGTeleport::isConnected(nextObject, getObj(path.nodes[i-2].coord, false))
 					|| CGTeleport::isTeleport(nextObject)))
 			{ // Hero should be able to go through object if it's allow transit
 				doMovement(endpos, true);
 			}
 			else
-				doMovement(endpos);
+				doMovement(endpos, false);
 
 			afterMovementCheck();
 

+ 5 - 5
client/CPlayerInterface.cpp

@@ -2654,14 +2654,14 @@ bool CPlayerInterface::capturedAllEvents()
 void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
 {
 	int i = 1;
-	auto getObj = [&](int3 coord, bool ignoreHero = false)
+	auto getObj = [&](int3 coord, bool ignoreHero)
 	{
 		return cb->getTile(CGHeroInstance::convertPosition(coord,false))->topVisitableObj(ignoreHero);
 	};
 
 	boost::unique_lock<boost::mutex> un(stillMoveHero.mx);
 	stillMoveHero.data = CONTINUE_MOVE;
-	auto doMovement = [&](int3 dst, bool transit = false)
+	auto doMovement = [&](int3 dst, bool transit)
 	{
 		stillMoveHero.data = WAITING_MOVE;
 		cb->moveHero(h, dst, transit);
@@ -2685,7 +2685,7 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
 			{
 				CCS->soundh->stopSound(sh);
 				destinationTeleport = nextObject->id;
-				doMovement(h->pos);
+				doMovement(h->pos, false);
 				sh = CCS->soundh->playSound(CCS->soundh->horseSounds[currentTerrain], -1);
 				continue;
 			}
@@ -2717,13 +2717,13 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
 			logGlobal->traceStream() << "Requesting hero movement to " << endpos;
 
 			if((i-2 >= 0) // Check there is node after next one; otherwise transit is pointless
-				&& (CGTeleport::isConnected(nextObject, getObj(path.nodes[i-2].coord))
+				&& (CGTeleport::isConnected(nextObject, getObj(path.nodes[i-2].coord, false))
 					|| CGTeleport::isTeleport(nextObject)))
 			{ // Hero should be able to go through object if it's allow transit
 				doMovement(endpos, true);
 			}
 			else
-				doMovement(endpos);
+				doMovement(endpos, false);
 
 			logGlobal->traceStream() << "Resuming " << __FUNCTION__;
 			bool guarded = cb->isInTheMap(cb->getGuardingCreaturePosition(endpos - int3(1, 0, 0)));

+ 1 - 1
server/CGameHandler.cpp

@@ -5846,6 +5846,6 @@ const CMap * ServerSpellCastEnvironment::getMap() const
 
 bool ServerSpellCastEnvironment::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker) const
 {
-	return gh->moveHero(hid, dst, teleporting, asker);
+	return gh->moveHero(hid, dst, teleporting, false, asker);
 }