00001
00002
00003 #ifndef _NOADDEFFECTFILTER_H
00004 #define _NOADDEFFECTFILTER_H
00005
00006 #include "osl/state/numEffectState.h"
00007 #include "osl/move_action/concept.h"
00008 namespace osl
00009 {
00010 namespace move_action
00011 {
00015 template<class OrigAction>
00016 class NoAddEffectFilter
00017 {
00018 BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
00019 const NumEffectState& state;
00020 OrigAction & action;
00021 Square target;
00022 public:
00023 NoAddEffectFilter(const NumEffectState& s, OrigAction & action,Square target) : state(s), action(action),target(target) {}
00024 void simpleMove(Square from,Square to,Ptype ptype, bool isPromote,Player p,Move m){
00025 if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
00026 action.simpleMove(from,to,ptype,isPromote,p,m);
00027 }
00028 void unknownMove(Square from,Square to,Piece p1,Ptype ptype,bool isPromote,Player p,Move m){
00029 if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
00030 action.unknownMove(from,to,p1,ptype,isPromote,p,m);
00031 }
00032 void dropMove(Square to,Ptype ptype,Player p,Move m){
00033 if(!state.hasEffectIf(newPtypeO(p,ptype),to,target))
00034 action.dropMove(to,ptype,p,m);
00035 }
00036
00037 void simpleMove(Square from,Square to,Ptype ptype,
00038 bool isPromote,Player p)
00039 {
00040 simpleMove(from,to,ptype,isPromote,p,
00041 Move(from,to,ptype,PTYPE_EMPTY,isPromote,p));
00042 }
00043 void unknownMove(Square from,Square to,Piece captured,
00044 Ptype ptype,bool isPromote,Player p)
00045 {
00046 unknownMove(from,to,captured,ptype,isPromote,p,
00047 Move(from,to,ptype,captured.ptype(),isPromote,p));
00048 }
00049 void dropMove(Square to,Ptype ptype,Player p)
00050 {
00051 dropMove(to,ptype,p,
00052 Move(to,ptype,p));
00053 }
00054 };
00055 }
00056 }
00057
00058
00059 #endif
00060
00061
00062
00063
00064