mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Mechanic for air and land transport
This commit is contained in:
parent
ddcdfb643a
commit
3ff99a1a15
@ -1022,7 +1022,7 @@ bool TurnInfo::isLayerAvailable(const EPathfindingLayer & layer) const
|
||||
if(hero && hero->boat && hero->boat->layer == EPathfindingLayer::AIR)
|
||||
break;
|
||||
|
||||
if(hasBonusOfType(Bonus::FLYING_MOVEMENT))
|
||||
if(!hasBonusOfType(Bonus::FLYING_MOVEMENT))
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
@ -2263,10 +2263,9 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
const TerrainTile t = *getTile(hmpos);
|
||||
const int3 guardPos = gs->guardingCreaturePosition(hmpos);
|
||||
|
||||
const bool sailingBoat = h->boat && h->boat->layer == EPathfindingLayer::SAIL;
|
||||
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::TRANSPORT;
|
||||
const bool disembarking = h->boat
|
||||
&& (h->boat->layer == EPathfindingLayer::SAIL && t.terType->isLand())
|
||||
&& !t.blocked;
|
||||
const bool disembarking = sailingBoat && t.terType->isLand() && !t.blocked;
|
||||
|
||||
//result structure for start - movement failed, no move points used
|
||||
TryMoveHero tmh;
|
||||
@ -2290,7 +2289,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
&& complain("Cannot move hero, destination tile is blocked!"))
|
||||
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::TRANSPORT && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|
||||
&& complain("Cannot move hero, destination tile is on water!"))
|
||||
|| ((h->boat && t.terType->isLand() && t.blocked)
|
||||
|| ((sailingBoat && t.terType->isLand() && t.blocked)
|
||||
&& complain("Cannot disembark hero, tile is blocked!"))
|
||||
|| ((distance(h->pos, dst) >= 1.5 && !teleporting)
|
||||
&& complain("Tiles are not neighboring!"))
|
||||
|
Loading…
Reference in New Issue
Block a user