From 8860fd0dc8122c7cafdd8f3d864bd3ef04f3d82e Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 14 Mar 2012 23:25:47 +0000 Subject: [PATCH] - fix saved games in headless server mode --- source/glest_game/world/minimap.cpp | 12 +++++++----- source/shared_lib/sources/xml/xml_parser.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/glest_game/world/minimap.cpp b/source/glest_game/world/minimap.cpp index 1d0592ab..4827a30d 100644 --- a/source/glest_game/world/minimap.cpp +++ b/source/glest_game/world/minimap.cpp @@ -226,11 +226,13 @@ void Minimap::saveGame(XmlNode *rootNode) { // Pixmap2D *fowPixmap0; // Pixmap2D *fowPixmap1; - for(unsigned int i = 0; i < fowPixmap1->getPixelByteCount(); ++i) { - if(fowPixmap1->getPixels()[i] != 0) { - XmlNode *fowPixmap1Node = minimapNode->addChild("fowPixmap1"); - fowPixmap1Node->addAttribute("index",intToStr(i), mapTagReplacements); - fowPixmap1Node->addAttribute("pixel",intToStr(fowPixmap1->getPixels()[i]), mapTagReplacements); + if(fowPixmap1 != NULL) { + for(unsigned int i = 0; i < fowPixmap1->getPixelByteCount(); ++i) { + if(fowPixmap1->getPixels()[i] != 0) { + XmlNode *fowPixmap1Node = minimapNode->addChild("fowPixmap1"); + fowPixmap1Node->addAttribute("index",intToStr(i), mapTagReplacements); + fowPixmap1Node->addAttribute("pixel",intToStr(fowPixmap1->getPixels()[i]), mapTagReplacements); + } } } // Texture2D *tex; diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index c3adb91b..2d8bca82 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -312,7 +312,7 @@ XmlNode *XmlIoRapid::load(const string &path, std::map mapTagRepl throw runtime_error(szBuf); } - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] took msecs: %lld\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] took msecs: %ld\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis()); return rootNode; }