- fixed a few issues found by JeffM (debian games team irc channel) while testing on Windows 7 64 bit

This commit is contained in:
Mark Vejvoda
2013-01-30 06:08:14 +00:00
parent 6acf5e9e67
commit fe942809e6
3 changed files with 11 additions and 1 deletions

View File

@@ -613,6 +613,7 @@ void World::updateAllFactionConsumableCosts() {
void World::update() { 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"); bool showPerfStats = Config::getInstance().getBool("ShowPerfStats","false");
Chrono chronoPerf; Chrono chronoPerf;
char perfBuf[8096]=""; char perfBuf[8096]="";
@@ -639,6 +640,7 @@ void World::update() {
perfList.push_back(perfBuf); 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 // objects on the map from tilesets
updateAllTilesetObjects(); updateAllTilesetObjects();
@@ -665,6 +667,7 @@ void World::update() {
perfList.push_back(perfBuf); 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 //food costs
updateAllFactionConsumableCosts(); updateAllFactionConsumableCosts();
@@ -673,6 +676,7 @@ void World::update() {
perfList.push_back(perfBuf); 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 //fow smoothing
if(fogOfWarSmoothing && ((frameCount+1) % (fogOfWarSmoothingFrameSkip+1))==0) { if(fogOfWarSmoothing && ((frameCount+1) % (fogOfWarSmoothingFrameSkip+1))==0) {
float fogFactor= static_cast<float>(frameCount % GameConstants::updateFps) / GameConstants::updateFps; float fogFactor= static_cast<float>(frameCount % GameConstants::updateFps) / GameConstants::updateFps;
@@ -684,6 +688,7 @@ void World::update() {
perfList.push_back(perfBuf); 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 //tick
bool needToTick = canTickWorld(); bool needToTick = canTickWorld();
@@ -694,6 +699,7 @@ void World::update() {
if(needToTick == true) { if(needToTick == true) {
//printf("=========== World is about to be updated, current frameCount = %d\n",frameCount); //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(); tick();
} }
@@ -708,6 +714,7 @@ void World::update() {
printf("%s",perfList[x].c_str()); 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 { bool World::canTickWorld() const {

View File

@@ -577,7 +577,8 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
vector<string> parts; vector<string> parts;
char szBuf[8096]=""; 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'; szBuf[0] = '\0';
snprintf(szBuf,8096,"%c",renderText[i]); snprintf(szBuf,8096,"%c",renderText[i]);

View File

@@ -423,6 +423,8 @@ bool isdir(const char *path)
} }
bool fileExists(const string &path) { bool fileExists(const string &path) {
if (path.size() == 0) return false;
#ifdef WIN32 #ifdef WIN32
wstring wstr = utf8_decode(path); wstring wstr = utf8_decode(path);
FILE* file= _wfopen(wstr.c_str(), L"rb"); FILE* file= _wfopen(wstr.c_str(), L"rb");