mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
MSVS compiler doesn't allow default arguments for Lambdas.
This commit is contained in:
parent
ec879046ca
commit
8820bc05a9
@ -1730,12 +1730,12 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
|
|||||||
throw goalFulfilledException (sptr(Goals::VisitTile(dst).sethero(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);
|
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);
|
cb->moveHero(*h, CGHeroInstance::convertPosition(dst, true), transit);
|
||||||
};
|
};
|
||||||
@ -1750,7 +1750,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
|
|||||||
|
|
||||||
auto doChannelProbing = [&]() -> void
|
auto doChannelProbing = [&]() -> void
|
||||||
{
|
{
|
||||||
auto currentExit = getObj(CGHeroInstance::convertPosition(h->pos,false));
|
auto currentExit = getObj(CGHeroInstance::convertPosition(h->pos,false), false);
|
||||||
assert(currentExit);
|
assert(currentExit);
|
||||||
|
|
||||||
status.setChannelProbing(true);
|
status.setChannelProbing(true);
|
||||||
@ -1768,7 +1768,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
|
|||||||
int3 nextCoord = path.nodes[i-1].coord;
|
int3 nextCoord = path.nodes[i-1].coord;
|
||||||
|
|
||||||
auto currentObject = getObj(currentCoord, currentCoord == CGHeroInstance::convertPosition(h->pos,false));
|
auto currentObject = getObj(currentCoord, currentCoord == CGHeroInstance::convertPosition(h->pos,false));
|
||||||
auto nextObject = getObj(nextCoord);
|
auto nextObject = getObj(nextCoord, false);
|
||||||
if(CGTeleport::isConnected(currentObject, nextObject))
|
if(CGTeleport::isConnected(currentObject, nextObject))
|
||||||
{ //we use special login if hero standing on teleporter it's mean we need
|
{ //we use special login if hero standing on teleporter it's mean we need
|
||||||
doTeleportMovement(currentCoord, nextObject->id);
|
doTeleportMovement(currentCoord, nextObject->id);
|
||||||
@ -1790,13 +1790,13 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if((i-2 >= 0) // Check there is node after next one; otherwise transit is pointless
|
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)))
|
|| CGTeleport::isTeleport(nextObject)))
|
||||||
{ // Hero should be able to go through object if it's allow transit
|
{ // Hero should be able to go through object if it's allow transit
|
||||||
doMovement(endpos, true);
|
doMovement(endpos, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
doMovement(endpos);
|
doMovement(endpos, false);
|
||||||
|
|
||||||
afterMovementCheck();
|
afterMovementCheck();
|
||||||
|
|
||||||
|
@ -2654,14 +2654,14 @@ bool CPlayerInterface::capturedAllEvents()
|
|||||||
void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
||||||
{
|
{
|
||||||
int i = 1;
|
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);
|
return cb->getTile(CGHeroInstance::convertPosition(coord,false))->topVisitableObj(ignoreHero);
|
||||||
};
|
};
|
||||||
|
|
||||||
boost::unique_lock<boost::mutex> un(stillMoveHero.mx);
|
boost::unique_lock<boost::mutex> un(stillMoveHero.mx);
|
||||||
stillMoveHero.data = CONTINUE_MOVE;
|
stillMoveHero.data = CONTINUE_MOVE;
|
||||||
auto doMovement = [&](int3 dst, bool transit = false)
|
auto doMovement = [&](int3 dst, bool transit)
|
||||||
{
|
{
|
||||||
stillMoveHero.data = WAITING_MOVE;
|
stillMoveHero.data = WAITING_MOVE;
|
||||||
cb->moveHero(h, dst, transit);
|
cb->moveHero(h, dst, transit);
|
||||||
@ -2685,7 +2685,7 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
|||||||
{
|
{
|
||||||
CCS->soundh->stopSound(sh);
|
CCS->soundh->stopSound(sh);
|
||||||
destinationTeleport = nextObject->id;
|
destinationTeleport = nextObject->id;
|
||||||
doMovement(h->pos);
|
doMovement(h->pos, false);
|
||||||
sh = CCS->soundh->playSound(CCS->soundh->horseSounds[currentTerrain], -1);
|
sh = CCS->soundh->playSound(CCS->soundh->horseSounds[currentTerrain], -1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2717,13 +2717,13 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
|||||||
logGlobal->traceStream() << "Requesting hero movement to " << endpos;
|
logGlobal->traceStream() << "Requesting hero movement to " << endpos;
|
||||||
|
|
||||||
if((i-2 >= 0) // Check there is node after next one; otherwise transit is pointless
|
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)))
|
|| CGTeleport::isTeleport(nextObject)))
|
||||||
{ // Hero should be able to go through object if it's allow transit
|
{ // Hero should be able to go through object if it's allow transit
|
||||||
doMovement(endpos, true);
|
doMovement(endpos, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
doMovement(endpos);
|
doMovement(endpos, false);
|
||||||
|
|
||||||
logGlobal->traceStream() << "Resuming " << __FUNCTION__;
|
logGlobal->traceStream() << "Resuming " << __FUNCTION__;
|
||||||
bool guarded = cb->isInTheMap(cb->getGuardingCreaturePosition(endpos - int3(1, 0, 0)));
|
bool guarded = cb->isInTheMap(cb->getGuardingCreaturePosition(endpos - int3(1, 0, 0)));
|
||||||
|
@ -5846,6 +5846,6 @@ const CMap * ServerSpellCastEnvironment::getMap() const
|
|||||||
|
|
||||||
bool ServerSpellCastEnvironment::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker) 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user