From 8013d09e4fc051a02dace6738cf7ae41e664ab2c Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 20:30:33 +0100 Subject: [PATCH 1/6] Reactivated wagic console in travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index be4e4dc42..1ff1dbd72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: cpp -script: "qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug && make -j 8" +script: "qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug && make -j 8 && ./wagic" From 74280aef1daadb08086e2aca7eaaf5bfbfba5e7d Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 20:50:34 +0100 Subject: [PATCH 2/6] Added some traces in the primitives and sets loading. --- projects/mtg/src/MTGDeck.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index d44d04f44..a554c03a1 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -342,7 +342,6 @@ void MTGAllCards::loadFolder(const string& folder, const string& filename ) if (!files.size()) { - DebugTrace("loadPrimitives:WARNING:Primitives folder is missing"); return; } @@ -382,8 +381,12 @@ int MTGAllCards::load(const char * config_file, const char * set_name, int) std::string contents; izfstream file; if (!JFileSystem::GetInstance()->openForRead(file, config_file)) + { + DebugTrace("MTGAllCards::load: error loading: " << config_file); return total_cards; + } + DebugTrace("MTGAllCards::load: loading: " << config_file); string s; while (getline(file,s)) From dac31994b69f659ee98a23c1f546a1353a6c53a1 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 21:44:23 +0100 Subject: [PATCH 3/6] Adding traces for important directories. --- JGE/src/JFileSystem.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/JGE/src/JFileSystem.cpp b/JGE/src/JFileSystem.cpp index 659f09408..3948dc4cc 100644 --- a/JGE/src/JFileSystem.cpp +++ b/JGE/src/JFileSystem.cpp @@ -16,9 +16,7 @@ User folder is the only one that is really needed to guarantee both read and wri The content that users should not be touching. */ -#if defined(ANDROID) -#include "../../include/PrecompiledHeader.h" -#endif +#include "PrecompiledHeader.h" #ifdef WIN32 #pragma warning(disable : 4786) @@ -125,13 +123,18 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath) DebugTrace("User path " << userPath); #elif defined (QT_CONFIG) - QDir dir(QDir::homePath()); - dir.cd(USERDIR); QDir sysDir("projects/mtg/bin/Res"); + QDir dir(QDir::homePath()); + dir.mkdir(USERDIR); + dir.cd(USERDIR); userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString(); systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString(); + + DebugTrace("User path " << userPath); + DebugTrace("System path " << systemPath); + DebugTrace("Current path " << QDir::currentPath().toStdString()); #else //Find the Res.txt file and matching Res folders for backwards compatibility ifstream mfile("Res.txt"); From f6c47b85e3fb1015c21e00e71604a6fd2ae917e4 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 22:02:43 +0100 Subject: [PATCH 4/6] More debug --- projects/mtg/src/MTGDeck.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index a554c03a1..e441f2ea1 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -347,6 +347,7 @@ void MTGAllCards::loadFolder(const string& folder, const string& filename ) for (size_t i = 0; i < files.size(); ++i) { + DebugTrace("MTGAllCards::loadFolder: checking folder" << folder << " file " << files[i]); string afile = folder; afile.append(files[i]); From 784d127a6ec6adf0fac2d8eadf34dc63111619bf Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 22:28:09 +0100 Subject: [PATCH 5/6] I think I got it ... messy / not appearing at the end of folders in the travis linux where it appears fine on mine :( --- projects/mtg/src/MTGDeck.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index e441f2ea1..c3a5ed55b 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -336,8 +336,18 @@ void MTGAllCards::init() initCounters(); } -void MTGAllCards::loadFolder(const string& folder, const string& filename ) +void MTGAllCards::loadFolder(const string& infolder, const string& filename ) { + string folder = infolder; + + // Make sure the base paths finish with a '/' or a '\' + if (! folder.empty()) { + string::iterator c = folder.end();//userPath.at(userPath.size()-1); + c--; + if ((*c != '/') && (*c != '\\')) + folder += '/'; + } + vector files = JFileSystem::GetInstance()->scanfolder(folder); if (!files.size()) @@ -355,7 +365,7 @@ void MTGAllCards::loadFolder(const string& folder, const string& filename ) continue; if(JFileSystem::GetInstance()->DirExists(afile)) - loadFolder(string(afile).c_str(), filename); + loadFolder(afile, filename); if (!JFileSystem::GetInstance()->FileExists(afile)) continue; From 017f6dd1eddaa78fd5b4cd188c6a9e21674a421e Mon Sep 17 00:00:00 2001 From: xawotihs Date: Wed, 30 Oct 2013 22:58:04 +0100 Subject: [PATCH 6/6] Deactivated part of the traces outputted by the testsuite to make Travis happy. --- JGE/include/DebugRoutines.h | 2 +- projects/mtg/src/GameObserver.cpp | 4 ++-- projects/mtg/src/MTGDeck.cpp | 2 -- projects/mtg/src/TestSuiteAI.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/JGE/include/DebugRoutines.h b/JGE/include/DebugRoutines.h index 5fe025a07..944d4e7a1 100644 --- a/JGE/include/DebugRoutines.h +++ b/JGE/include/DebugRoutines.h @@ -32,7 +32,7 @@ std::string ToHex(T* pointer) #define DebugTrace(inString) \ { \ std::ostringstream stream; \ - stream << inString << std::endl; \ + stream << inString; \ qDebug("%s", stream.str().c_str()); \ } #elif defined (ANDROID) diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 8a851acc1..b7dcda29c 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -383,8 +383,8 @@ void GameObserver::resetStartupGame() startupGameSerialized = ""; stream << *this; startupGameSerialized = stream.str(); - DebugTrace("startGame\n"); - DebugTrace(startupGameSerialized); +// DebugTrace("startGame\n"); +// DebugTrace(startupGameSerialized); } void GameObserver::startGame(GameType gtype, Rules * rules) diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index c3a5ed55b..20580dc14 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -357,7 +357,6 @@ void MTGAllCards::loadFolder(const string& infolder, const string& filename ) for (size_t i = 0; i < files.size(); ++i) { - DebugTrace("MTGAllCards::loadFolder: checking folder" << folder << " file " << files[i]); string afile = folder; afile.append(files[i]); @@ -397,7 +396,6 @@ int MTGAllCards::load(const char * config_file, const char * set_name, int) return total_cards; } - DebugTrace("MTGAllCards::load: loading: " << config_file); string s; while (getline(file,s)) diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index 98b8c8106..80c930ef8 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -114,7 +114,7 @@ int TestSuiteAI::Act(float) timer = 0; string action = suite->getNextAction(); - observer->mLayers->stackLayer()->Dump(); +// observer->mLayers->stackLayer()->Dump(); DebugTrace("TESTSUITE command: " << action); if (observer->mLayers->stackLayer()->askIfWishesToInterrupt == this)