From: Tobias Gläßer Date: Mon, 3 May 2004 17:56:16 +0000 (+0000) Subject: leveleditor menu IDisation and little improvements X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d6ec9f10736b36f334bbd1dd7af5c7d4df0103c1;p=supertux.git leveleditor menu IDisation and little improvements SVN-Revision: 951 --- diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index aa7b081a5..0b147ceee 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -170,11 +170,6 @@ static int le_selection_mode; static SDL_Event event; TileMapType active_tm; -// menu items for subset creation menu -enum { - MNID_CREATESUBSET -}; - void le_set_defaults() { if(le_current_level != NULL) @@ -326,7 +321,7 @@ int leveleditor(int levelnb) if(i >= 1) { le_level_subset->load(level_subsets.item[i-1]); - leveleditor_menu->item[3].kind = MN_GOTO; + leveleditor_menu->get_item_by_id(MNID_SUBSETSETTINGS).kind = MN_GOTO; le_level = 1; le_world.arrays_free(); delete le_current_level; @@ -340,8 +335,7 @@ int leveleditor(int levelnb) le_current_level->load_gfx(); le_world.activate_bad_guys(); - // FIXME:? - Menu::set_current(leveleditor_menu); + Menu::set_current(NULL); } break; } @@ -357,9 +351,9 @@ int leveleditor(int levelnb) switch (i = subset_new_menu->check()) { case MNID_CREATESUBSET: - LevelSubset::create(subset_new_menu->item[2].input); - le_level_subset->load(subset_new_menu->item[2].input); - leveleditor_menu->item[3].kind = MN_GOTO; + LevelSubset::create(subset_new_menu->get_item_by_id(MNID_SUBSETNAME).input); + le_level_subset->load(subset_new_menu->get_item_by_id(MNID_SUBSETNAME).input); + leveleditor_menu->get_item_by_id(MNID_SUBSETSETTINGS).kind = MN_GOTO; le_level = 1; le_world.arrays_free(); delete le_current_level; @@ -372,23 +366,23 @@ int leveleditor(int levelnb) le_set_defaults(); le_current_level->load_gfx(); le_world.activate_bad_guys(); - subset_new_menu->item[2].change_input(""); - // FIXME:? show_menu = true; - Menu::set_current(leveleditor_menu); + subset_new_menu->get_item_by_id(MNID_SUBSETNAME).change_input(""); + + Menu::set_current(subset_settings_menu); break; } } } else if(menu == subset_settings_menu) { - if(le_level_subset->title.compare(subset_settings_menu->item[2].input) == 0 && le_level_subset->description.compare(subset_settings_menu->item[3].input) == 0 ) - subset_settings_menu->item[5].kind = MN_DEACTIVE; + if(le_level_subset->title.compare(subset_settings_menu->get_item_by_id(MNID_TITLE).input) == 0 && le_level_subset->description.compare(subset_settings_menu->get_item_by_id(MNID_DESCRIPTION).input) == 0 ) + subset_settings_menu->get_item_by_id(MNID_SAVE_CHANGES).kind = MN_DEACTIVE; else - subset_settings_menu->item[5].kind = MN_ACTION; + subset_settings_menu->get_item_by_id(MNID_SAVE_CHANGES).kind = MN_ACTION; switch (i = subset_settings_menu->check()) { - case 5: + case MNID_SAVE_CHANGES: save_subset_settings_menu(); //FIXME:show_menu = true; Menu::set_current(leveleditor_menu); diff --git a/src/menu.h b/src/menu.h index e2d6faf54..fa276f2f2 100644 --- a/src/menu.h +++ b/src/menu.h @@ -62,6 +62,17 @@ enum LevelEditorMainMenuIDs { MNID_SUBSETSETTINGS, MNID_QUITLEVELEDITOR }; + +enum LevelEditorSubsetSettingsIDs { + MNID_TITLE, + MNID_DESCRIPTION, + MNID_SAVE_CHANGES + }; + +enum LevelEditorSubsetNewIDs { + MNID_SUBSETNAME, + MNID_CREATESUBSET +}; enum LevelEditorSettingsMenuIDs { MNID_NAME,