mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix duplication of theme
This commit is contained in:
parent
72bed4f677
commit
17a48db98c
|
@ -53,7 +53,7 @@ public:
|
||||||
uint8 Flags;
|
uint8 Flags;
|
||||||
|
|
||||||
UITheme(const utf8 * name);
|
UITheme(const utf8 * name);
|
||||||
UITheme(const UITheme & name);
|
UITheme(const UITheme & copy);
|
||||||
~UITheme();
|
~UITheme();
|
||||||
|
|
||||||
void SetName(const utf8 * name);
|
void SetName(const utf8 * name);
|
||||||
|
@ -750,11 +750,15 @@ extern "C"
|
||||||
utf8 newPath[MAX_PATH];
|
utf8 newPath[MAX_PATH];
|
||||||
|
|
||||||
ThemeManager::GetThemeFileName(newPath, sizeof(newPath), name);
|
ThemeManager::GetThemeFileName(newPath, sizeof(newPath), name);
|
||||||
String::DiscardDuplicate(&ThemeManager::CurrentThemePath, newPath);
|
|
||||||
|
|
||||||
ThemeManager::CurrentTheme->SetName(name);
|
// Copy the theme, save it and then load it back in
|
||||||
ThemeManager::CurrentTheme->Flags &= ~UITHEME_FLAG_PREDEFINED;
|
UITheme * newTheme = new UITheme(*ThemeManager::CurrentTheme);
|
||||||
ThemeManager::CurrentTheme->WriteToFile(ThemeManager::CurrentThemePath);
|
newTheme->SetName(name);
|
||||||
|
newTheme->Flags &= ~UITHEME_FLAG_PREDEFINED;
|
||||||
|
newTheme->WriteToFile(newPath);
|
||||||
|
delete newTheme;
|
||||||
|
|
||||||
|
ThemeManager::LoadTheme(newPath);
|
||||||
|
|
||||||
theme_manager_load_available_themes();
|
theme_manager_load_available_themes();
|
||||||
for (size_t i = 0; i < ThemeManager::AvailableThemes.GetCount(); i++)
|
for (size_t i = 0; i < ThemeManager::AvailableThemes.GetCount(); i++)
|
||||||
|
|
Loading…
Reference in New Issue