mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-07 07:10:04 +02:00
CGPathNode: get rid of land member as it's now obsolete
CTerrainRect::showPath behaviour changed so it's will only add cross path graphics on embark/disembark and path ending. We want continuous paths for flying and water walking even when land<-> water transition occur.
This commit is contained in:
parent
842da69a3e
commit
4973a1ec90
@ -188,7 +188,7 @@ void CTerrainRect::showPath(const SDL_Rect * extRect, SDL_Surface * to)
|
||||
* is id1=7, id2=5 (pns[7][5])
|
||||
*/
|
||||
bool pathContinuous = curPos.areNeighbours(nextPos) && curPos.areNeighbours(prevPos);
|
||||
if(pathContinuous && cv[i].land == cv[i+1].land)
|
||||
if(pathContinuous && cv[i].action != CGPathNode::EMBARK && cv[i].action != CGPathNode::DISEMBARK)
|
||||
{
|
||||
int id1=(curPos.x-nextPos.x+1)+3*(curPos.y-nextPos.y+1); //Direction of entering vector
|
||||
int id2=(cv[i-1].coord.x-curPos.x+1)+3*(cv[i-1].coord.y-curPos.y+1); //Direction of exiting vector
|
||||
|
@ -63,7 +63,7 @@ void CPathfinder::calculatePaths()
|
||||
|
||||
auto maxMovePoints = [&](CGPathNode *cp) -> int
|
||||
{
|
||||
return cp->land ? maxMovePointsLand : maxMovePointsWater;
|
||||
return cp->layer == EPathfindingLayer::SAIL ? maxMovePointsWater : maxMovePointsLand;
|
||||
};
|
||||
|
||||
auto isBetterWay = [&](int remains, int turn) -> bool
|
||||
@ -181,7 +181,7 @@ void CPathfinder::addNeighbours(const int3 &coord)
|
||||
ct = &gs->map->getTile(coord);
|
||||
|
||||
std::vector<int3> tiles;
|
||||
gs->getNeighbours(*ct, coord, tiles, boost::logic::indeterminate, !cp->land);
|
||||
gs->getNeighbours(*ct, coord, tiles, boost::logic::indeterminate, cp->layer == EPathfindingLayer::SAIL); // TODO: find out if we still need "limitCoastSailing" option
|
||||
sTileObj = ct->topVisitableObj(coord == out.hpos);
|
||||
if(canVisitObject())
|
||||
{
|
||||
@ -411,7 +411,7 @@ bool CPathfinder::isSourceGuarded()
|
||||
{
|
||||
//special case -> hero embarked a boat standing on a guarded tile -> we must allow to move away from that tile
|
||||
if(cp->accessible != CGPathNode::VISITABLE
|
||||
|| !cp->theNodeBefore->land
|
||||
|| !cp->theNodeBefore->layer != EPathfindingLayer::LAND
|
||||
|| ct->topVisitableId() != Obj::BOAT)
|
||||
{
|
||||
return true;
|
||||
@ -444,7 +444,6 @@ void CPathfinder::initializeGraph()
|
||||
auto node = out.getNode(pos, layer);
|
||||
node->reset();
|
||||
node->accessible = evaluateAccessibility(pos, tinfo);
|
||||
node->land = tinfo->terType != ETerrainType::WATER;
|
||||
};
|
||||
|
||||
int3 pos;
|
||||
@ -572,7 +571,6 @@ void CGPathNode::reset()
|
||||
{
|
||||
locked = false;
|
||||
accessible = NOT_SET;
|
||||
land = 0;
|
||||
moveRemains = 0;
|
||||
turns = 255;
|
||||
theNodeBefore = nullptr;
|
||||
|
@ -45,7 +45,6 @@ struct DLL_LINKAGE CGPathNode
|
||||
|
||||
bool locked;
|
||||
EAccessibility accessible;
|
||||
ui8 land;
|
||||
ui8 turns; //how many turns we have to wait before reachng the tile - 0 means current turn
|
||||
ui32 moveRemains; //remaining tiles after hero reaches the tile
|
||||
CGPathNode * theNodeBefore;
|
||||
|
Loading…
x
Reference in New Issue
Block a user