00001
00002
00003 #ifndef _NO_EFFECT_FILTER_H
00004 #define _NO_EFFECT_FILTER_H
00005
00006 #include "osl/player.h"
00007 #include "osl/move_action/concept.h"
00008 namespace osl
00009 {
00010 namespace move_action
00011 {
00015 template<Player P,class State,class OrigAction>
00016 class NoEffectFilter
00017 {
00018 BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
00019 const State& state;
00020 OrigAction & action;
00021 Position removed;
00022 public:
00023 NoEffectFilter(const State& s, OrigAction & action,Position pos) : state(s), action(action),removed(pos) {}
00024 void simpleMove(Position from,Position to,Ptype ptype, bool isPromote,Player ){
00025 if(!state.template hasEffectByWithRemove<PlayerTraits<P>::opponent>(to,removed))
00026 action.simpleMove(from,to,ptype,isPromote,P);
00027 }
00028 void unknownMove(Position from,Position to,Piece p1,Ptype ptype,bool isPromote,Player ){
00029 if(!state.template hasEffectByWithRemove<PlayerTraits<P>::opponent>(to,removed)){
00030 action.unknownMove(from,to,p1,ptype,isPromote,P);
00031 }
00032 }
00033 void dropMove(Position to,Ptype ptype,Player ){
00035 if(!state.template hasEffectByWithRemove<PlayerTraits<P>::opponent>(to,removed))
00036 action.dropMove(to,ptype,P);
00037 }
00038
00039 };
00040
00041 }
00042 }
00043
00044
00045 #endif
00046
00047
00048
00049