22 #include "common/std/queue.h" 23 #include "common/std/vector.h" 24 #include "common/std/algorithm.h" 25 #include "common/std/functional.h" 26 #include "common/std/xutility.h" 30 #define INFINITY ((float)(1e+300 * 1e+300)) // This must overflow 44 void Resize(
int width,
int height);
57 NavResult NavigateRefined(
int sx,
int sy,
int ex,
int ey,
std::vector<int> &opath,
62 bool TraceLine(
int srcx,
int srcy,
int targx,
int targy,
int &lastValidX,
int &lastValidY)
const;
63 bool TraceLine(
int srcx,
int srcy,
int targx,
int targy,
std::vector<int> *rpath =
nullptr)
const;
65 inline void SetMapRow(
int y,
const unsigned char *row) {
69 static int PackSquare(
int x,
int y);
70 static void UnpackSquare(
int sq,
int &x,
int &y);
80 inline Entry(
float ncost,
int nindex)
85 inline bool operator <(
const Entry &b)
const {
89 inline bool operator >(
const Entry &b)
const {
98 typedef unsigned short tFrameId;
116 static const float DIST_SCALE_PACK;
117 static const float DIST_SCALE_UNPACK;
141 inline bool Outside(
int x,
int y)
const;
143 bool Passable(
int x,
int y)
const;
145 inline bool Walkable(
int x,
int y)
const;
147 void AddPruned(
int *buf,
int &bcount,
int x,
int y)
const;
148 bool HasForcedNeighbor(
int x,
int y,
int dx,
int dy)
const;
149 int FindJump(
int x,
int y,
int dx,
int dy,
int ex,
int ey);
150 int FindOrthoJump(
int x,
int y,
int dx,
int dy,
int ex,
int ey);
153 bool Reachable(
int x0,
int y0,
int x1,
int y1)
const;
155 static inline int sign(
int n) {
156 return n < 0 ? -1 : (n > 0 ? 1 : 0);
159 static inline int iabs(
int n) {
160 return n < 0 ? -n : n;
163 static inline int iclamp(
int v,
int min,
int max) {
164 return v < min ? min : (v > max ? max : v);
167 static inline int ClosestDist(
int dx,
int dy) {
168 return dx * dx + dy * dy;
174 inline int Navigation::PackSquare(
int x,
int y) {
175 return (y << 16) + x;
178 inline void Navigation::UnpackSquare(
int sq,
int &x,
int &y) {
180 x = sq & ((1 << 16) - 1);
183 inline bool Navigation::Outside(
int x,
int y)
const {
185 (
unsigned)x >= (unsigned)mapWidth ||
186 (
unsigned)y >= (unsigned)mapHeight;
189 inline bool Navigation::Walkable(
int x,
int y)
const {
191 return map[y][x] != 0;
Definition: route_finder_jps.h:40