mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-15 11:46:56 +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])
|
* is id1=7, id2=5 (pns[7][5])
|
||||||
*/
|
*/
|
||||||
bool pathContinuous = curPos.areNeighbours(nextPos) && curPos.areNeighbours(prevPos);
|
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 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
|
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
|
auto maxMovePoints = [&](CGPathNode *cp) -> int
|
||||||
{
|
{
|
||||||
return cp->land ? maxMovePointsLand : maxMovePointsWater;
|
return cp->layer == EPathfindingLayer::SAIL ? maxMovePointsWater : maxMovePointsLand;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto isBetterWay = [&](int remains, int turn) -> bool
|
auto isBetterWay = [&](int remains, int turn) -> bool
|
||||||
@ -181,7 +181,7 @@ void CPathfinder::addNeighbours(const int3 &coord)
|
|||||||
ct = &gs->map->getTile(coord);
|
ct = &gs->map->getTile(coord);
|
||||||
|
|
||||||
std::vector<int3> tiles;
|
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);
|
sTileObj = ct->topVisitableObj(coord == out.hpos);
|
||||||
if(canVisitObject())
|
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
|
//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
|
if(cp->accessible != CGPathNode::VISITABLE
|
||||||
|| !cp->theNodeBefore->land
|
|| !cp->theNodeBefore->layer != EPathfindingLayer::LAND
|
||||||
|| ct->topVisitableId() != Obj::BOAT)
|
|| ct->topVisitableId() != Obj::BOAT)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -444,7 +444,6 @@ void CPathfinder::initializeGraph()
|
|||||||
auto node = out.getNode(pos, layer);
|
auto node = out.getNode(pos, layer);
|
||||||
node->reset();
|
node->reset();
|
||||||
node->accessible = evaluateAccessibility(pos, tinfo);
|
node->accessible = evaluateAccessibility(pos, tinfo);
|
||||||
node->land = tinfo->terType != ETerrainType::WATER;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int3 pos;
|
int3 pos;
|
||||||
@ -572,7 +571,6 @@ void CGPathNode::reset()
|
|||||||
{
|
{
|
||||||
locked = false;
|
locked = false;
|
||||||
accessible = NOT_SET;
|
accessible = NOT_SET;
|
||||||
land = 0;
|
|
||||||
moveRemains = 0;
|
moveRemains = 0;
|
||||||
turns = 255;
|
turns = 255;
|
||||||
theNodeBefore = nullptr;
|
theNodeBefore = nullptr;
|
||||||
|
@ -45,7 +45,6 @@ struct DLL_LINKAGE CGPathNode
|
|||||||
|
|
||||||
bool locked;
|
bool locked;
|
||||||
EAccessibility accessible;
|
EAccessibility accessible;
|
||||||
ui8 land;
|
|
||||||
ui8 turns; //how many turns we have to wait before reachng the tile - 0 means current turn
|
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
|
ui32 moveRemains; //remaining tiles after hero reaches the tile
|
||||||
CGPathNode * theNodeBefore;
|
CGPathNode * theNodeBefore;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user