X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftitle.cpp;h=6c0c0954597864da8832857b9c4786f77b3ef237;hb=79095ed1df46f16fd9d4767ea7f548531b009ff2;hp=3778b17a9146213d0b3e266253449bec77562e0c;hpb=99cf62c2d44b4555e9761f1c8f1b10cf880c33fb;p=supertux.git diff --git a/src/title.cpp b/src/title.cpp index 3778b17a9..6c0c09545 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -30,9 +30,9 @@ #include #include #include -//#include -//#include -#include +#include +#include +#include #include "title.hpp" #include "mainloop.hpp" @@ -106,20 +106,13 @@ TitleScreen::generate_contrib_menu() { /** Generating contrib levels list by making use of Level Subset */ std::vector level_worlds; - std::vector files = Unison::VFS::FileSystem::get().ls("levels/"); - for(std::vector::iterator iter = files.begin();iter != files.end();++iter) - { - std::string filepath = "levels/" + *iter; - if(Unison::VFS::FileSystem::get().is_dir(filepath)) - level_worlds.push_back(filepath); - } - /*char** files = PHYSFS_enumerateFiles("levels/"); + char** files = PHYSFS_enumerateFiles("levels/"); for(const char* const* filename = files; *filename != 0; ++filename) { std::string filepath = std::string("levels/") + *filename; if(PHYSFS_isDirectory(filepath.c_str())) level_worlds.push_back(filepath); } - PHYSFS_freeList(files);*/ + PHYSFS_freeList(files); free_contrib_menu(); contrib_menu.reset(new Menu()); @@ -540,8 +533,7 @@ TitleScreen::get_slotinfo(int slot) stream << "save/" << worlddirname << "_" << slot << ".stsg"; std::string slotfile = stream.str(); - if(Unison::VFS::FileSystem::get().exists(slotfile)) - { + try { lisp::Parser parser; const lisp::Lisp* root = parser.parse(slotfile); @@ -550,9 +542,7 @@ TitleScreen::get_slotinfo(int slot) throw std::runtime_error("file is not a supertux-savegame."); savegame->get("title", title); - } - else - { + } catch(std::exception& ) { std::ostringstream slottitle; slottitle << _("Slot") << " " << slot << " - " << _("Free"); return slottitle.str();