Making cppcheck even happier.

This commit is contained in:
lotodore
2010-10-28 08:04:36 +00:00
parent 74355c046d
commit edad47b7f4
11 changed files with 43 additions and 33 deletions
+5 -5
View File
@@ -30,7 +30,7 @@ CardsValue::~CardsValue()
{
}
int CardsValue::holeCardsClass(int one, int two) {
int CardsValue::holeCardsClass(int one, int two) const {
if((one-1)%13<(two-1)%13) {
int temp = one;
@@ -166,7 +166,7 @@ int CardsValue::holeCardsClass(int one, int two) {
}
int CardsValue::holeCardsToIntCode(int* cards) {
int CardsValue::holeCardsToIntCode(int* cards) const {
// Code der HoleCards ermitteln
if(cards[0]%13 == cards[1]%13) {
@@ -189,7 +189,7 @@ int CardsValue::holeCardsToIntCode(int* cards) {
}
int* intCodeToHoleCards(int code) {
int* CardsValue::intCodeToHoleCards(int code) const {
// one possibility !!!
@@ -207,7 +207,7 @@ int* intCodeToHoleCards(int code) {
}
int CardsValue::cardsValue(int* cards, int* position) {
int CardsValue::cardsValue(int* cards, int* position) const {
int array[7][3];
int j1, j2, j3, j4, j5, k1, k2, ktemp[3];
@@ -586,7 +586,7 @@ int array[7][3];
}
vector< vector<int> > CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards)
vector< vector<int> > CardsValue::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards) const
{
int i,j;
+5 -5
View File
@@ -34,13 +34,13 @@ public:
~CardsValue();
int holeCardsClass(int, int);
int cardsValue(int*, int*);
int holeCardsClass(int, int) const;
int cardsValue(int*, int*) const;
int holeCardsToIntCode(int*);
int* intCodeToHoleCards(int);
int holeCardsToIntCode(int*) const;
int* intCodeToHoleCards(int) const;
std::vector< std::vector<int> > calcCardsChance(GameState, int*, int*);
std::vector< std::vector<int> > calcCardsChance(GameState, int*, int*) const;
//int** showdown(GameState, int**, int);
};
+2 -5
View File
@@ -95,7 +95,6 @@ void LocalBeRo::run() {
if(!(myHand->getAllInCondition())) {
PlayerListIterator it_1, it_2;
size_t i;
// running player before smallBlind
bool formerRunningPlayerFound = false;
@@ -106,7 +105,7 @@ void LocalBeRo::run() {
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
}
for(i=0; i<myHand->getActivePlayerList()->size(); i++) {
for(size_t i=0; i<myHand->getActivePlayerList()->size(); i++) {
if(it_1 == myHand->getActivePlayerList()->begin()) it_1 = myHand->getActivePlayerList()->end();
it_1--;
@@ -165,8 +164,6 @@ void LocalBeRo::run() {
}
}
int i;
// prfen, ob aktuelle bero wirklich dran ist
if(!firstRound && allHighestSet) {
@@ -186,7 +183,7 @@ void LocalBeRo::run() {
myHand->getGuiInterface()->refreshSet();
myHand->getGuiInterface()->refreshCash();
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,PLAYER_ACTION_NONE); }
for(int i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { myHand->getGuiInterface()->refreshAction(i,PLAYER_ACTION_NONE); }
myHand->switchRounds();
}
+1 -2
View File
@@ -110,7 +110,6 @@ void LocalBeRoPreflop::run() {
}
int i;
bool allHighestSet = true;
PlayerListConstIterator it_c;
@@ -152,7 +151,7 @@ void LocalBeRoPreflop::run() {
getMyHand()->getGuiInterface()->refreshSet();
getMyHand()->getGuiInterface()->refreshCash();
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { getMyHand()->getGuiInterface()->refreshAction(i,PLAYER_ACTION_NONE); }
for(int i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { getMyHand()->getGuiInterface()->refreshAction(i,PLAYER_ACTION_NONE); }
getMyHand()->switchRounds();
}
+3 -2
View File
@@ -29,6 +29,7 @@ using namespace std;
LocalBoard::LocalBoard() : BoardInterface(), currentHand(0), pot(0), sets(0)
{
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
}
LocalBoard::~LocalBoard()
@@ -230,11 +231,11 @@ void LocalBoard::distributePot() {
if(pot!=0) LOG_ERROR(__FILE__ << " (" << __LINE__ << "): distributePot-ERROR: Pot = " << pot);
int sum = 0;
/*int sum = 0;
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
sum += (*it_c)->getMyCash();
}
}*/
}
void LocalBoard::determinePlayerNeedToShowCards() {
+11 -11
View File
@@ -4421,7 +4421,6 @@ void LocalPlayer::preflopEngine3() {
// cout << "nextID " << currentHand->getPlayerArray()[(myID+1)%5]->getMyID() << endl;
int raise = 0;
// Bauchgefhl (zufᅵlig)
int tempRand;
@@ -4450,7 +4449,8 @@ void LocalPlayer::preflopEngine3() {
else {
// RAISE --> wenn hohes Potential
if((potential >= 4 && 6 * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || bluff <= 6) {
// extrem hohes Potential --> groᅵr Raise
int raise = 0;
// extrem hohes Potential --> groᅵr Raise
if(potential>=6 || bluff <= 2) {
// bluff - raise
@@ -4654,8 +4654,6 @@ void LocalPlayer::flopEngine3() {
double percent = (countMy*1.0)/(countAll*1.0);
// cout << "Prozent: " << percent << endl;
int raise = 0;
// Bauchgefhl (zufᅵlig)
int tempRand;
Tools::getRandNumber((int)(percent*10.)-2,(int)(percent*10.)+2,1,&tempRand,0);
@@ -4718,7 +4716,9 @@ void LocalPlayer::flopEngine3() {
// RAISE --> wenn Potential besonders gut
if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 5 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) {
// bluff - raise
int raise = 0;
// bluff - raise
if(bluff <=5) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet();
// Betrag, der ber dem aktuell HighestSet gesetzt werden soll
else raise = ((potential - 2 ) / 2) * currentHand->getCurrentBeRo()->getHighestSet();
@@ -4820,8 +4820,6 @@ void LocalPlayer::turnEngine3() {
double percent = (countMy*1.0)/(countAll*1.0);
// cout << "Prozent: " << percent << endl;
int raise;
// Bauchgefhl (zufᅵlig)
int tempRand;
Tools::getRandNumber((int)(percent*10.)-2,(int)(percent*10.)+2,1,&tempRand,0);
@@ -4886,7 +4884,9 @@ void LocalPlayer::turnEngine3() {
// RAISE --> wenn Potential besonders gut
if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 4 && 3 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) {
// bluff - raise
int raise = 0;
// bluff - raise
if(bluff <= 4) raise = ((bluff+1)/2) * currentHand->getCurrentBeRo()->getHighestSet();
// Betrag, der ber dem aktuell HighestSet gesetzt werden soll
else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet();
@@ -4982,8 +4982,6 @@ void LocalPlayer::riverEngine3() {
double percent = (countMy*1.0)/(countAll*1.0);
// cout << "Prozent: " << percent << endl;
int raise;
// Bauchgefhl (zufᅵlig)
int tempRand;
Tools::getRandNumber((int)(percent*10.)-2,(int)(percent*10.)+2,1,&tempRand,0);
@@ -5048,7 +5046,9 @@ void LocalPlayer::riverEngine3() {
// RAISE --> wenn Potential besonders gut
if((potential >=4 && 2 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet()) || (bluff <= 2 && 4 * tempFold * currentHand->getSmallBlind() >= currentHand->getCurrentBeRo()->getHighestSet())) {
// bluff - raise
int raise = 0;
// bluff - raise
if(bluff <= 2 ) raise = bluff * currentHand->getCurrentBeRo()->getHighestSet();
// Betrag, der ber dem aktuell HighestSet gesetzt werden soll
else raise = ( potential - 3 ) * currentHand->getCurrentBeRo()->getHighestSet();
+3 -1
View File
@@ -20,7 +20,9 @@
#include "clientbero.h"
ClientBeRo::ClientBeRo(HandInterface* hi, int /*id*/, unsigned /*dP*/, int sB, GameState gS)
: BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(0), fullBetRule(false)
: BeRoInterface(), myBeRoID(gS), myHand(hi), highestCardsValue(0), smallBlindPositionId(0), bigBlindPositionId(0), currentPlayersTurnId(0),
firstRoundLastPlayersTurnId(0), highestSet(0), firstRound(true), smallBlindPosition(0), smallBlind(sB), minimumRaise(2*sB), fullBetRule(false),
lastActionPlayer(0)
{
}
@@ -26,6 +26,7 @@ using namespace std;
ClientBoard::ClientBoard()
: currentHand(0), pot(0), sets(0)
{
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
}
+9 -1
View File
@@ -23,8 +23,16 @@ using namespace std;
ClientPlayer::ClientPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type),
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0),
myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
lastMoneyWon(0), sBluff(0), sBluffStatus(false), myWinnerState(false)
{
myBestHandPosition[0] = myBestHandPosition[1] = myBestHandPosition[2] = myBestHandPosition[3] = myBestHandPosition[4] = 0;
myNiveau[0] = myNiveau[1] = myNiveau[2] = 0;
myCards[0] = myCards[1] = 0;
myAverageSets[0] = myAverageSets[1] = myAverageSets[2] = myAverageSets[3] = 0;
myAggressive[0] = myAggressive[1] = myAggressive[2] = myAggressive[3] = myAggressive[4] = myAggressive[5] = myAggressive[6] = false;
}