本文整理汇总了C++中Pairs::GetPairNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Pairs::GetPairNumber方法的具体用法?C++ Pairs::GetPairNumber怎么用?C++ Pairs::GetPairNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pairs
的用法示例。
在下文中一共展示了Pairs::GetPairNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPairSwaps
void Hand::SetPairSwaps(
const ResultType& res,
ValetEntryType& entry,
unsigned& decl,
unsigned& leader)
{
// This function takes care of assigning the scores to the right
// players within a pair. pairNo is negative if the players are
// internally stored in the opposite order to the one that happens
// to be at the table.
unsigned swapNS, swapEW;
int pairNoNS = pairs.GetPairNumber(res.north, res.south);
assert(pairNoNS != 0);
if (pairNoNS < 0)
{
entry.pairNo = static_cast<unsigned>(-pairNoNS);
swapNS = 1;
}
else
{
entry.pairNo = static_cast<unsigned>(pairNoNS);
swapNS = 0;
}
int pairNoEW = pairs.GetPairNumber(res.east, res.west);
assert(pairNoEW != 0);
if (pairNoEW < 0)
{
entry.oppNo = static_cast<unsigned>(-pairNoEW);
swapEW = 1;
}
else
{
entry.oppNo = static_cast<unsigned>(pairNoEW);
swapEW = 0;
}
if (res.declarer == VALET_NORTH || res.declarer == VALET_SOUTH)
{
decl = Hswap[swapNS][res.declarer == VALET_SOUTH];
leader = Hswap[swapEW][res.declarer == VALET_SOUTH];
}
else if (res.declarer == VALET_EAST || res.declarer == VALET_WEST)
{
decl = Hswap[swapEW][res.declarer == VALET_WEST];
leader = Hswap[swapNS][res.declarer == VALET_EAST];
}
else
{
decl = 0;
leader = 0;
assert(false);
}
}
示例2: SetPassout
void Hand::SetPassout(
const ResultType& res,
const float totalIMPs,
ValetEntryType& entry)
{
// Pass-out.
int pairNoNS = pairs.GetPairNumber(res.north, res.south);
assert(pairNoNS != 0);
if (pairNoNS < 0)
pairNoNS = -pairNoNS; // Doesn't matter for pass-out
int pairNoEW = pairs.GetPairNumber(res.east, res.west);
assert(pairNoEW != 0);
if (pairNoEW < 0)
pairNoEW = -pairNoEW; // Doesn't matter for pass-out
entry.pairNo = static_cast<unsigned>(pairNoNS);
entry.oppNo = static_cast<unsigned>(pairNoEW);
entry.overall = totalIMPs;
entry.bidScore = totalIMPs;
}