2 // Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "supertux/menu/worldmap_cheat_menu.hpp"
19 #include "gui/menu_item.hpp"
20 #include "gui/menu_manager.hpp"
21 #include "supertux/player_status.hpp"
22 #include "supertux/savegame.hpp"
23 #include "util/gettext.hpp"
24 #include "worldmap/level.hpp"
25 #include "worldmap/worldmap.hpp"
27 WorldmapCheatMenu::WorldmapCheatMenu()
29 add_label(_("Cheats"));
31 add_entry(MNID_GROW, _("Bonus: Grow"));
32 add_entry(MNID_FIRE, _("Bonus: Fire"));
33 add_entry(MNID_ICE, _("Bonus: Ice"));
34 add_entry(MNID_SHRINK, _("Bonus: None"));
36 add_entry(MNID_FINISH_LEVEL, _("Finish Level"));
37 add_entry(MNID_RESET_LEVEL, _("Reset Level"));
39 add_entry(MNID_FINISH_WORLDMAP, _("Finish WorldMap"));
40 add_entry(MNID_RESET_WORLDMAP, _("Reset WorldMap"));
46 WorldmapCheatMenu::menu_action(MenuItem* item)
48 worldmap::WorldMap* worldmap = worldmap::WorldMap::current();
51 log_warning << "couldn't access WorldMap::current()" << std::endl;
55 PlayerStatus* status = worldmap->get_savegame().get_player_status();
60 status->bonus = GROWUP_BONUS;
64 status->bonus = FIRE_BONUS;
68 status->bonus = ICE_BONUS;
72 status->bonus = NO_BONUS;
75 case MNID_FINISH_LEVEL:
77 worldmap::LevelTile* level_tile = worldmap->at_level();
80 level_tile->set_solved(true);
81 level_tile->set_perfect(false);
86 case MNID_RESET_LEVEL:
88 worldmap::LevelTile* level_tile = worldmap->at_level();
91 level_tile->set_solved(false);
92 level_tile->set_perfect(false);
97 case MNID_FINISH_WORLDMAP:
98 worldmap->set_levels_solved(true, false);
101 case MNID_RESET_WORLDMAP:
102 worldmap->set_levels_solved(false, false);
107 MenuManager::instance().clear_menu_stack();