diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 3d62ef43..95257e03 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2319,7 +2319,7 @@ int glestMain(int argc, char** argv) { string paramValue = argv[foundParamIndIndex]; vector paramPartTokens; Tokenize(paramValue,paramPartTokens,"="); - if(paramPartTokens.size() >= 3 && paramPartTokens[1].length() > 0 && paramPartTokens[2].length() > 0) { + if(paramPartTokens.size() >= 3 && paramPartTokens[1].length() > 0) { string itemName = paramPartTokens[1]; string itemNameFilter = paramPartTokens[2]; int32 crcValue = getFolderTreeContentsCheckSumRecursively(itemName, itemNameFilter, NULL, true); diff --git a/source/glest_game/menu/menu_state_mods.cpp b/source/glest_game/menu/menu_state_mods.cpp index 959271a7..7761fefc 100644 --- a/source/glest_game/menu/menu_state_mods.cpp +++ b/source/glest_game/menu/menu_state_mods.cpp @@ -696,6 +696,14 @@ void MenuStateMods::getTechsLocalList() { string path = config.getPathListForType(ptTechs)[1]; endPathWithSlash(path); findDirs(path, techTreeFilesUserData, false, false); + + //for(unsigned int i = 0; i < techTreeFilesUserData.size(); ++i) { + //string itemPath = config.getPathListForType(ptTechs,"")[1] + "/" + techTreeFilesUserData[i] + string("/*"); + //bool forceRefresh = (mapCRCUpdateList.find(itemPath) == mapCRCUpdateList.end()); + //mapCRCUpdateList[itemPath] = getFolderTreeContentsCheckSumRecursively(itemPath, "", NULL,forceRefresh); + //mapCRCUpdateList[itemPath] = getFolderTreeContentsCheckSumRecursively(itemPath, "", NULL,false); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] local CRC for techtree [%s] is [%d]\n",__FILE__,__FUNCTION__,__LINE__,itemPath.c_str(),mapCRCUpdateList[itemPath]); + //} } } @@ -1152,9 +1160,16 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) { if(alreadyHasTech == true) { ModInfo &modInfo = techCacheList[selectedTechName]; + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] remote CRC [%s]\n",__FILE__,__FUNCTION__,__LINE__,modInfo.crc.c_str()); + Config &config = Config::getInstance(); + string itemPath = config.getPathListForType(ptTechs,"")[1] + "/" + selectedTechName + string("/*"); + bool forceRefresh = (mapCRCUpdateList.find(itemPath) == mapCRCUpdateList.end()); + if( strToInt(modInfo.crc) != 0 && - strToInt(modInfo.crc) != getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + selectedTechName + string("/*"), ".xml", NULL)) { + strToInt(modInfo.crc) != getFolderTreeContentsCheckSumRecursively(itemPath, "", NULL,forceRefresh)) { + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d] local CRC [%d]\n",__FILE__,__FUNCTION__,__LINE__,getFolderTreeContentsCheckSumRecursively(itemPath, "", NULL)); + mainMessageBoxState = ftpmsg_ReplaceTechtree; mainMessageBox.init(lang.get("Yes"),lang.get("No")); char szBuf[1024]=""; @@ -1168,6 +1183,7 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) { sprintf(szBuf,lang.get("ModTechAlreadyInstalled").c_str(),selectedTechName.c_str()); showMessageBox(szBuf, lang.get("Notice"), true); } + mapCRCUpdateList[itemPath] = true; } else { string techName = selectedTechName; diff --git a/source/glest_game/menu/menu_state_mods.h b/source/glest_game/menu/menu_state_mods.h index 9d17e4b5..16fec11f 100644 --- a/source/glest_game/menu/menu_state_mods.h +++ b/source/glest_game/menu/menu_state_mods.h @@ -174,6 +174,7 @@ private: void showDesription(const ModInfo *modInfo); + std::map mapCRCUpdateList; public: MenuStateMods(Program *program, MainMenu *mainMenu);