From: Patrick McIlroy Date: Sun, 13 Apr 2008 21:53:40 +0000 (+0000) Subject: git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg@217 83fadc84-e282... X-Git-Url: http://cameron1729.xyz/?a=commitdiff_plain;h=853f8d59e0e5f190c940cdd0ccb3ebe3e4e148d1;p=openitg.git git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg@217 83fadc84-e282-4d84-a09a-c4228d6ae7e5 --- diff --git a/src/ThemeManager.cpp b/src/ThemeManager.cpp index 21ef9b0c..e8f00903 100755 --- a/src/ThemeManager.cpp +++ b/src/ThemeManager.cpp @@ -150,26 +150,27 @@ void ThemeManager::GetThemeNames( CStringArray& AddTo ) } } +// FYI: GetThemeNames() apparently has a bug which makes the iteration neglect account +// for the last element in AddTo when removing "CVS". This is ok +// for the original GetThemeNames because "CVS" will most likely +// not be the last directory entry, however we need account for every +// theme available, even the last one. This is why "fallback" kept appearing +// in the theme switcher mod. --infamouspat void ThemeManager::GetDisplayableThemeNames( CStringArray& AddTo ) { - GetDirListing( THEMES_DIR + "*", AddTo, true ); - - if (AddTo.size() == 0) return; - CStringArray::iterator i = AddTo.begin(); - while (i != AddTo.end()) - { - if ( *i == "CVS" || !IsThemeSelectable(*i) ) - { - AddTo.erase(i, i+1); - } - i++; - } - if ( *i == "CVS" || !IsThemeSelectable(*i) ) + vector candidates; + GetThemeNames( candidates ); + FOREACH_CONST( CString, candidates, cand ) { - AddTo.erase(i, i+1); + if ( IsThemeSelectable(*cand) ) AddTo.push_back(*cand); } + } +// also, I'm assuming "Default" wants to be removed too because, in ITG's theme setup, +// if "Default" is called over "arcade", diagnostics and machine update will not work. +// Themers should also keep that in the back of their mind when making an ITG2AC-based theme. +// --infamouspat bool ThemeManager::IsThemeSelectable( const CString &sThemeName ) { LOG->Info("IsThemeSelectable(): %s", sThemeName.c_str() );