From b190968e6b0519df8f83ad647bb53a9b08c73c10 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 4 Nov 2013 19:16:28 +0000 Subject: [PATCH] - bugfix for save / restore game (spelling mistake) - vc++ warning fixes --- source/glest_game/game/script_manager.cpp | 12 +++++++++--- source/shared_lib/sources/xml/xml_parser.cpp | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index 2d797248..a7994ada 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -3136,7 +3136,7 @@ void ScriptManager::saveGame(XmlNode *rootNode) { XmlNode *unitTriggerEventListNode = scriptManagerNode->addChild("UnitTriggerEventList"); unitTriggerEventListNode->addAttribute("unitId",intToStr(iterMap->first), mapTagReplacements); - unitTriggerEventListNode->addAttribute("evenType",intToStr(iterMap->second), mapTagReplacements); + unitTriggerEventListNode->addAttribute("eventType",intToStr(iterMap->second), mapTagReplacements); } scriptManagerNode->addAttribute("lastUnitTriggerEventUnitId",intToStr(lastUnitTriggerEventUnitId), mapTagReplacements); scriptManagerNode->addAttribute("lastUnitTriggerEventType",intToStr(lastUnitTriggerEventType), mapTagReplacements); @@ -3262,9 +3262,15 @@ void ScriptManager::loadGame(const XmlNode *rootNode) { for(unsigned int i = 0; i < unitTriggerEventListNodeList.size(); ++i) { XmlNode *node = unitTriggerEventListNodeList[i]; + UnitTriggerEventType eventType = utet_None; int unitId = node->getAttribute("unitId")->getIntValue(); - UnitTriggerEventType evenType = static_cast(node->getAttribute("eventType")->getIntValue()); - UnitTriggerEventList[unitId] = evenType; + if(node->hasAttribute("eventType") == true) { + eventType = static_cast(node->getAttribute("eventType")->getIntValue()); + } + else if(node->hasAttribute("evenType") == true) { + eventType = static_cast(node->getAttribute("evenType")->getIntValue()); + } + UnitTriggerEventList[unitId] = eventType; } if(scriptManagerNode->hasAttribute("lastUnitTriggerEventUnitId") == true) { lastUnitTriggerEventUnitId = scriptManagerNode->getAttribute("lastUnitTriggerEventUnitId")->getIntValue(); diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index 9067e80d..6ebe3dc0 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -780,7 +780,7 @@ bool XmlNode::hasChildNoSuper(const string &childName) const { return false; } XmlNode * XmlNode::getChildWithAliases(vector childNameList, unsigned int childIndex) const { - for(int aliasIndex = 0; aliasIndex < childNameList.size(); ++aliasIndex) { + for(int aliasIndex = 0; aliasIndex < (int)childNameList.size(); ++aliasIndex) { const string &childName = childNameList[aliasIndex]; if(superNode && hasChildNoSuper(childName) == false) { return superNode->getChild(childName,childIndex); @@ -826,7 +826,7 @@ bool XmlNode::hasChild(const string &childName) const { bool XmlNode::hasChildWithAliases(vector childNameList) const { bool result = false; - for(int aliasIndex = 0; aliasIndex < childNameList.size(); ++aliasIndex) { + for(int aliasIndex = 0; aliasIndex < (int)childNameList.size(); ++aliasIndex) { const string &childName = childNameList[aliasIndex]; result = hasChild(childName); if(result == true) {