本文整理汇总了C++中Money::Increment方法的典型用法代码示例。如果您正苦于以下问题:C++ Money::Increment方法的具体用法?C++ Money::Increment怎么用?C++ Money::Increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Money
的用法示例。
在下文中一共展示了Money::Increment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MethodTakeDownAfterHits
bool Wager::MethodTakeDownAfterHits(Money &cMoney, const Table &cTable, std::list<Bet> &lBets, const int nTimes)
{
BetModificationSetup(cTable, lBets);
if (m_bWon) ++m_nBetModCounter;
// If a bet won and counter is less than or equal to nTimes, Press the bet.
// 1) Loop through bets, find those that are modifiable and have won.
// 2) Make a new bet at the same wager.
// 3) Set their state to Unresolved
if (m_bWon)
{
if (m_nBetModCounter <= nTimes)
{
for (std::list<Bet>::iterator it = lBets.begin(); it != lBets.end(); ++it)
{
if (it->Modifiable() && it->Won())
{
cMoney.Decrement(it->Wager());
it->SetUnresolved();
}
}
}
// Else remove all modifiable unresolved bets and reset thge counter
else
{
for (std::list<Bet>::iterator it = lBets.begin(); it != lBets.end(); ++it)
{
if (it->Modifiable() && !it->Resolved())
{
cMoney.Increment(it->Wager());
it->SetReturned();
}
}
m_nBetModCounter = 0;
}
}
return (false);
}
示例2: MethodClassicRegression
bool Wager::MethodClassicRegression(Money &cMoney, const Table &cTable, std::list<Bet> &lBets)
{
bool bStopMakingBets = false;
BetModificationSetup(cTable, lBets);
if (m_bWon) ++m_nBetModCounter;
// If a bet won and counter is 1, a this is our first regression.
// 1) Loop through bets, find those that can be taken down but are not
// lost.
// 2) Reduce their wager amount by half, if possible
// 3) Set their state to Unresolved
int nOldWager = 0;
int nNewWager = 0;
if (m_bWon && m_nBetModCounter == 1)
{
for (std::list<Bet>::iterator it = lBets.begin(); it != lBets.end(); ++it)
{
// If bet is modifiable
if (it->Modifiable())
{
// If bet won or is unresolved
if (it->Won() || !it->Resolved())
{
// Calculate new wager amount
nOldWager = it->Wager();
if (nOldWager >= m_nStandardWager * 2)
{
nNewWager = it->Wager() / 2;
}
else
{
nNewWager = m_nStandardWager;
}
// If won, make a new bet at half the original wager
if (it->Won())
{
it->SetWager(nNewWager);
cMoney.Decrement(nNewWager);
it->SetUnresolved();
}
// If not resolved, reduce current wager to half the
// original wager
else if (!it->Resolved())
{
it->SetWager(nNewWager);
cMoney.Increment(nOldWager - nNewWager);
it->SetUnresolved();
}
}
}
}
}
// If a bet won and counter is 2, this is our second regression.
// 1) Loop through bets, find those that can be taken down and are not
// resolved.
// 2) Reduce their wager to zero
// 3) Set their state to Returned
// 4) Return true to stop making further bets, until a new qualification is achieved
if (m_bWon && m_nBetModCounter == 2)
{
for (std::list<Bet>::iterator it = lBets.begin(); it != lBets.end(); ++it)
{
if (it->Modifiable())
{
if (!it->Resolved())
{
cMoney.Increment(it->Wager());
it->SetReturned();
}
}
}
bStopMakingBets = true;
}
return (bStopMakingBets);
}