| 134 | } |
| 135 | |
| 136 | bool MenuModeEditorLoad::updateFilesList(const CEGUI::EventArgs&) |
| 137 | { |
| 138 | CEGUI::Window* window = getModeManager().getGui().getGuiSheet(Gui::guiSheet::editorLoadMenu); |
| 139 | CEGUI::Listbox* levelSelectList = static_cast<CEGUI::Listbox*>(window->getChild(Gui::EDM_LIST_LEVELS)); |
| 140 | |
| 141 | CEGUI::Combobox* levelTypeCb = static_cast<CEGUI::Combobox*>(window->getChild(Gui::EDM_LIST_LEVEL_TYPES)); |
| 142 | |
| 143 | CEGUI::Window* loadText = window->getChild(Gui::EDM_TEXT_LOADING); |
| 144 | loadText->setText(""); |
| 145 | mFilesList.clear(); |
| 146 | mDescriptionList.clear(); |
| 147 | levelSelectList->resetList(); |
| 148 | |
| 149 | std::string levelPath; |
| 150 | size_t selection = levelTypeCb->getItemIndex(levelTypeCb->getSelectedItem()); |
| 151 | bool officialSkirmishMaps = false; |
| 152 | bool officialMultiplayerMaps = false; |
| 153 | switch (selection) |
| 154 | { |
| 155 | default: |
| 156 | case 0: |
| 157 | levelPath = ResourceManager::getSingleton().getGameLevelPathSkirmish(); |
| 158 | officialSkirmishMaps = true; |
| 159 | break; |
| 160 | case 1: |
| 161 | levelPath = ResourceManager::getSingleton().getGameLevelPathMultiplayer(); |
| 162 | officialMultiplayerMaps = true; |
| 163 | break; |
| 164 | case 2: |
| 165 | levelPath = ResourceManager::getSingleton().getUserLevelPathSkirmish(); |
| 166 | break; |
| 167 | case 3: |
| 168 | levelPath = ResourceManager::getSingleton().getUserLevelPathMultiplayer(); |
| 169 | break; |
| 170 | } |
| 171 | |
| 172 | if(Helper::fillFilesList(levelPath, mFilesList, MapHandler::LEVEL_EXTENSION)) |
| 173 | { |
| 174 | std::vector<std::string> officialFileList; |
| 175 | if (officialSkirmishMaps) |
| 176 | levelPath = ResourceManager::getSingleton().getUserLevelPathSkirmish(); |
| 177 | if (officialMultiplayerMaps) |
| 178 | levelPath = ResourceManager::getSingleton().getUserLevelPathMultiplayer(); |
| 179 | |
| 180 | if (officialSkirmishMaps || officialMultiplayerMaps) |
| 181 | { |
| 182 | if (!Helper::fillFilesList(levelPath, officialFileList, MapHandler::LEVEL_EXTENSION)) |
| 183 | officialFileList.clear(); |
| 184 | } |
| 185 | |
| 186 | for (uint32_t n = 0; n < mFilesList.size(); ++n) |
| 187 | { |
| 188 | std::string filename = mFilesList[n]; |
| 189 | |
| 190 | LevelInfo levelInfo; |
| 191 | std::string mapName; |
| 192 | std::string mapDescription; |
| 193 | bool customMapExists = findFileStemIn(officialFileList, filename); |
nothing calls this directly
no test coverage detected