| 199 | } |
| 200 | |
| 201 | bool 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 | } |
nothing calls this directly
no test coverage detected