From fe942809e67b829340c57ebb0b951795a19901b8 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 30 Jan 2013 06:08:14 +0000 Subject: [PATCH] - fixed a few issues found by JeffM (debian games team irc channel) while testing on Windows 7 64 bit --- source/glest_game/world/world.cpp | 7 +++++++ source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp | 3 ++- .../shared_lib/sources/platform/common/platform_common.cpp | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 4de0ebe8b..767924731 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -613,6 +613,7 @@ void World::updateAllFactionConsumableCosts() { void World::update() { + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); bool showPerfStats = Config::getInstance().getBool("ShowPerfStats","false"); Chrono chronoPerf; char perfBuf[8096]=""; @@ -639,6 +640,7 @@ void World::update() { perfList.push_back(perfBuf); } + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); // objects on the map from tilesets updateAllTilesetObjects(); @@ -665,6 +667,7 @@ void World::update() { perfList.push_back(perfBuf); } + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //food costs updateAllFactionConsumableCosts(); @@ -673,6 +676,7 @@ void World::update() { perfList.push_back(perfBuf); } + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //fow smoothing if(fogOfWarSmoothing && ((frameCount+1) % (fogOfWarSmoothingFrameSkip+1))==0) { float fogFactor= static_cast(frameCount % GameConstants::updateFps) / GameConstants::updateFps; @@ -684,6 +688,7 @@ void World::update() { perfList.push_back(perfBuf); } + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); //tick bool needToTick = canTickWorld(); @@ -694,6 +699,7 @@ void World::update() { if(needToTick == true) { //printf("=========== World is about to be updated, current frameCount = %d\n",frameCount); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); tick(); } @@ -708,6 +714,7 @@ void World::update() { printf("%s",perfList[x].c_str()); } } + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); } bool World::canTickWorld() const { diff --git a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp index cc83596db..08d20813b 100644 --- a/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp @@ -577,7 +577,8 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo vector parts; char szBuf[8096]=""; - for (int i=0; renderText[i] != '\0'; ++i) { + //for (int i=0; renderText[i] != '\0'; ++i) { + for(size_t i=0; i < renderText.size(); ++i) { szBuf[0] = '\0'; snprintf(szBuf,8096,"%c",renderText[i]); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index dd01717f2..c1d3782e2 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -423,6 +423,8 @@ bool isdir(const char *path) } bool fileExists(const string &path) { + if (path.size() == 0) return false; + #ifdef WIN32 wstring wstr = utf8_decode(path); FILE* file= _wfopen(wstr.c_str(), L"rb");