← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/s2_map into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/s2_map into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/s2_map/+merge/274627

Made Settlers II maps reappear in map selection windows.

I had accidentally killed them in r7538.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/s2_map into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_main_menu_load_or_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_or_save_map.cc	2015-10-02 09:26:57 +0000
+++ src/editor/ui_menus/editor_main_menu_load_or_save_map.cc	2015-10-15 19:44:24 +0000
@@ -171,39 +171,36 @@
 	Widelands::Map map;
 
 	for (const std::string& mapfilename : files) {
-
 		// Add map file (compressed) or map directory (uncompressed)
-		if (Widelands::WidelandsMapLoader::is_widelands_map(mapfilename)) {
-			std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(mapfilename);
-			if (ml.get() != nullptr) {
-				try {
-					ml->preload_map(true);
-
-					if (!map.get_width() || !map.get_height()) {
-						continue;
-					}
-
-					MapData::MapType maptype;
-
-					if (map.scenario_types() & Widelands::Map::MP_SCENARIO ||
-					    map.scenario_types() & Widelands::Map::SP_SCENARIO) {
-						maptype = MapData::MapType::kScenario;
-					} else if (dynamic_cast<Widelands::WidelandsMapLoader*>(ml.get())) {
-						maptype = MapData::MapType::kNormal;
-					} else {
-						maptype = MapData::MapType::kSettlers2;
-					}
-
-					MapData mapdata(map, mapfilename, maptype, display_type);
-
-					has_translated_mapname_ =
-					   has_translated_mapname_ || (mapdata.name != mapdata.localized_name);
-
-					maps_data_.push_back(mapdata);
-
-				} catch (const WException&) {
-				}  //  we simply skip illegal entries
-			}
+		std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(mapfilename);
+		if (ml.get() != nullptr) {
+			try {
+				ml->preload_map(true);
+
+				if (!map.get_width() || !map.get_height()) {
+					continue;
+				}
+
+				MapData::MapType maptype;
+
+				if (map.scenario_types() & Widelands::Map::MP_SCENARIO ||
+					 map.scenario_types() & Widelands::Map::SP_SCENARIO) {
+					maptype = MapData::MapType::kScenario;
+				} else if (dynamic_cast<Widelands::WidelandsMapLoader*>(ml.get())) {
+					maptype = MapData::MapType::kNormal;
+				} else {
+					maptype = MapData::MapType::kSettlers2;
+				}
+
+				MapData mapdata(map, mapfilename, maptype, display_type);
+
+				has_translated_mapname_ =
+					has_translated_mapname_ || (mapdata.name != mapdata.localized_name);
+
+				maps_data_.push_back(mapdata);
+
+			} catch (const WException&) {
+			}  //  we simply skip illegal entries
 		} else if (g_fs->is_directory(mapfilename)) {
 			// Add subdirectory to the list
 			const char* fs_filename = FileSystem::fs_filename(mapfilename.c_str());

=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc	2015-10-05 06:53:34 +0000
+++ src/ui_fsmenu/mapselect.cc	2015-10-15 19:44:24 +0000
@@ -259,45 +259,42 @@
 		Widelands::Map map; //  MapLoader needs a place to put its preload data
 
 		for (const std::string& mapfilename : files) {
-
 			// Add map file (compressed) or map directory (uncompressed)
-			if (Widelands::WidelandsMapLoader::is_widelands_map(mapfilename)) {
-				std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(mapfilename);
-				if (ml.get() != nullptr) {
-					try {
-						map.set_filename(mapfilename);
-						ml->preload_map(true);
-
-						if (!map.get_width() || !map.get_height()) {
-							continue;
-						}
-
-						MapData::MapType maptype;
-						if (map.scenario_types() & scenario_types_) {
-							maptype = MapData::MapType::kScenario;
-						} else if (dynamic_cast<WidelandsMapLoader*>(ml.get())) {
-							maptype = MapData::MapType::kNormal;
-						} else {
-							maptype = MapData::MapType::kSettlers2;
-						}
-
-						MapData mapdata(map, mapfilename, maptype, display_type);
-
-						has_translated_mapname_ =
-								has_translated_mapname_ || (mapdata.name != mapdata.localized_name);
-
-						bool has_all_tags = true;
-						for (std::set<uint32_t>::const_iterator it = req_tags_.begin(); it != req_tags_.end(); ++it)
-							has_all_tags &= mapdata.tags.count(tags_ordered_[*it]);
-						if (!has_all_tags) {
-							continue;
-						}
-						maps_data_.push_back(mapdata);
-					} catch (const std::exception & e) {
-						log("Mapselect: Skip %s due to preload error: %s\n", mapfilename.c_str(), e.what());
-					} catch (...) {
-						log("Mapselect: Skip %s due to unknown exception\n", mapfilename.c_str());
-					}
+			std::unique_ptr<Widelands::MapLoader> ml = map.get_correct_loader(mapfilename);
+			if (ml.get() != nullptr) {
+				try {
+					map.set_filename(mapfilename);
+					ml->preload_map(true);
+
+					if (!map.get_width() || !map.get_height()) {
+						continue;
+					}
+
+					MapData::MapType maptype;
+					if (map.scenario_types() & scenario_types_) {
+						maptype = MapData::MapType::kScenario;
+					} else if (dynamic_cast<WidelandsMapLoader*>(ml.get())) {
+						maptype = MapData::MapType::kNormal;
+					} else {
+						maptype = MapData::MapType::kSettlers2;
+					}
+
+					MapData mapdata(map, mapfilename, maptype, display_type);
+
+					has_translated_mapname_ =
+							has_translated_mapname_ || (mapdata.name != mapdata.localized_name);
+
+					bool has_all_tags = true;
+					for (std::set<uint32_t>::const_iterator it = req_tags_.begin(); it != req_tags_.end(); ++it)
+						has_all_tags &= mapdata.tags.count(tags_ordered_[*it]);
+					if (!has_all_tags) {
+						continue;
+					}
+					maps_data_.push_back(mapdata);
+				} catch (const std::exception & e) {
+					log("Mapselect: Skip %s due to preload error: %s\n", mapfilename.c_str(), e.what());
+				} catch (...) {
+					log("Mapselect: Skip %s due to unknown exception\n", mapfilename.c_str());
 				}
 			} else if (g_fs->is_directory(mapfilename)) {
 				// Add subdirectory to the list


Follow ups