| 29 | } |
| 30 | |
| 31 | void MapTest::onLevelChanged(const std::string &levelName) { |
| 32 | Abyss::Common::Log::debug("Loading level: {}", levelName); |
| 33 | |
| 34 | _mapAltSelections.clear(); |
| 35 | |
| 36 | const auto &lvlPrest = Common::DataTableManager::getInstance().getDataTable("LevelPreset"); |
| 37 | std::unordered_map<std::string, std::string> levelPrestData; |
| 38 | // Iterate over the LevelPrest table and find all columns from File1 to File6 that aren't "0" and add them to _mapAltSelections |
| 39 | for (const auto &row : lvlPrest) { |
| 40 | if (const auto &lvlPrestName = row.at("Name"); lvlPrestName != levelName) |
| 41 | continue; |
| 42 | |
| 43 | for (int i = 1; i <= 6; ++i) { |
| 44 | const auto &file = "File" + std::to_string(i); |
| 45 | if (const auto &dt1 = row.at(file); dt1 != "0" && dt1 != "None" && dt1 != "Expansion") { |
| 46 | _mapAltSelections.push_back(dt1); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | if (!_mapAltSelections.empty()) |
| 51 | _selectedLevelAltName = _mapAltSelections.front(); |
| 52 | |
| 53 | break; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | const Common::DataTableRow &MapTest::getLevelPrest(const std::string_view name) { |
| 58 | for (const auto &lvlPrest = Common::DataTableManager::getInstance().getDataTable("LevelPreset"); const Common::DataTableRow &row : lvlPrest) { |