- std::string filename = subset.get_level_filename(i);
- std::string filepath;
- filepath = st_dir + "/levels/" + filename;
- if (access(filepath.c_str(), R_OK) != 0)
- {
- filepath = datadir + "/levels/" + filename;
- if (access(filepath.c_str(), R_OK) != 0)
- {
- std::cerr << "Error: Level: couldn't find level: " << filename << std::endl;
- continue;
- }
- }
-
- LispReader* reader = LispReader::load(filepath, "supertux-level");
- if(!reader)
- {
- std::cerr << "Error: Could not open level file. Ignoring...\n";
- continue;
- }
-
- reader->read_string("name", level_title, true);
- delete reader;
-
- contrib_subset_menu->additem(MN_ACTION, level_title, 0, 0, i);
- }
+ for (int i = 0; i < subset.get_num_levels(); ++i)
+ {
+ /** get level's title */
+ std::string filename = subset.get_level_filename(i);
+ std::string title = get_level_name(filename);
+ contrib_subset_menu->additem(MN_ACTION, title, 0, 0, i);
+ }