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" 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/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"); 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 d44d04f44..20580dc14 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -336,13 +336,22 @@ 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()) { - DebugTrace("loadPrimitives:WARNING:Primitives folder is missing"); return; } @@ -355,7 +364,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; @@ -382,7 +391,10 @@ 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; + } string 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)