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 State,class OrigAction>
00020 struct CaptureFrom
00021 {
00022 BOOST_CLASS_REQUIRE(OrigAction,osl::move_action,Concept);
00023 const State& state;
00024 OrigAction & action;
00025
00026 public:
00027 CaptureFrom(const State& 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<PlayerTraits<PP>::opponent>::template
00037 generate(state, p.position(), action);
00038
00039 }
00040
00041 void simpleMove(Position from,Position to,Ptype ptype,
00042 bool isPromote,Player p)
00043 {
00044 assert(p == P);
00045 move_generator::Capture<PlayerTraits<P>::opponent >::template
00046 generate(state, from, action);
00047
00048 }
00049 void unknownMove(Position from,Position to,Piece p1,Ptype ptype,
00050 bool isPromote,Player p)
00051 {
00052 assert(p == P);
00053 move_generator::Capture<PlayerTraits<P>::opponent >::template
00054 generate(state, from, action);
00055 }
00059 void dropMove(Position to,Ptype ptype,Player p){
00060 assert(p == P);
00061 return;
00062 }
00063 };
00064 }
00065 }
00066
00067 #endif
00068
00069
00070
00071