/usr/include/osl/effect_util/effectUtil.tcc is in libosl-dev 0.8.0-1.4.
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 | #ifndef _EFFECTUTIL_TCC
#define _EFFECTUTIL_TCC
#include "osl/effect_util/effectUtil.h"
template <class EvalT>
struct osl::effect_util::EffectUtil::FindThreat
{
const NumEffectState& state;
Player target;
int attacker_value;
PieceVector& supported, & unsupported;
FindThreat(const NumEffectState& st, Player t, int a,
PieceVector& s, PieceVector& u)
: state(st), target(t), attacker_value(a), supported(s), unsupported(u)
{
}
void operator()(Square pos)
{
const Piece cur = state.pieceOnBoard(pos);
assert(cur.isPiece());
if (cur.owner() != target)
return;
if (state.hasEffectAt(target, pos))
{
if (abs(EvalT::captureValue(cur.ptypeO()))
> attacker_value)
supported.push_back(cur);
}
else
{
unsupported.push_back(cur);
}
}
};
template <class EvalT>
void osl::EffectUtil::
findThreat(const NumEffectState& state, Square position,
PtypeO ptypeo, PieceVector& out)
{
PieceVector supported, unsupported;
const int attacker_value = abs(EvalT::captureValue(ptypeo));
FindThreat<EvalT> f(state, alt(getOwner(ptypeo)), attacker_value,
supported, unsupported);
state.forEachEffectOfPtypeO<FindThreat<EvalT>, false>
(position, ptypeo, f);
unsupported.sortByPtype();
supported.sortByPtype();
PieceVector::iterator u=unsupported.begin(), s=supported.begin();
if (u!=unsupported.end())
{
while ((s!=supported.end())
&& ((abs(EvalT::captureValue(s->ptypeO()))
- attacker_value)
> abs(EvalT::captureValue(u->ptypeO()))))
{
out.push_back(*s);
++s;
}
}
out.push_back(u, unsupported.end());
out.push_back(s, supported.end());
}
#endif /* _EFFECTUTIL_TCC */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|