diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index 3a7ecfeec..2ac254426 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -1008,12 +1008,15 @@ namespace Glest { string map_path = pathList[idx]; endPathWithSlash(map_path); + const string zeta = map_path + mapName + ".zgm"; const string mega = map_path + mapName + ".mgm"; const string glest = map_path + mapName + ".gbm"; if (fileExists(mega)) { return mega; } else if (fileExists(glest)) { return glest; + } else if (fileExists(zeta)) { + return zeta; } } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 63c5f34e1..f4f95c64b 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -375,7 +375,7 @@ namespace Glest { listBoxMapFilter.setEditable(false); - // put them all in a set, to weed out duplicates (gbm & mgm with same name) + // put them all in a set, to weed out duplicates (zgm, gbm & mgm with same name) // will also ensure they are alphabetically listed (rather than how the OS provides them) listBoxMap.registerGraphicComponent(containerName, "listBoxMap"); listBoxMap.init(xoffset + 100, mapPos, 220); @@ -612,7 +612,7 @@ namespace Glest { //map listBox - // put them all in a set, to weed out duplicates (gbm & mgm with same name) + // put them all in a set, to weed out duplicates (zgm, gbm & mgm with same name) // will also ensure they are alphabetically listed (rather than how the OS provides them) setupMapList(""); listBoxMap.setItems(formattedPlayerSortedMaps[0]); diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 45e083362..e76a78d03 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -444,7 +444,7 @@ namespace Glest { //map listBox listBoxMap.registerGraphicComponent(containerName, "listBoxMap"); listBoxMap.init(xoffset + 100, mapPos, 220); - // put them all in a set, to weed out duplicates (gbm & mgm with same name) + // put them all in a set, to weed out duplicates (zgm, gbm, and mgm with same name) // will also ensure they are alphabetically listed (rather than how the OS provides them) int initialMapSelection = setupMapList(""); listBoxMap.setItems(formattedPlayerSortedMaps[0]); diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index 83a69668b..2128f687c 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -537,7 +537,7 @@ namespace MapEditor { SetTitle(ToUnicode(winHeader + " - " + currentFile)); } else SetTitle(ToUnicode(winHeader)); - + setDirty(false); setExtension(); } @@ -576,11 +576,11 @@ namespace MapEditor { //printf("#A currentFile [%s] extnsn [%s]\n",currentFile.c_str(),extnsn.c_str()); - if (extnsn == "gbm" || extnsn == "mgm") { + if (extnsn == "gbm" || extnsn == "mgm" || extnsn == "zgm") { currentFile = cutLastExt(currentFile); } - SetStatusText(wxT(".mgm"), siFILE_TYPE); - currentFile += ".mgm"; + SetStatusText(wxT(".zgm"), siFILE_TYPE); + currentFile += ".zgm"; } void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) { @@ -728,7 +728,7 @@ namespace MapEditor { try { fileDialog->SetMessage(wxT("Select Glestmap to load")); - fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm)|*.gbm;*.mgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm")); + fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm *.zgm)|*.gbm;*.mgm;*.zgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm|Zeta Map (*.zgm)|*.zgm")); if (fileDialog->ShowModal() == wxID_OK) { #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath())); @@ -783,9 +783,9 @@ namespace MapEditor { } #if wxCHECK_VERSION(2, 9, 1) - wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm"), wxFD_SAVE); + wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm|*.zgm"), wxFD_SAVE); #else - wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm"), wxSAVE); + wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm|*.zgm"), wxSAVE); #endif if (fileDialog->GetPath() != ToUnicode("")) { @@ -800,7 +800,7 @@ namespace MapEditor { fd.SetDirectory(ToUnicode(defaultPath)); } - fd.SetWildcard(wxT("ZetaGlest Map (*.mgm)|*.mgm|Glest Map (*.gbm)|*.gbm")); + fd.SetWildcard(wxT("ZetaGlest Map (*.zgm)|MegaGlest Map (*.mgm)|*.mgm|Glest Map (*.gbm)|*.gbm")); if (fd.ShowModal() == wxID_OK) { #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath())); @@ -1651,7 +1651,7 @@ wxT("Help")).ShowModal(); if (argv[1][0] == '-') { // any flag gives help and exits program. std::cout << std::endl << "ZetaGlest map editor " << mapeditorVersionString << " [Using " << (const char *) wxConvCurrent->cWX2MB(wxVERSION_STRING) << "]" << std::endl << std::endl; //std::cout << "\nglest_map_editor [MGM FILE]" << std::endl << std::endl; - std::cout << "Creates or edits zetaglest/glest maps. [.mgm/.gbm]" << std::endl << std::endl; + std::cout << "Creates or edits zetaglest/glest maps. [.zgm/.mgm/.gbm]" << std::endl << std::endl; std::cout << "Draw with left mouse button." << std::endl; std::cout << "Move map with right mouse button." << std::endl; std::cout << "Zoom with middle mouse button or mousewheel." << std::endl; diff --git a/source/shared_lib/sources/map/map_preview.cpp b/source/shared_lib/sources/map/map_preview.cpp index dc4d8f8af..6c5268ce2 100644 --- a/source/shared_lib/sources/map/map_preview.cpp +++ b/source/shared_lib/sources/map/map_preview.cpp @@ -1111,12 +1111,17 @@ namespace Shared { endPathWithSlash(map_path); const string original = map_path + mapName; + const string zeta = map_path + mapName + ".zgm"; const string mega = map_path + mapName + ".mgm"; const string glest = map_path + mapName + ".gbm"; - if ((EndsWith(original, ".mgm") == true || EndsWith(original, ".gbm") == true) && - fileExists(original)) { + if (( EndsWith(original, ".zgm") == true || + EndsWith(original, ".mgm") == true || + EndsWith(original, ".gbm") == true) && + fileExists(original)) { return original; + } else if (fileExists(zeta)) { + return zeta; } else if (fileExists(mega)) { return mega; } else if (fileExists(glest)) { @@ -1146,6 +1151,10 @@ namespace Shared { findAll(path + "*.gbm", results2, cutExtension, false); copy(results2.begin(), results2.end(), std::inserter(allMaps2, allMaps2.begin())); + results2.clear(); + findAll(path + "*.zgm", results2, cutExtension, false); + copy(results2.begin(), results2.end(), std::inserter(allMaps2, allMaps2.begin())); + results2.clear(); findAll(path + "*.mgm", results2, cutExtension, false); copy(results2.begin(), results2.end(), std::inserter(allMaps2, allMaps2.begin())); @@ -1160,6 +1169,10 @@ namespace Shared { findAll(pathList, "*.gbm", results, cutExtension, false); copy(results.begin(), results.end(), std::inserter(allMaps, allMaps.begin())); + results.clear(); + findAll(pathList, "*.zgm", results, cutExtension, false); + copy(results.begin(), results.end(), std::inserter(allMaps, allMaps.begin())); + results.clear(); findAll(pathList, "*.mgm", results, cutExtension, false); copy(results.begin(), results.end(), std::inserter(allMaps, allMaps.begin())); diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index 3f65091db..4c7fa3194 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -287,8 +287,8 @@ namespace Shared { destFile += mapFileName.first; if (mapFileName.second == "") { - if (EndsWith(destFile, ".mgm") == false && EndsWith(destFile, ".gbm") == false) { - destFileExt = ".mgm"; + if (EndsWith(destFile, ".zgm") == false && EndsWith(destFile, ".mgm") == false && EndsWith(destFile, ".gbm") == false) { + destFileExt = ".zgm"; destFile += destFileExt; } } @@ -373,7 +373,7 @@ namespace Shared { result = getMapFromServer(mapFileName, "", ""); } else { pair findMapFileName = mapFileName; - findMapFileName.first += +".mgm"; + findMapFileName.first += +".zgm"; result = getMapFromServer(findMapFileName, FTP_MAPS_CUSTOM_USERNAME, FTP_COMMON_PASSWORD); if (result.first == ftp_crt_FAIL && this->getQuitStatus() == false) { @@ -381,13 +381,18 @@ namespace Shared { findMapFileName.first += +".gbm"; result = getMapFromServer(findMapFileName, FTP_MAPS_CUSTOM_USERNAME, FTP_COMMON_PASSWORD); if (result.first == ftp_crt_FAIL && this->getQuitStatus() == false) { - findMapFileName = mapFileName; - findMapFileName.first += +".mgm"; - result = getMapFromServer(findMapFileName, FTP_MAPS_USERNAME, FTP_COMMON_PASSWORD); + findMapFileName = mapFileName; + findMapFileName.first += +".zgm"; + result = getMapFromServer(findMapFileName, FTP_MAPS_USERNAME, FTP_COMMON_PASSWORD); if (result.first == ftp_crt_FAIL && this->getQuitStatus() == false) { findMapFileName = mapFileName; - findMapFileName.first += +".gbm"; + findMapFileName.first += +".mgm"; result = getMapFromServer(findMapFileName, FTP_MAPS_USERNAME, FTP_COMMON_PASSWORD); + if (result.first == ftp_crt_FAIL && this->getQuitStatus() == false) { + findMapFileName = mapFileName; + findMapFileName.first += +".gbm"; + result = getMapFromServer(findMapFileName, FTP_MAPS_USERNAME, FTP_COMMON_PASSWORD); + } } } }