write Catalog.xml only after loading songs

get rid of try/catch in SongManager
get rid of try/catch in PrefsManager
This commit is contained in:
Chris Danford
2004-05-25 05:52:57 +00:00
parent 8e654b59ea
commit 962cdfc4f0
6 changed files with 29 additions and 37 deletions
+12 -18
View File
@@ -38,11 +38,13 @@
#include "CourseUtil.h"
#include "RageFileManager.h"
#include "UnlockSystem.h"
#include "CatalogXml.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
#define SONGS_DIR "Songs/"
#define COURSES_DIR "Courses/"
#define DATA_DIR "Data/"
#define MAX_EDITS_PER_PROFILE 200
@@ -80,24 +82,10 @@ static void UpdateMetrics()
EXTRA_COLOR_METER.Refresh();
}
SongManager::SongManager( LoadingWindow *ld )
SongManager::SongManager()
{
g_LastMetricUpdate.SetZero();
UpdateMetrics();
/* We initialize things that assume they can get at SONGMAN; we only
* init one of these, so hook us up to it immediately. */
SONGMAN = this;
try
{
InitSongsFromDisk( ld );
InitCoursesFromDisk( ld );
InitAutogenCourses();
} catch(...) {
SONGMAN = NULL;
throw;
}
}
SongManager::~SongManager()
@@ -106,6 +94,14 @@ SongManager::~SongManager()
FreeCourses();
}
void SongManager::InitAll( LoadingWindow *ld )
{
InitSongsFromDisk( ld );
InitCoursesFromDisk( ld );
InitAutogenCourses();
SaveCatalogXml( DATA_DIR );
}
void SongManager::Reload( LoadingWindow *ld )
{
FlushDirCache();
@@ -126,9 +122,7 @@ void SongManager::Reload( LoadingWindow *ld )
const bool OldVal = PREFSMAN->m_bFastLoad;
PREFSMAN->m_bFastLoad = false;
InitSongsFromDisk( ld );
InitCoursesFromDisk( ld );
InitAutogenCourses();
InitAll( ld );
// reload scores afterward
PROFILEMAN->LoadMachineProfile();