- added game start debug output to console to show basic faction info

This commit is contained in:
Mark Vejvoda
2010-05-20 20:19:34 +00:00
parent 5f2aabb6c3
commit 5879e87297
5 changed files with 52 additions and 28 deletions

Binary file not shown.

View File

@@ -326,6 +326,8 @@ void Game::init()
logger.add("Waiting for network", true); logger.add("Waiting for network", true);
networkManager.getGameNetworkInterface()->waitUntilReady(&checksum); networkManager.getGameNetworkInterface()->waitUntilReady(&checksum);
std::string worldLog = world.DumpWorldToLog(true);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Starting music stream\n",__FILE__,__FUNCTION__); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Starting music stream\n",__FILE__,__FUNCTION__);
logger.add("Starting music stream", true); logger.add("Starting music stream", true);
StrSound *gameMusic= world.getThisFaction()->getType()->getMusic(); StrSound *gameMusic= world.getThisFaction()->getType()->getMusic();

View File

@@ -98,6 +98,7 @@ public:
const UpgradeManager *getUpgradeManager() const {return &upgradeManager;} const UpgradeManager *getUpgradeManager() const {return &upgradeManager;}
const Texture2D *getTexture() const {return texture;} const Texture2D *getTexture() const {return texture;}
int getStartLocationIndex() const {return startLocationIndex;} int getStartLocationIndex() const {return startLocationIndex;}
bool getThisFaction() const {return thisFaction;}
//upgrades //upgrades
void startUpgrade(const UpgradeType *ut); void startUpgrade(const UpgradeType *ut);

View File

@@ -22,6 +22,7 @@
#include "sound_renderer.h" #include "sound_renderer.h"
#include "game_settings.h" #include "game_settings.h"
#include "cache_manager.h" #include "cache_manager.h"
#include <iostream>
#include "leak_dumper.h" #include "leak_dumper.h"
using namespace Shared::Graphics; using namespace Shared::Graphics;
@@ -800,12 +801,32 @@ void World::computeFow(){
} }
} }
std::string World::DumpWorldToLog() const { std::string World::DumpWorldToLog(bool consoleBasicInfoOnly) const {
string debugWorldLogFile = Config::getInstance().getString("DebugWorldLogFile","debugWorld.log"); string debugWorldLogFile = Config::getInstance().getString("DebugWorldLogFile","debugWorld.log");
if(getGameReadWritePath() != "") { if(getGameReadWritePath() != "") {
debugWorldLogFile = getGameReadWritePath() + debugWorldLogFile; debugWorldLogFile = getGameReadWritePath() + debugWorldLogFile;
} }
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 {
std::ofstream logFile; std::ofstream logFile;
logFile.open(debugWorldLogFile.c_str(), ios_base::out | ios_base::trunc); logFile.open(debugWorldLogFile.c_str(), ios_base::out | ios_base::trunc);
@@ -833,7 +854,7 @@ std::string World::DumpWorldToLog() const {
} }
logFile.close(); logFile.close();
}
return debugWorldLogFile; return debugWorldLogFile;
} }

View File

@@ -153,7 +153,7 @@ public:
Game * getGame() { return game; } Game * getGame() { return game; }
void setFogOfWar(bool value); void setFogOfWar(bool value);
std::string DumpWorldToLog() const; std::string DumpWorldToLog(bool consoleBasicInfoOnly = false) const;
private: private: