| 131 | } |
| 132 | |
| 133 | bool MenuModeMultiplayerServer::updateFilesList(const CEGUI::EventArgs&) |
| 134 | { |
| 135 | CEGUI::Window* window = getModeManager().getGui().getGuiSheet(Gui::guiSheet::multiplayerServerMenu); |
| 136 | CEGUI::Listbox* levelSelectList = static_cast<CEGUI::Listbox*>(window->getChild(Gui::MPM_LIST_LEVELS)); |
| 137 | |
| 138 | CEGUI::Combobox* levelTypeCb = static_cast<CEGUI::Combobox*>(window->getChild(MPM_LIST_LEVEL_TYPES)); |
| 139 | |
| 140 | CEGUI::Window* loadText = window->getChild(Gui::MPM_TEXT_LOADING); |
| 141 | loadText->setText(""); |
| 142 | mFilesList.clear(); |
| 143 | mDescriptionList.clear(); |
| 144 | levelSelectList->resetList(); |
| 145 | |
| 146 | std::string levelPath; |
| 147 | size_t selection = levelTypeCb->getItemIndex(levelTypeCb->getSelectedItem()); |
| 148 | switch (selection) |
| 149 | { |
| 150 | default: |
| 151 | case 0: |
| 152 | levelPath = ResourceManager::getSingleton().getGameLevelPathMultiplayer(); |
| 153 | break; |
| 154 | case 1: |
| 155 | levelPath = ResourceManager::getSingleton().getUserLevelPathMultiplayer(); |
| 156 | break; |
| 157 | } |
| 158 | |
| 159 | if(Helper::fillFilesList(levelPath, mFilesList, MapHandler::LEVEL_EXTENSION)) |
| 160 | { |
| 161 | for (uint32_t n = 0; n < mFilesList.size(); ++n) |
| 162 | { |
| 163 | std::string filename = mFilesList[n]; |
| 164 | |
| 165 | LevelInfo levelInfo; |
| 166 | std::string mapName; |
| 167 | std::string mapDescription; |
| 168 | if(MapHandler::getMapInfo(filename, levelInfo)) |
| 169 | { |
| 170 | mapName = levelInfo.mLevelName; |
| 171 | mapDescription = levelInfo.mLevelDescription; |
| 172 | } |
| 173 | else |
| 174 | { |
| 175 | mapName = "invalid map"; |
| 176 | mapDescription = "invalid map"; |
| 177 | } |
| 178 | |
| 179 | mDescriptionList.push_back(mapDescription); |
| 180 | CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(mapName); |
| 181 | item->setID(n); |
| 182 | item->setSelectionBrushImage("OpenDungeonsSkin/SelectionBrush"); |
| 183 | levelSelectList->addItem(item); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | updateDescription(); |
| 188 | return true; |
| 189 | } |
| 190 |
nothing calls this directly
no test coverage detected