diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 5a810e43d..c5d654a87 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -5,6 +5,7 @@ #include "JGE.h" #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/CardGui.h" #include "../include/ManaCostHybrid.h" #include "../include/Subtypes.h" @@ -311,13 +312,10 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){ } if(card->data->types.size()) s += _(Subtypes::subtypesList->find(card->data->types[0])); -#ifdef _DEBUG - else{ - char buf[2048]; - sprintf(buf, "Typeless card: %s %s (%i)\n", setlist[card->setId].c_str(), card->data->getName().c_str(), card->getId()); - OutputDebugString(buf); - } -#endif + else + { + DebugTrace("Typeless card: " << setlist[card->setId].c_str() << card->data->getName() << card->getId()); + } font->DrawString(s.c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ); } @@ -514,13 +512,10 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) { } if(card->data->types.size()) s += _(Subtypes::subtypesList->find(card->data->types[0])); -#ifdef _DEBUG - else{ - char buf[2048]; - sprintf(buf, "Typeless card: %s %s (%i)\n", setlist[card->setId].c_str(), card->data->getName().c_str(), card->getId()); - OutputDebugString(buf); - } -#endif + else + { + DebugTrace("Typeless card: " << setlist[card->setId].c_str() << card->data->getName() << card->getId()); + } font->DrawString(s.c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ); } diff --git a/projects/mtg/src/StoryFlow.cpp b/projects/mtg/src/StoryFlow.cpp index aecbc72ee..f380d2c78 100644 --- a/projects/mtg/src/StoryFlow.cpp +++ b/projects/mtg/src/StoryFlow.cpp @@ -1,6 +1,7 @@ #include "../include/StoryFlow.h" #include "../include/MTGDefinitions.h" #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/WResourceManager.h" #include "../include/AIPlayer.h" #include "../include/Rules.h" @@ -536,14 +537,11 @@ bool StoryFlow::parse(string path) if (strcmp(element->Value(), "page")==0) { string id = element->Attribute("id"); - OutputDebugString("\nparsing "); - OutputDebugString(id.c_str()); - OutputDebugString("...\n"); + DebugTrace("parsing " << id << "..."); StoryPage * sp = loadPage(element); pages[id] = sp; if (!currentPageId.size()) gotoPage(id); - OutputDebugString("OK\n"); } else { //Error diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index d06702a2c..60bf4a1d9 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -86,10 +86,7 @@ int TestSuiteAI::Act(float dt){ string action = suite->getNextAction(); g->mLayers->stackLayer()->Dump(); // DamageResolverLayer * drl = g->mLayers->combatLayer(); - OutputDebugString("TESTSUITE command:"); - OutputDebugString(action.c_str()); - OutputDebugString("\n"); - + DebugTrace("TESTSUITE command: " << action); if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this){ if(action.compare("no") != 0 && action.compare("yes") != 0){ @@ -111,12 +108,12 @@ int TestSuiteAI::Act(float dt){ g->userRequestNextGamePhase(); } else if (action.compare("human")==0){ - OutputDebugString("TESTSUITE You have control"); + DebugTrace("TESTSUITE You have control"); playMode = MODE_HUMAN; return 1; } else if (action.compare("ai")==0){ - OutputDebugString("TESTSUITE Switching to AI"); + DebugTrace("TESTSUITE Switching to AI"); playMode = MODE_AI; return 1; } @@ -134,7 +131,7 @@ int TestSuiteAI::Act(float dt){ if (g->mLayers->stackLayer()->askIfWishesToInterrupt == this) g->mLayers->stackLayer()->cancelInterruptOffer(); }else if(action.find("choice ")!=string::npos){ - OutputDebugString("TESTSUITE choice !!!\n"); + DebugTrace("TESTSUITE choice !!!"); int choice = atoi(action.substr(action.find("choice ") + 7).c_str()); g->mLayers->actionLayer()->doReactTo(choice); }else if(action.find(" -momir- ")!=string::npos){ @@ -153,9 +150,7 @@ int TestSuiteAI::Act(float dt){ int mtgid = Rules::getMTGId(action); Interruptible * toInterrupt = NULL; if (mtgid){ - char buffe[512]; - sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid); - OutputDebugString(buffe); + DebugTrace("TESTSUITE CARD ID:" << mtgid); toInterrupt = suite->getActionByMTGId(mtgid); } @@ -166,9 +161,7 @@ int TestSuiteAI::Act(float dt){ MTGCardInstance * card = getCard(action); if (card) { - OutputDebugString("TESTSUITE Clicking ON: "); - OutputDebugString(card->name.c_str()); - OutputDebugString("\n"); + DebugTrace("TESTSUITE Clicking ON: " << card->name); card->currentZone->needShuffle = true; //mimic library shuffle g->cardClick(card,card); g->forceShuffleLibraries(); //mimic library shuffle @@ -288,7 +281,7 @@ void TestSuite::initGame(){ } //Put the GameObserver in the initial state GameObserver * g = GameObserver::GetInstance(); - OutputDebugString("TESTSUITE Init Game\n"); + DebugTrace("TESTSUITE Init Game"); g->phaseRing->goToPhase(initState.phase, g->players[0]); g->currentGamePhase = initState.phase; for (int i = 0; i < 2; i++){ @@ -320,7 +313,7 @@ void TestSuite::initGame(){ } } } - OutputDebugString("TESTUITE Init Game Done !\n"); + DebugTrace("TESTUITE Init Game Done !"); } int TestSuite::Log(const char * text){ ofstream file (RESPATH"/test/results.html",ios_base::app); @@ -329,10 +322,8 @@ int TestSuite::Log(const char * text){ file << "\n"; file.close(); } -#if defined (WIN32) || defined (LINUX) - OutputDebugString(text); - OutputDebugString("\n"); -#endif + + DebugTrace(text); return 1; }