MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / GetAvailableThemes

Function GetAvailableThemes

src/openrct2-ui/interface/Theme.cpp:569–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567 std::string GetThemePath();
568
569 static void GetAvailableThemes(std::vector<AvailableTheme>* outThemes)
570 {
571 Guard::ArgumentNotNull(outThemes, GUARD_LINE);
572
573 outThemes->clear();
574
575 NumPredefinedThemes = 0;
576 for (auto predefinedTheme : kPredefinedThemes)
577 {
578 AvailableTheme theme{};
579 theme.Name = predefinedTheme.Theme->Name;
580 outThemes->push_back(std::move(theme));
581
582 NumPredefinedThemes++;
583 }
584
585 auto themesPattern = Path::Combine(GetThemePath(), u8"*.json");
586 auto scanner = Path::ScanDirectory(themesPattern, true);
587 while (scanner->Next())
588 {
589 const auto& fileInfo = scanner->GetFileInfo();
590 auto name = Path::GetFileNameWithoutExtension(fileInfo.Name);
591
592 AvailableTheme theme{};
593 theme.Name = name;
594 theme.Path = GetThemeFileName(name);
595 outThemes->push_back(std::move(theme));
596
597 if (Path::Equals(CurrentThemePath, scanner->GetPath()))
598 {
599 ActiveAvailableThemeIndex = outThemes->size() - 1;
600 }
601 }
602 }
603
604 static void LoadTheme(UITheme* theme)
605 {

Callers 2

InitialiseFunction · 0.85

Calls 11

ArgumentNotNullFunction · 0.85
GetThemePathFunction · 0.85
GetThemeFileNameFunction · 0.85
EqualsFunction · 0.85
NextMethod · 0.80
clearMethod · 0.65
CombineFunction · 0.50
push_backMethod · 0.45
GetPathMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected