1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fixed most common cases of movement actions

This commit is contained in:
Ivan Savenko
2023-09-15 22:18:36 +03:00
parent 0afc244934
commit c8e6a7cd27
19 changed files with 258 additions and 270 deletions

View File

@@ -143,6 +143,18 @@ struct DLL_LINKAGE CGPathNode
return turns < 255;
}
bool isTeleportAction() const
{
if (action != EPathNodeAction::TELEPORT_NORMAL &&
action != EPathNodeAction::TELEPORT_BLOCKING_VISIT &&
action != EPathNodeAction::TELEPORT_BATTLE)
{
return false;
}
return true;
}
using TFibHeap = boost::heap::fibonacci_heap<CGPathNode *, boost::heap::compare<NodeComparer<CGPathNode>>>;
TFibHeap::handle_type pqHandle;
@@ -156,6 +168,13 @@ struct DLL_LINKAGE CGPath
{
std::vector<CGPathNode> nodes; //just get node by node
/// Starting position of path, matches location of hero
const CGPathNode & currNode() const;
/// First node in path, this is where hero will move next
const CGPathNode & nextNode() const;
/// Last node in path, this is what hero wants to reach in the end
const CGPathNode & lastNode() const;
int3 startPos() const; // start point
int3 endPos() const; //destination point
};