/usr/include/osl/effect_util/sendOffSquare.h is in libosl-dev 0.6.0-3.3.
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 | /* sendOffSquare.h
*/
#ifndef OSL_SENDOFFPOSITION_H
#define OSL_SENDOFFPOSITION_H
#include "osl/state/numEffectState.h"
#include "osl/container/square8.h"
namespace osl
{
namespace effect_util
{
struct Offset8 : public FixedCapacityVector<int,8>
{
};
/** 送り金のような玉で取ると利きがはずれる駒が発生するマスを調査 */
struct SendOffSquare
{
typedef uint8_t SendOff8;
template <Player Attack>
static bool onlyOneSupport(const NumEffectState& state, Square target)
{
const Piece p = state.pieceAt(target);
if (! p.isOnBoardByOwner<PlayerTraits<Attack>::opponent>())
return false;
return state.hasEffectAt<Attack>(target)
&& (state.countEffect(alt(Attack), target) == 1);
}
template <Player Attack>
static SendOff8 find(const NumEffectState& state, Square king_position,
Square8& out);
static SendOff8 find(Player attack,
const NumEffectState& state, Square king_position,
Square8& out);
static SendOff8 invalidData() { return 0xff; }
static void unpack(SendOff8, Square king, Square8& out);
struct Table
{
CArray<Offset,8> normal;
CArray<Offset8,8> reverse;
CArray<Offset8,256> reverse_all;
Table();
};
private:
static const Table table;
template <Player Attack>
static void testSquare(const NumEffectState& state, Square candidate,
int id, int& out)
{
if (onlyOneSupport<Attack>(state, candidate))
{
out |= (1<<id);
}
}
};
} // namespace effect_util
using effect_util::SendOffSquare;
} // namespace osl
#endif /* OSL_SENDOFFPOSITION_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; coding:utf-8
// ;;; End:
|