Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
effect_util
unblockableEffect.h
Go to the documentation of this file.
1
/* unblockableEffect.h
2
*/
3
#ifndef _UNBLOCKABLEEFFECT_H
4
#define _UNBLOCKABLEEFFECT_H
5
6
#include "
osl/state/numEffectState.h
"
7
#include "
osl/container/pieceVector.h
"
8
#include "
osl/eval/pieceEval.h
"
9
#include "
osl/boardTable.h
"
10
#include "
osl/ptypeTraits.h
"
11
namespace
osl
12
{
13
namespace
effect_util
14
{
15
struct
UnblockableEffect
16
{
21
static
int
find
(
const
NumEffectState& state,
22
PtypeO
ptypeo,
Square
from,
23
PieceVector& supported,
24
PieceVector& unsupported)
25
{
26
const
int
move_mask =
Ptype_Table
.
getMoveMask
(
getPtype
(ptypeo));
27
const
Player
player =
getOwner
(ptypeo);
28
const
int
attacker_value = abs(
eval::PieceEval::captureValue
(ptypeo));
29
for
(
int
i=
DIRECTION_MIN
; i<=
DIRECTION_MAX
; ++i)
30
{
31
if
(! (move_mask & (1<<i)))
32
continue
;
33
const
Direction
dir =
static_cast<
Direction
>
(i);
34
const
Square
to
35
=
Board_Table
.
nextSquare
(player, from, dir);
36
const
Piece
target
= state.pieceAt(to);
37
if
(!target.
isOnBoardByOwner
(
alt
(player)))
38
continue
;
39
if
(state.hasEffectAt(
alt
(player), to))
40
{
41
if
(abs(
eval::PieceEval::captureValue
(target.
ptypeO
()))
42
> attacker_value)
43
supported.push_back(target);
44
}
45
else
46
{
47
unsupported.push_back(target);
48
}
49
}
50
return
attacker_value;
51
}
52
};
53
54
}
// namespace effect_util
55
}
// namespace osl
56
57
#endif
/* _UNBLOCKABLEEFFECT_H */
58
// ;;; Local Variables:
59
// ;;; mode:c++
60
// ;;; c-basic-offset:2
61
// ;;; End:
Generated on Sun Jul 21 2013 13:37:27 by
1.8.4