11 #include "../plib/stlastar.h" 20 #define BORDER_SKIRT 5 52 m_List.push_back( theNode );
57 for (
auto blockNode :
m_List )
65 for (
const auto blockNode :
m_List )
67 if ( ( blockNode->x == x ) && ( blockNode->y == y ) &&
86 : theBlockers( nullptr ),
98 theBlockers = blockers;
100 float GoalDistanceEstimate(
UOPathState& nodeGoal );
110 return ( ( rhs.
x ==
x ) && ( rhs.
y ==
y ) && ( rhs.
z ==
z ) && ( rhs.
realm == realm ) );
114 return ( (
float)( abs(
x - nodeGoal.
x ) + abs(
y - nodeGoal.
y ) + abs(
z - nodeGoal.
z ) ) );
118 return ( ( nodeGoal.
x ==
x ) && ( nodeGoal.
y ==
y ) &&
124 int xdiff = abs(
x - successor.
x );
125 int ydiff = abs(
y - successor.
y );
126 if ( xdiff && ydiff )
134 writer.Format(
"({},{},{})" ) <<
x <<
y <<
z;
147 for (
short i = -1; i <= 1; i++ )
149 for (
short j = -1; j <= 1; j++ )
151 if ( ( i == 0 ) && ( j == 0 ) )
158 if ( ( newx < 0 ) || ( newx < ( theBlockers->xLow ) ) || ( newx > ( theBlockers->xHigh ) ) ||
159 ( newx > ( (
int)realm->width() ) ) )
162 if ( ( newy < 0 ) || ( newy < ( theBlockers->yLow ) ) || ( ( newy > theBlockers->yHigh ) ) ||
163 ( newy > ( (int)realm->height() ) ) )
166 if ( realm->walkheight( newx, newy,
z, &newz, &supporting_multi, &walkon_item, doors_block,
170 bool blocked =
false;
171 if ( ( i != 0 ) && ( j != 0 ) )
174 if ( !realm->walkheight(
x + i,
y,
z, &newz, &supporting_multi, &walkon_item, doors_block,
176 blocked = !( realm->walkheight(
x,
y + j,
z, &newz, &supporting_multi, &walkon_item,
185 NewNode->
realm = realm;
188 if ( ( !NewNode->
IsSameState( SolutionStartNode ) ) &&
190 blocked = ( theBlockers->IsBlocking( newx, newy, newz ) );
float GetCost(UOPathState &successor)
AStarBlockers(short xL, short xH, short yL, short yH)
bool AddSuccessor(UserState &State)
bool GetSuccessors(Plib::AStarSearch< UOPathState > *astarsearch, UOPathState *parent_node, bool doors_block)
std::vector< BlockNode * > BlockNodeVector
bool IsGoal(UOPathState &nodeGoal)
bool IsSameState(UOPathState &rhs)
void AddBlocker(short x, short y, short z)
unsigned char default_character_height
SettingsManager settingsManager
UOPathState(short newx, short newy, short newz, Realms::Realm *newrealm, AStarBlockers *blockers)
Realms::Realm * find_realm(const std::string &name)
float GoalDistanceEstimate(UOPathState &nodeGoal)
AStarBlockers * theBlockers
bool IsBlocking(short x, short y, short z)
UserState * GetSolutionStart()
UserState * GetSolutionEnd()