unblockableCheck.h
Go to the documentation of this file.
00001 /* unblockableCheck.h
00002  */
00003 #ifndef _UNBLOCKABLECHECK_H
00004 #define _UNBLOCKABLECHECK_H
00005 
00006 #include "osl/state/numEffectState.h"
00007 namespace osl
00008 {
00009   namespace effect_util
00010   {
00011 
00012     struct UnblockableCheck
00013     {
00021       static bool isMember(Player target, const NumEffectState& state)
00022       {
00023         const Square king_position = state.kingSquare(target);
00024         Piece attacker_piece;
00025         if (state.hasEffectAt(alt(target), king_position, attacker_piece))
00026         {
00027           if (attacker_piece == Piece::EMPTY())
00028             return true;        // multiple pieces
00029 
00030           // sigle check
00031           const Square from = attacker_piece.square();
00032           const EffectContent effect
00033             = Ptype_Table.getEffect(attacker_piece.ptypeO(), 
00034                                    from, king_position);
00035           return effect.hasUnblockableEffect();
00036         }
00037         // no check
00038         return false;
00039       }
00040     };
00041     
00042   } // namespace effect_util
00043 } // namespace osl
00044 
00045 #endif /* _UNBLOCKABLECHECK_H */
00046 // ;;; Local Variables:
00047 // ;;; mode:c++
00048 // ;;; c-basic-offset:2
00049 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines