説明を見る。00001
00002
00003 #ifndef OSL_SENDOFFPOSITION_H
00004 #define OSL_SENDOFFPOSITION_H
00005
00006 #include "osl/numEffectState.h"
00007 #include "osl/container/square8.h"
00008 namespace osl
00009 {
00010 namespace effect_util
00011 {
00012 struct Offset8 : public FixedCapacityVector<int,8>
00013 {
00014 };
00016 struct SendOffSquare
00017 {
00018 typedef uint8_t SendOff8;
00019 template <Player Attack>
00020 static bool onlyOneSupport(const NumEffectState& state, Square target)
00021 {
00022 const Piece p = state.pieceAt(target);
00023 if (! p.isOnBoardByOwner<alt(Attack)>())
00024 return false;
00025 return state.hasEffectAt<Attack>(target)
00026 && (state.countEffect(alt(Attack), target) == 1);
00027 }
00028 template <Player Attack>
00029 static SendOff8 find(const NumEffectState& state, Square king_position,
00030 Square8& out);
00031 static SendOff8 find(Player attack,
00032 const NumEffectState& state, Square king_position,
00033 Square8& out);
00034 static SendOff8 invalidData() { return 0xff; }
00035 static void unpack(SendOff8, Square king, Square8& out);
00036 struct Table
00037 {
00038 CArray<Offset,8> normal;
00039 CArray<Offset8,8> reverse;
00040 CArray<Offset8,256> reverse_all;
00041 void init();
00042 };
00043 static void init() { table.init(); }
00044 private:
00045 static Table table;
00046 template <Player Attack>
00047 static void testSquare(const NumEffectState& state, Square candidate,
00048 int id, int& out)
00049 {
00050 if (onlyOneSupport<Attack>(state, candidate))
00051 {
00052 out |= (1<<id);
00053 }
00054 }
00055 };
00056 }
00057 using effect_util::SendOffSquare;
00058 }
00059
00060 #endif
00061
00062
00063
00064
00065