A
A_StClaire_
hi,
I have a singleton class called 'Evaluation' which is a utility class
used to determine the strength of a poker hand. two members of
'Evaluation' are highCard and lowCard, two objects of user-defined
class Card.
for some reason I am having null reference problems at the bottom of
the function excerpt shown below:
int Evaluation::AppraiseHoleCards(Hand targetHand)
{
const int regularPairBonus = 3;
const int sameSuitBonus = 3;
const int lowJackBonus = 5;
const int lowQueenBonus = 7;
const int lowKingBonus = 9;
const int facePairBonusFactor = 2;
// potential bonuses in order of increasing significance
int holeCardsStrength = 0;
vector<Card> tempVector(targetHand.GetHoleCards());
SortCardVector(tempVector);
highCard = tempVector.back();
lowCard = tempVector.front();
GetHoleCards() returns the vector of (two) Card objects contained in
targetHand.
basically I am using a for loop to put all hands in the game through
the function above, which I call like this:
Evaluation::Instance().AppraiseHoleCards(targetPlayer.GetHand())
what happens is the first hand is evaluated normally but the program
crashes on the second hand, citing a Null Reference Exception at the
lines
highCard = tempVector.back();
lowCard = tempVector.front();
anyone see what I'm doing wrong?
thx a lot
I have a singleton class called 'Evaluation' which is a utility class
used to determine the strength of a poker hand. two members of
'Evaluation' are highCard and lowCard, two objects of user-defined
class Card.
for some reason I am having null reference problems at the bottom of
the function excerpt shown below:
int Evaluation::AppraiseHoleCards(Hand targetHand)
{
const int regularPairBonus = 3;
const int sameSuitBonus = 3;
const int lowJackBonus = 5;
const int lowQueenBonus = 7;
const int lowKingBonus = 9;
const int facePairBonusFactor = 2;
// potential bonuses in order of increasing significance
int holeCardsStrength = 0;
vector<Card> tempVector(targetHand.GetHoleCards());
SortCardVector(tempVector);
highCard = tempVector.back();
lowCard = tempVector.front();
GetHoleCards() returns the vector of (two) Card objects contained in
targetHand.
basically I am using a for loop to put all hands in the game through
the function above, which I call like this:
Evaluation::Instance().AppraiseHoleCards(targetPlayer.GetHand())
what happens is the first hand is evaluated normally but the program
crashes on the second hand, citing a Null Reference Exception at the
lines
highCard = tempVector.back();
lowCard = tempVector.front();
anyone see what I'm doing wrong?
thx a lot