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

Method updateFilesList

source/modes/MenuModeEditorLoad.cpp:136–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136bool 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);

Callers

nothing calls this directly

Calls 10

fillFilesListFunction · 0.85
findFileStemInFunction · 0.85
getMapInfoFunction · 0.85
getGuiSheetMethod · 0.80
setTextMethod · 0.80
clearMethod · 0.80

Tested by

no test coverage detected