Renamed AddonDialog to DownloadDialog, as it isn't AddonManager specific any more
[supertux.git] / src / supertux / menu / contrib_levelset_menu.cpp
index c268741..f7e0373 100644 (file)
@@ -47,8 +47,9 @@ ContribLevelsetMenu::ContribLevelsetMenu(std::unique_ptr<World> world) :
 
   for (int i = 0; i < m_levelset->get_num_levels(); ++i)
   {
-    std::string filename = FileSystem::join(m_world->get_basedir(), m_levelset->get_level_filename(i));
-    std::string title = GameManager::current()->get_level_name(filename);
+    std::string filename = m_levelset->get_level_filename(i);
+    std::string full_filename = FileSystem::join(m_world->get_basedir(), filename);
+    std::string title = GameManager::current()->get_level_name(full_filename);
     LevelState level_state = state.get_level_state(filename);
 
     std::ostringstream out;
@@ -68,20 +69,16 @@ ContribLevelsetMenu::ContribLevelsetMenu(std::unique_ptr<World> world) :
 }
 
 void
-ContribLevelsetMenu::check_menu()
+ContribLevelsetMenu::menu_action(MenuItem* item)
 {
-  int index = check();
-  if (index != -1)
+  if (item->kind == MN_ACTION)
   {
-    if (get_item_by_id(index).kind == MN_ACTION)
-    {
-      sound_manager->stop_music();
+    SoundManager::current()->stop_music();
 
-      // reload the World so that we have something that we can safely
-      // std::move() around without wreaking the ContribMenu
-      std::unique_ptr<World> world = World::load(m_world->get_basedir());
-      GameManager::current()->start_level(std::move(world), m_levelset->get_level_filename(index));
-    }
+    // reload the World so that we have something that we can safely
+    // std::move() around without wreaking the ContribMenu
+    std::unique_ptr<World> world = World::load(m_world->get_basedir());
+    GameManager::current()->start_level(std::move(world), m_levelset->get_level_filename(item->id));
   }
 }