X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fprofile_menu.cpp;h=f215b2af407291ab95314df9f585a1ae92e892cb;hb=2cc6d246e1ff259b7580707847abf9f139d3d22c;hp=d7f93c21de4b84df0e06c2f2e69dddc19e621cad;hpb=8c04f9d88e4d60096c7279bdbff374e5ade1d565;p=supertux.git diff --git a/src/profile_menu.cpp b/src/profile_menu.cpp index d7f93c21d..f215b2af4 100644 --- a/src/profile_menu.cpp +++ b/src/profile_menu.cpp @@ -16,6 +16,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include +#include "gameconfig.hpp" #include "gettext.hpp" #include "gui/menu.hpp" @@ -33,13 +34,17 @@ public: { std::ostringstream out; out << "Profile " << i+1; - add_entry(i, out.str()); + add_entry(i+1, out.str()); } add_hl(); add_back(_("Back")); } - + + void menu_action(MenuItem* item) { + config->profile = item->id; + Menu::set_current(0); + } }; Menu* profile_menu = 0; @@ -57,4 +62,39 @@ void free_profile_menu() profile_menu = 0; } +/* +std::string +TitleScreen::get_slotinfo(int slot) +{ + std::string tmp; + std::string title; + + std::string basename = current_world->get_basedir(); + basename = basename.substr(0, basename.length()-1); + std::string worlddirname = FileSystem::basename(basename); + std::ostringstream stream; + stream << "profile" << config->profile << "/" << worlddirname << "_" << slot << ".stsg"; + std::string slotfile = stream.str(); + + try { + lisp::Parser parser; + const lisp::Lisp* root = parser.parse(slotfile); + + const lisp::Lisp* savegame = root->get_lisp("supertux-savegame"); + if(!savegame) + throw std::runtime_error("file is not a supertux-savegame."); + + savegame->get("title", title); + } catch(std::exception& ) { + std::ostringstream slottitle; + slottitle << _("Slot") << " " << slot << " - " << _("Free"); + return slottitle.str(); + } + + std::ostringstream slottitle; + slottitle << _("Slot") << " " << slot << " - " << title; + return slottitle.str(); +} +*/ + /* EOF */