2025-08-17 13:14:17 -04:00
|
|
|
#include "xpathnodetransient.h"
|
2025-09-05 18:35:17 -04:00
|
|
|
#include "xpathnode.h"
|
2025-08-17 13:14:17 -04:00
|
|
|
|
|
|
|
|
XPathNodeTransient::XPathNodeTransient()
|
2025-09-05 18:35:17 -04:00
|
|
|
: XAsset()
|
|
|
|
|
, mSearchFrame(0)
|
|
|
|
|
, mNextOpen(new XPathNode())
|
|
|
|
|
, mPrevOpen(new XPathNode())
|
|
|
|
|
, mParent(new XPathNode())
|
|
|
|
|
, mCost(0.0f)
|
|
|
|
|
, mHeuristic(0.0f)
|
|
|
|
|
, mCostFactor(0.0f)
|
|
|
|
|
{
|
2025-09-10 21:58:26 -04:00
|
|
|
SetName("Path Node Transient");
|
2025-08-17 13:14:17 -04:00
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XPathNodeTransient::~XPathNodeTransient()
|
|
|
|
|
{
|
2025-08-17 13:14:17 -04:00
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
}
|
2025-08-17 13:14:17 -04:00
|
|
|
|
2025-09-10 21:58:26 -04:00
|
|
|
void XPathNodeTransient::ParseData(XDataStream *aStream) {
|
2025-09-05 18:35:17 -04:00
|
|
|
if (GetPtr() == -1) {
|
|
|
|
|
qint32 node1Ptr, node2Ptr, node3Ptr;
|
|
|
|
|
*aStream
|
|
|
|
|
>>mSearchFrame
|
|
|
|
|
>>node1Ptr
|
|
|
|
|
>>node2Ptr
|
|
|
|
|
>>node3Ptr
|
|
|
|
|
>>mCost
|
|
|
|
|
>>mHeuristic
|
|
|
|
|
>>mCostFactor;
|
2025-08-17 13:14:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int XPathNodeTransient::GetSearchFrame() const {
|
|
|
|
|
return mSearchFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XPathNodeTransient::SetSearchFrame(int frame) {
|
|
|
|
|
mSearchFrame = frame;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XPathNode* XPathNodeTransient::GetNextOpen() const {
|
2025-08-17 13:14:17 -04:00
|
|
|
return mNextOpen;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XPathNodeTransient::SetNextOpen(XPathNode* node) {
|
2025-08-17 13:14:17 -04:00
|
|
|
mNextOpen = node;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XPathNode* XPathNodeTransient::GetPrevOpen() const {
|
2025-08-17 13:14:17 -04:00
|
|
|
return mPrevOpen;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XPathNodeTransient::SetPrevOpen(XPathNode* node) {
|
2025-08-17 13:14:17 -04:00
|
|
|
mPrevOpen = node;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
XPathNode* XPathNodeTransient::GetParent() const {
|
2025-08-17 13:14:17 -04:00
|
|
|
return mParent;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-05 18:35:17 -04:00
|
|
|
void XPathNodeTransient::SetParent(XPathNode* parent) {
|
2025-08-17 13:14:17 -04:00
|
|
|
mParent = parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float XPathNodeTransient::GetCost() const {
|
|
|
|
|
return mCost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XPathNodeTransient::SetCost(float cost) {
|
|
|
|
|
mCost = cost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float XPathNodeTransient::GetHeuristic() const {
|
|
|
|
|
return mHeuristic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XPathNodeTransient::SetHeuristic(float heuristic) {
|
|
|
|
|
mHeuristic = heuristic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float XPathNodeTransient::GetCostFactor() const {
|
|
|
|
|
return mCostFactor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XPathNodeTransient::SetCostFactor(float factor) {
|
|
|
|
|
mCostFactor = factor;
|
|
|
|
|
}
|