00001
00002
00003 #ifndef _NOADDEFFECTFILTER_H
00004 #define _NOADDEFFECTFILTER_H
00005
00006 #include "osl/state/simpleState.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 SimpleState& state;
00020 OrigAction & action;
00021 Position target;
00022 public:
00023 NoAddEffectFilter(const SimpleState& s, OrigAction & action,Position target) : state(s), action(action),target(target) {}
00024 void simpleMove(Position from,Position to,Ptype ptype, bool isPromote,Player p){
00025 if(!state.hasEffectFromTo(newPtypeO(p,ptype),to,target))
00026 action.simpleMove(from,to,ptype,isPromote,p);
00027 }
00028 void unknownMove(Position from,Position to,Piece p1,Ptype ptype,bool isPromote,Player p){
00029 if(!state.hasEffectFromTo(newPtypeO(p,ptype),to,target))
00030 action.unknownMove(from,to,p1,ptype,isPromote,p);
00031 }
00032 void dropMove(Position to,Ptype ptype,Player p){
00033 if(!state.hasEffectFromTo(newPtypeO(p,ptype),to,target))
00034 action.dropMove(to,ptype,p);
00035 }
00036 };
00037 }
00038 }
00039
00040
00041 #endif
00042
00043
00044
00045