From 5595c0d3d8cdabecf304fe7639869ae6ab8922d3 Mon Sep 17 00:00:00 2001 From: "wrenczes@gmail.com" Date: Wed, 6 Oct 2010 10:45:29 +0000 Subject: [PATCH] More OutputDebugString() -> DebugTrace changes. --- projects/mtg/include/DebugRoutines.h | 2 ++ projects/mtg/src/GameStateMenu.cpp | 20 ++++++++------------ projects/mtg/src/ManaCost.cpp | 13 +++++-------- projects/mtg/src/PhaseRing.cpp | 12 ++++++------ 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/projects/mtg/include/DebugRoutines.h b/projects/mtg/include/DebugRoutines.h index 62d2a724d..951c9b204 100644 --- a/projects/mtg/include/DebugRoutines.h +++ b/projects/mtg/include/DebugRoutines.h @@ -4,6 +4,8 @@ // dirty, but I get OS header includes this way #include "JGE.h" +#include "../include/config.h" + #include #include #include diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index 193f7842d..b4b99373d 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -5,6 +5,7 @@ #include #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/GameStateMenu.h" #include "../include/MenuItem.h" #include "../include/GameOptions.h" @@ -415,12 +416,10 @@ void GameStateMenu::Update(float dt) if (!nextDirectory(RESPATH"/sets/","_cards.dat")){ //Remove temporary translations Translator::GetInstance()->tempValues.clear(); - //Debug -#ifdef _DEBUG - char buf[4096]; - sprintf(buf, "\n==\nTotal MTGCard: %lu\nTotal CardPrimitives: %lu\n==\n", (long unsigned)mParent->collection->collection.size(), (long unsigned)mParent->collection->primitives.size()); - OutputDebugString(buf); -#endif + + DebugTrace(std::endl << "==" << std::endl << + "Total MTGCards: " << mParent->collection->collection.size() << std::endl << + "Total CardPrimitives: " << mParent->collection->primitives.size() << std::endl << "=="); //Force default, if necessary. if(options[Options::ACTIVE_PROFILE].str == "") @@ -635,12 +634,9 @@ void GameStateMenu::Render() void GameStateMenu::ButtonPressed(int controllerId, int controlId) { -WFont * mFont = resources.GetWFont(Constants::MENU_FONT); -#if defined (WIN32) || defined (LINUX) - char buf[4096]; - sprintf(buf, "cnotrollerId: %i", controllerId); - OutputDebugString(buf); -#endif + WFont * mFont = resources.GetWFont(Constants::MENU_FONT); + + DebugTrace("GameStateMenu: controllerId " << controllerId << " selected"); switch (controllerId){ case MENU_LANGUAGE_SELECTION: setLang(controlId); diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index bce886c0d..5e955e980 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -1,4 +1,5 @@ #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/ManaCost.h" #include "../include/ManaCostHybrid.h" #include "../include/ExtraCost.h" @@ -490,22 +491,18 @@ ManaCost * ManaCost::Diff(ManaCost * _cost){ #ifdef WIN32 void ManaCost::Dump(){ - char buf[4096]; - OutputDebugString("\n===ManaCost===\n"); + DebugTrace("\n===ManaCost===\n"); for (int i=0; i<= Constants::MTG_NB_COLORS; i++){ if (cost[i]) { - sprintf(buf, "%c:%i - ", Constants::MTGColorChars[i],cost[i]); - OutputDebugString(buf); + DebugTrace(Constants::MTGColorChars[i] << ":" << cost[i] << " - "); } } for (unsigned int i=0; i< nbhybrids; i++){ ManaCostHybrid * h = hybrids[i]; - - sprintf(buf, "H:{%c:%i}/{%c:%i}", Constants::MTGColorChars[h->color1], h->value1, Constants::MTGColorChars[h->color2], h->value2); - OutputDebugString(buf); + DebugTrace("H:{" << Constants::MTGColorChars[h->color1] << ":" << h->value1 << "}/{" << Constants::MTGColorChars[h->color2] << ":" << h->value2 << "}"); } - OutputDebugString("\n=============\n"); + DebugTrace("\n=============\n"); } #endif diff --git a/projects/mtg/src/PhaseRing.cpp b/projects/mtg/src/PhaseRing.cpp index 695a20905..5294780e1 100644 --- a/projects/mtg/src/PhaseRing.cpp +++ b/projects/mtg/src/PhaseRing.cpp @@ -1,3 +1,4 @@ +#include "../include/DebugRoutines.h" #include "../include/PhaseRing.h" #include "../include/MTGDefinitions.h" #include "../include/Player.h" @@ -19,9 +20,8 @@ int PhaseRing::phaseStrToInt(string s){ if (s.compare("secondmain") == 0)return Constants::MTG_PHASE_SECONDMAIN; if (s.compare("endofturn") == 0)return Constants::MTG_PHASE_ENDOFTURN; if (s.compare("cleanup") == 0)return Constants::MTG_PHASE_CLEANUP; - OutputDebugString("PHASERING: Unknown Phase name:"); - OutputDebugString(s.c_str()); - OutputDebugString("\n"); + DebugTrace("PHASERING: Unknown Phase name: " << s); + return Constants::MTG_PHASE_FIRSTMAIN; } @@ -90,9 +90,9 @@ Phase * PhaseRing::forward(bool sendEvents){ Phase * PhaseRing::goToPhase(int id, Player * player, bool sendEvents){ Phase * currentPhase = *current; while(currentPhase->id !=id || currentPhase->player != player){ //Dangerous, risk for inifinte loop ! -#ifdef WIN32 - OutputDebugString("goto"); -#endif + + DebugTrace("PhasingRing: goToPhase called, current phase is " << phaseName(currentPhase->id)); + currentPhase = forward(sendEvents); } return currentPhase;