widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04451
Re: [Merge] lp:~widelands-dev/widelands/s2_map into lp:widelands
Review: Approve
Diff comments:
> === 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) {
nit: get() is unnededed here: if (ml != 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());
--
https://code.launchpad.net/~widelands-dev/widelands/s2_map/+merge/274627
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/s2_map.
References