Cleaned up some debugging code
This commit is contained in:
parent
7e17865c2a
commit
8550b0f8f1
17
debug.h
17
debug.h
|
@ -2,11 +2,24 @@
|
|||
#define _DEBUG_H_
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
using std::fprintf;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::fprintf;
|
||||
#endif
|
||||
using std::string;
|
||||
|
||||
#endif
|
||||
|
||||
inline void debug(string msg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cerr << "debug: " << msg << endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
4
game.cpp
4
game.cpp
|
@ -27,9 +27,7 @@ bool Game::init()
|
|||
|
||||
if (background == NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "debug: Game::init(): error: Couldn't load background image\n";
|
||||
#endif
|
||||
debug("Game::init(): error: Couldn't load background image");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -225,17 +225,13 @@ bool GameData::endgame()
|
|||
if (get_colour(PLAYER1_COLOUR).empty())
|
||||
{
|
||||
player = WIN2;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "debug: Gamedata::endgame(): player 2 wins\n");
|
||||
#endif
|
||||
debug("Gamedata::endgame(): player 2 wins\n");
|
||||
return true;
|
||||
}
|
||||
if (get_colour(PLAYER2_COLOUR).empty())
|
||||
{
|
||||
player = WIN1;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "debug: Gamedata::endgame(): player 1 wins\n");
|
||||
#endif
|
||||
debug("Gamedata::endgame(): player 1 wins\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,7 @@ bool TitleScreen::init()
|
|||
|
||||
if (background == NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "debug: TitleScreen::init(): error: Couldn't load background image\n";
|
||||
#endif
|
||||
debug("TitleScreen::init(): error: Couldn't load background image");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,9 +33,7 @@ bool TitleScreen::init()
|
|||
|
||||
if (title_banner == NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "debug: TitleScreen::init(): error: Couldn't load title banner\n";
|
||||
#endif
|
||||
debug("TitleScreen::init(): error: Couldn't load title banner");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user