diff --git a/mk/windoze/Glest.suo b/mk/windoze/Glest.suo index ea2996b67..8e974cbdd 100755 Binary files a/mk/windoze/Glest.suo and b/mk/windoze/Glest.suo differ diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index e966b5af7..b7abf9560 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -326,6 +326,8 @@ void Game::init() logger.add("Waiting for network", true); networkManager.getGameNetworkInterface()->waitUntilReady(&checksum); + std::string worldLog = world.DumpWorldToLog(true); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Starting music stream\n",__FILE__,__FUNCTION__); logger.add("Starting music stream", true); StrSound *gameMusic= world.getThisFaction()->getType()->getMusic(); diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index e35292bbe..bbcf17b93 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -98,6 +98,7 @@ public: const UpgradeManager *getUpgradeManager() const {return &upgradeManager;} const Texture2D *getTexture() const {return texture;} int getStartLocationIndex() const {return startLocationIndex;} + bool getThisFaction() const {return thisFaction;} //upgrades void startUpgrade(const UpgradeType *ut); diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 74dcc3449..f0423c53f 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -22,6 +22,7 @@ #include "sound_renderer.h" #include "game_settings.h" #include "cache_manager.h" +#include #include "leak_dumper.h" using namespace Shared::Graphics; @@ -800,40 +801,60 @@ void World::computeFow(){ } } -std::string World::DumpWorldToLog() const { +std::string World::DumpWorldToLog(bool consoleBasicInfoOnly) const { + string debugWorldLogFile = Config::getInstance().getString("DebugWorldLogFile","debugWorld.log"); - if(getGameReadWritePath() != "") { - debugWorldLogFile = getGameReadWritePath() + debugWorldLogFile; - } - - std::ofstream logFile; - logFile.open(debugWorldLogFile.c_str(), ios_base::out | ios_base::trunc); - - logFile << "World debug information:" << std::endl; - logFile << "========================" << std::endl; - - //factions (and their related info) - for(int i = 0; i < getFactionCount(); ++i) { - logFile << "Faction detail for index: " << i << std::endl; - logFile << "--------------------------" << std::endl; - logFile << getFaction(i)->toString() << std::endl; + if(getGameReadWritePath() != "") { + debugWorldLogFile = getGameReadWritePath() + debugWorldLogFile; } - //undertake the dead - logFile << "Undertake stats:" << std::endl; - for(int i = 0; i < getFactionCount(); ++i){ - logFile << "Faction: " << getFaction(i)->getType()->getName() << std::endl; - int unitCount = getFaction(i)->getUnitCount(); - for(int j= unitCount - 1; j >= 0; j--){ - Unit *unit= getFaction(i)->getUnit(j); - if(unit->getToBeUndertaken()) { - logFile << "Undertake unit index = " << j << unit->getFullName() << std::endl; - } + if(consoleBasicInfoOnly == true) { + std::cout << "World debug information:" << std::endl; + std::cout << "========================" << std::endl; + + //factions (and their related info) + for(int i = 0; i < getFactionCount(); ++i) { + std::cout << "Faction detail for index: " << i << std::endl; + std::cout << "--------------------------" << std::endl; + + std::cout << "FactionName = " << getFaction(i)->getType()->getName() << std::endl; + std::cout << "FactionIndex = " << intToStr(getFaction(i)->getIndex()) << std::endl; + std::cout << "teamIndex = " << intToStr(getFaction(i)->getTeam()) << std::endl; + std::cout << "startLocationIndex = " << intToStr(getFaction(i)->getStartLocationIndex()) << std::endl; + std::cout << "thisFaction = " << intToStr(getFaction(i)->getThisFaction()) << std::endl; + std::cout << "control = " << intToStr(getFaction(i)->getControlType()) << std::endl; } } + else { - logFile.close(); + std::ofstream logFile; + logFile.open(debugWorldLogFile.c_str(), ios_base::out | ios_base::trunc); + logFile << "World debug information:" << std::endl; + logFile << "========================" << std::endl; + + //factions (and their related info) + for(int i = 0; i < getFactionCount(); ++i) { + logFile << "Faction detail for index: " << i << std::endl; + logFile << "--------------------------" << std::endl; + logFile << getFaction(i)->toString() << std::endl; + } + + //undertake the dead + logFile << "Undertake stats:" << std::endl; + for(int i = 0; i < getFactionCount(); ++i){ + logFile << "Faction: " << getFaction(i)->getType()->getName() << std::endl; + int unitCount = getFaction(i)->getUnitCount(); + for(int j= unitCount - 1; j >= 0; j--){ + Unit *unit= getFaction(i)->getUnit(j); + if(unit->getToBeUndertaken()) { + logFile << "Undertake unit index = " << j << unit->getFullName() << std::endl; + } + } + } + + logFile.close(); + } return debugWorldLogFile; } diff --git a/source/glest_game/world/world.h b/source/glest_game/world/world.h index fef0a3535..d0e1cc536 100644 --- a/source/glest_game/world/world.h +++ b/source/glest_game/world/world.h @@ -153,7 +153,7 @@ public: Game * getGame() { return game; } void setFogOfWar(bool value); - std::string DumpWorldToLog() const; + std::string DumpWorldToLog(bool consoleBasicInfoOnly = false) const; private: