Commit 12c29cde authored by Julian Helfferich's avatar Julian Helfferich

Fix Coverity #76275: Uninitialized pointer

The pointer mpGame in GamePlayerInterface was not initialized in the
constructor.

I noticed that both childs of GamePlayerInterface -- KBlocksDummyAI and
KBlocksAIPlayer -- redeclare and hide mpGame instead of using the
parent class member.

I have removed the duplicate members in the child classes and initialize
the pointer with nullptr.
parent 05ebfcbb
......@@ -49,7 +49,6 @@ KBlocksAIPlayer::KBlocksAIPlayer(string name)
mAIStarted = false;
mAIPaused = false;
mpGame = 0;
mpAIField = 0;
mpCurPiece = 0;
mpNextPiece = 0;
......
......@@ -48,7 +48,6 @@ private:
bool mAIPaused;
// Phase I - State Update
SingleGameInterface *mpGame;
KBlocksField *mpAIField;
KBlocksPiece *mpCurPiece;
KBlocksPiece *mpNextPiece;
......
......@@ -31,7 +31,7 @@ typedef std::list<KBlocks_Player_Action> GamePlayer_ActionList;
class GamePlayerInterface
{
public:
GamePlayerInterface() {};
GamePlayerInterface() : mpGame(nullptr) {};
virtual ~GamePlayerInterface() {};
public:
......
......@@ -13,7 +13,6 @@
KBlocksDummyAI::KBlocksDummyAI()
{
mpGame = 0;
mPauseFlag = false;
mFieldWidth = 0;
......
......@@ -27,7 +27,6 @@ public:
void think(GamePlayer_ActionList *actionList);
protected:
SingleGameInterface *mpGame;
bool mPauseFlag;
int mFieldWidth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment