All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
noAddEffectFilter.h
Go to the documentation of this file.
1 /* noAddEffectFilter.h
2  */
3 #ifndef _NOADDEFFECTFILTER_H
4 #define _NOADDEFFECTFILTER_H
5 
8 namespace osl
9 {
10  namespace move_action
11  {
15  template<class OrigAction>
17  {
18  BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
19  const NumEffectState& state;
20  OrigAction & action;
22  public:
23  NoAddEffectFilter(const NumEffectState& s, OrigAction & action,Square target) : state(s), action(action),target(target) {}
24  void simpleMove(Square from,Square to,Ptype ptype, bool isPromote,Player p,Move m){
25  if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
26  action.simpleMove(from,to,ptype,isPromote,p,m);
27  }
28  void unknownMove(Square from,Square to,Piece p1,Ptype ptype,bool isPromote,Player p,Move m){
29  if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
30  action.unknownMove(from,to,p1,ptype,isPromote,p,m);
31  }
32  void dropMove(Square to,Ptype ptype,Player p,Move m){
33  if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
34  action.dropMove(to,ptype,p,m);
35  }
36  // old interfaces
37  void simpleMove(Square from,Square to,Ptype ptype,
38  bool isPromote,Player p)
39  {
40  simpleMove(from,to,ptype,isPromote,p,
41  Move(from,to,ptype,PTYPE_EMPTY,isPromote,p));
42  }
44  Ptype ptype,bool isPromote,Player p)
45  {
46  unknownMove(from,to,captured,ptype,isPromote,p,
47  Move(from,to,ptype,captured.ptype(),isPromote,p));
48  }
49  void dropMove(Square to,Ptype ptype,Player p)
50  {
51  dropMove(to,ptype,p,
52  Move(to,ptype,p));
53  }
54  };
55  } // namespace move_action
56 } // namespace osl
57 
58 
59 #endif /* _NOADDEFFECTFILTER_H */
60 // ;;; Local Variables:
61 // ;;; mode:c++
62 // ;;; c-basic-offset:2
63 // ;;; coding:utf-8
64 // ;;; End: