00001
00002
00003 #ifndef _MOVE_capture_from_H
00004 #define _MOVE_capture_from_H
00005 #include "osl/position.h"
00006 #include "osl/player.h"
00007 #include "osl/ptype.h"
00008 #include "osl/move_action/concept.h"
00009 #include "osl/move_generator/capture_.h"
00010
00011 namespace osl
00012 {
00013 namespace move_action
00014 {
00015
00019 template<Player P,class OrigAction>
00020 struct CaptureFrom
00021 {
00022 BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
00023 const NumEffectState& state;
00024 OrigAction & action;
00025
00026 public:
00027 CaptureFrom(const NumEffectState& s, OrigAction & action)
00028 :
00029 state(s), action(action)
00030 {
00031 }
00032
00033 template <Player PP>
00034 void doAction (Piece const& p, Position const& )
00035 {
00036 move_generator::Capture<OrigAction>::
00037 template generate<PlayerTraits<PP>::opponent>(state, p.position(), action);
00038
00039 }
00040
00041 void simpleMove(Position from,Position to,Ptype ptype,
00042 bool isPromote,Player p,Move move)
00043 {
00044 assert(p == P);
00045 move_generator::Capture<OrigAction>::
00046 generate<PlayerTraits<P>::opponent >(state, from, action);
00047
00048 }
00049 void unknownMove(Position from,Position to,Piece p1,Ptype ptype,
00050 bool isPromote,Player p,Move move)
00051 {
00052 assert(p == P);
00053 move_generator::Capture<OrigAction>::
00054 generate<PlayerTraits<P>::opponent >(state, from, action);
00055 }
00059 void dropMove(Position to,Ptype ptype,Player p,Move move){
00060 assert(p == P);
00061 return;
00062 }
00063
00064 void simpleMove(Position from,Position to,Ptype ptype,
00065 bool isPromote,Player p)
00066 {
00067 simpleMove(from,to,ptype,isPromote,p,Move());
00068 }
00069 void unknownMove(Position from,Position to,Piece captured,
00070 Ptype ptype,bool isPromote,Player p)
00071 {
00072 unknownMove(from,to,captured,ptype,isPromote,p,Move());
00073 }
00074 void dropMove(Position to,Ptype ptype,Player p)
00075 {
00076 dropMove(to,ptype,p,Move());
00077 }
00078 };
00079 }
00080 }
00081
00082 #endif
00083
00084
00085
00086