~widelands-dev/widelands/campaignselect_box

« back to all changes in this revision

Viewing changes to src/wui/load_or_save_game.cc

  • Committer: GunChleoc
  • Date: 2018-09-29 14:03:56 UTC
  • Revision ID: fios@foramnagaidhlig.net-20180929140356-9z81hmhbmnewllpu
Smarter filtering of savegame filenames.

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
 
307
307
        if (filetype_ == FileType::kReplay) {
308
308
                gamefiles = filter(g_fs->list_directory(kReplayDir), [](const std::string& fn) {
309
 
                        return boost::ends_with(fn, kReplayExtension);
 
309
                        return boost::algorithm::ends_with(fn, kReplayExtension);
310
310
                });
311
311
                // Update description column title for replays
312
312
                table_.set_column_tooltip(2, show_filenames ? _("Filename: Map name (start of replay)") :
313
313
                                                              _("Map name (start of replay)"));
314
314
        } else {
315
 
                gamefiles = g_fs->list_directory(kSaveDir);
 
315
                gamefiles = filter(g_fs->list_directory(kSaveDir), [](const std::string& fn) {
 
316
                        return boost::algorithm::ends_with(fn, kSavegameExtension);
 
317
                });
316
318
        }
317
319
 
318
320
        Widelands::GamePreloadPacket gpdp;
319
321
 
320
322
        for (const std::string& gamefilename : gamefiles) {
321
 
                // NOCOM filter per file extension instead?
322
 
                if (gamefilename == kCampVisFile || gamefilename == g_fs->fix_cross_file(kCampVisFile)) {
323
 
                        continue;
324
 
                }
325
 
 
326
323
                SavegameData gamedata;
327
324
 
328
325
                std::string savename = gamefilename;