MCPcopy Create free account
hub / github.com/AbyssEngine/AbyssEngineOld / onLevelChanged

Method onLevelChanged

src/OD2/Scenes/MapTest/MapTest.cpp:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void 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
57const Common::DataTableRow &MapTest::getLevelPrest(const std::string_view name) {
58 for (const auto &lvlPrest = Common::DataTableManager::getInstance().getDataTable("LevelPreset"); const Common::DataTableRow &row : lvlPrest) {

Callers

nothing calls this directly

Calls 3

debugFunction · 0.85
clearMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected