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

Method updateDescription

source/modes/MenuModeLoad.cpp:201–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201bool MenuModeLoad::updateDescription(const CEGUI::EventArgs&)
202{
203 // Get the level corresponding id
204 CEGUI::Window* tmpWin = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LevelWindowFrame/SaveGameSelect");
205 CEGUI::Listbox* levelSelectList = static_cast<CEGUI::Listbox*>(tmpWin);
206
207 CEGUI::Window* descTxt = getModeManager().getGui().getGuiSheet(Gui::loadSavedGameMenu)->getChild("LevelWindowFrame/MapDescriptionText");
208
209 if(levelSelectList->getSelectedCount() == 0)
210 {
211 descTxt->setText("");
212 return true;
213 }
214
215 getModeManager().getGui().playButtonClickSound();
216
217 CEGUI::ListboxItem* selItem = levelSelectList->getFirstSelectedItem();
218 int id = selItem->getID();
219
220 std::string filename = mFilesList[id];
221
222 LevelInfo levelInfo;
223 std::string mapDescription;
224 if(MapHandler::getMapInfo(filename, levelInfo))
225 mapDescription = levelInfo.mLevelDescription;
226 else
227 mapDescription = "invalid map";
228
229 descTxt->setText(mapDescription);
230
231 return true;
232}

Callers

nothing calls this directly

Calls 4

getMapInfoFunction · 0.85
getGuiSheetMethod · 0.80
setTextMethod · 0.80
playButtonClickSoundMethod · 0.80

Tested by

no test coverage detected