12 #ifndef YAPF_COMMON_HPP
13 #define YAPF_COMMON_HPP
16 template <
class Types>
20 typedef typename Types::Tpf
Tpf;
21 typedef typename Types::NodeList::Titem
Node;
22 typedef typename Node::Key
Key;
31 return *
static_cast<Tpf *
>(
this);
50 Yapf().AddStartupNode(n1);
56 template <
class Types>
60 typedef typename Types::Tpf
Tpf;
61 typedef typename Types::NodeList::Titem
Node;
62 typedef typename Node::Key
Key;
75 return *
static_cast<Tpf *
>(
this);
96 Yapf().AddStartupNode(n1);
102 Yapf().AddStartupNode(n2);
114 template <
class Types>
118 typedef typename Types::Tpf
Tpf;
119 typedef typename Types::NodeList::Titem
Node;
120 typedef typename Node::Key
Key;
138 return *
static_cast<Tpf *
>(
this);
155 static const int dg_dir_to_x_offs[] = {-1, 0, 1, 0};
156 static const int dg_dir_to_y_offs[] = {0, 1, 0, -1};
158 n.m_estimate = n.m_cost;
164 int x1 = 2 *
TileX(tile) + dg_dir_to_x_offs[(int)exitdir];
165 int y1 = 2 *
TileY(tile) + dg_dir_to_y_offs[(int)exitdir];
168 int dx =
abs(x1 - x2);
169 int dy =
abs(y1 - y2);
170 int dmin =
min(dx, dy);
171 int dxy =
abs(dx - dy);
173 n.m_estimate = n.m_cost + d;
174 assert(n.m_estimate >= n.m_parent->m_estimate);
185 template <
class Ttypes>
187 :
public Ttypes::PfBase
188 ,
public Ttypes::PfCost
189 ,
public Ttypes::PfCache
190 ,
public Ttypes::PfOrigin
191 ,
public Ttypes::PfDestination
192 ,
public Ttypes::PfFollow