All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
virtualPin.h
Go to the documentation of this file.
1 /* virtualPin.h
2  */
3 #ifndef _VIRTUALPIN_H
4 #define _VIRTUALPIN_H
5 
7 namespace osl
8 {
9  namespace effect_util
10  {
11  class VirtualPin
12  {
13  private:
14  template <Direction DIR>
15  static bool findDirection(const SimpleState& state, Square target,
16  Player defense, const PieceMask& remove)
17  {
18  const Offset diff = Board_Table.getOffset(defense, DIR);
19  Piece p;
20  for (p=state.nextPiece(target, diff);;p=state.nextPiece(p.square(), diff)) {
21  if (! p.isPiece())
22  return false;
23  if (! remove.test(p.number()))
24  break;
25  }
26  assert(p.isPiece());
27  if (p.owner() == defense)
28  return false;
29  return (Ptype_Table.getMoveMask(p.ptype())
31  }
32  public:
34  static bool find(const NumEffectState& state, Player defense, const PieceMask& remove);
35  static bool find(const NumEffectState& state, Player defense, Square target)
36  {
37  return find(state, defense, state.effectSetAt(target));
38  }
39  };
40  }
41  using effect_util::VirtualPin;
42 }
43 
44 #endif /* _VIRTUALPIN_H */
45 // ;;; Local Variables:
46 // ;;; mode:c++
47 // ;;; c-basic-offset:2
48 // ;;; End: