MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / activate

Method activate

source/modes/MenuModeLoad.cpp:84–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void MenuModeLoad::activate()
85{
86 // Loads the corresponding Gui sheet.
87 getModeManager().getGui().loadGuiSheet(Gui::guiSheet::loadSavedGameMenu);
88
89 giveFocus();
90
91 // Play the main menu music
92 MusicPlayer::getSingleton().play(ConfigManager::getSingleton().getMainMenuMusic());
93
94
95 GameMap* gameMap = ODFrameListener::getSingleton().getClientGameMap();
96 gameMap->clearAll();
97 gameMap->setGamePaused(true);
98
99 CEGUI::Window* tmpWin = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LevelWindowFrame/SaveGameSelect");
100 CEGUI::Listbox* levelSelectList = static_cast<CEGUI::Listbox*>(tmpWin);
101
102 tmpWin = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LoadingText");
103 tmpWin->hide();
104 mFilesList.clear();
105 levelSelectList->resetList();
106
107 std::string levelPath = ResourceManager::getSingleton().getSaveGamePath();
108 if(Helper::fillFilesList(levelPath, mFilesList, SAVEGAME_EXTENSION))
109 {
110 for (uint32_t n = 0; n < mFilesList.size(); ++n)
111 {
112 std::string filename = boost::filesystem::path(mFilesList[n]).filename().string();
113 CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(filename);
114 item->setID(n);
115 item->setSelectionBrushImage("OpenDungeonsSkin/SelectionBrush");
116 levelSelectList->addItem(item);
117 }
118 }
119}
120
121bool MenuModeLoad::launchSelectedButtonPressed(const CEGUI::EventArgs&)
122{

Callers

nothing calls this directly

Calls 9

fillFilesListFunction · 0.85
loadGuiSheetMethod · 0.80
getClientGameMapMethod · 0.80
clearAllMethod · 0.80
setGamePausedMethod · 0.80
getGuiSheetMethod · 0.80
hideMethod · 0.80
clearMethod · 0.80
playMethod · 0.45

Tested by

no test coverage detected