From 6dff34a5893aca3d60144fd3b07b849200c0d5aa Mon Sep 17 00:00:00 2001 From: lotodore Date: Tue, 13 Jan 2015 22:21:11 +0100 Subject: [PATCH] Remove asserts and make cppcheck happy. --- src/gui/qt/gametable/gametableimpl.cpp | 8 -------- src/gui/qt/gametable/myavatarlabel.cpp | 4 +--- src/net/common/clientstate.cpp | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 1a6aeacc..c2935257 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -875,7 +875,6 @@ void gameTableImpl::initGui(int speed) //set WindowTitle dynamically QString titleString = ""; - assert(myStartWindow->getSession()); if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) { GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId())); titleString = QString::fromUtf8(info.name.c_str())+" - "; @@ -938,7 +937,6 @@ void gameTableImpl::initGui(int speed) boost::shared_ptr gameTableImpl::getSession() { - assert(myStartWindow->getSession().get()); return myStartWindow->getSession(); } @@ -1959,8 +1957,6 @@ void gameTableImpl::meInAction() void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec) { - assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers()); - //beep for player 0 if(playerId) { timeoutLabelArray[playerId]->startTimeOutAnimation(timeoutSec, false); @@ -1971,7 +1967,6 @@ void gameTableImpl::startTimeoutAnimation(int playerId, int timeoutSec) void gameTableImpl::stopTimeoutAnimation(int playerId) { - assert(playerId >= 0 && playerId < myStartWindow->getSession()->getCurrentGame()->getStartQuantityPlayers()); timeoutLabelArray[playerId]->stopTimeOutAnimation(); } @@ -3833,11 +3828,9 @@ void gameTableImpl::leaveCurrentNetworkGame() if(!myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(BACKTO_LOBBY_QUESTION)) { - assert(myStartWindow->getSession()); myStartWindow->getSession()->sendLeaveCurrentGame(); } else { if (myUniversalMessageDialog->exec(BACKTO_LOBBY_QUESTION, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) { - assert(myStartWindow->getSession()); myStartWindow->getSession()->sendLeaveCurrentGame(); } } @@ -4473,7 +4466,6 @@ void gameTableImpl::checkActionLabelPosition() void gameTableImpl::refreshSpectatorsDisplay() { - assert(myStartWindow->getSession()); GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId())); if(!info.spectatorsDuringGame.empty()) { spectatorIcon->show(); diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index bff9801c..dec3fefe 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -71,9 +71,7 @@ MyAvatarLabel::~MyAvatarLabel() void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { - - assert(myW->getSession()->getCurrentGame()); - if (myW->getSession()->isNetworkClientRunning()) { + if (myW->getSession()->getCurrentGame() && myW->getSession()->isNetworkClientRunning()) { boost::shared_ptr humanPlayer = myW->getSession()->getCurrentGame()->getSeatsList()->front(); //only active players are allowed to start a vote diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 7e8f04b1..ec159a50 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -599,7 +599,6 @@ AbstractClientStateReceiving::HandleLobbyMsg(boost::shared_ptr cli // Chat message - display it in the GUI. const ChatMessage &netMessage = lobbyMsg.chatmessage(); - string playerName; if (netMessage.chattype() == ChatMessage::chatTypeBroadcast) { client->GetCallback().SignalNetClientGameChatMsg("(global notice)", netMessage.chattext()); client->GetCallback().SignalNetClientLobbyChatMsg("(global notice)", netMessage.chattext());