/usr/include/osl/effect_action/alwaysMove.h is in libosl-dev 0.6.0-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #ifndef _ALWAYS_MOVE_ACTION
#define _ALWAYS_MOVE_ACTION
#include "osl/player.h"
#include "osl/ptype.h"
#include "osl/ptypeTable.h"
#include "osl/ptypeTraits.h"
#include "osl/piece.h"
#include "osl/move_action/concept.h"
namespace osl
{
namespace effect_action
{
/**
* 全ての指手を生成
*/
template<class Action>
class AlwaysMove
{
BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
private:
const NumEffectState& state;
Action& ac;
public:
AlwaysMove(const NumEffectState& s, Action & a) : state(s), ac(a) {}
/**
* Ptypeをtemplate引数にできる場合
*/
template<Player P,Ptype Type>
void doActionPtype(Piece p1,Square to){
assert(Type == unpromote(p1.ptype()));
Square from=p1.square();
if (canPromote(Type) &&
!p1.isPromotedNotKingGold() &&
(to.canPromote<P>() || from.canPromote<P>())){
ac.unknownMove(from,to,state.pieceAt(to),promote(Type),true,P);
}
if (!canPromote(Type) ||
PtypePlayerTraits<Type,P>::canDropTo(to) ||
p1.isPromotedNotKingGold()){
ac.unknownMove(from,to,state.pieceAt(to),p1.ptype(),false,P);
}
}
/**
* Ptypeをtemplate引数にできない場合
*/
template<Player P>
void doAction(Piece p1,Square to)
{
Square from=p1.square();
Ptype ptype=p1.ptype();
if(canPromote(ptype))
{
if (to.canPromote<P>())
{
ac.unknownMove(from,to,state.pieceAt(to),promote(ptype),true,P);
if(Ptype_Table.canDropTo(P, ptype,to))
{
ac.unknownMove(from,to,state.pieceAt(to),ptype,false,P);
}
}
else if (from.canPromote<P>())
{
ac.unknownMove(from,to,state.pieceAt(to),promote(ptype),true,P);
ac.unknownMove(from,to,state.pieceAt(to),ptype,false,P);
}
else
{
ac.unknownMove(from,to,state.pieceAt(to),ptype,false,P);
}
}
else
{
ac.unknownMove(from,to,state.pieceAt(to),ptype,false,P);
}
}
bool done() const{ return false; }
};
} // namespace effect_action
} // namespace osl
#endif // _ALWAYS_MOVE_ACTION
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|