Update comments, tidy.

This commit is contained in:
Jason Felds
2011-02-11 00:45:00 -05:00
parent 16d6138a62
commit 35748ed9a7
3 changed files with 24 additions and 15 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/* MsdFile - Read .SM, .DWI, and .MSD files. */ /* MsdFile - Read .SSC, .SM, .DWI, and .MSD files. */
#ifndef MSDFILE_H #ifndef MSDFILE_H
#define MSDFILE_H #define MSDFILE_H
+2 -2
View File
@@ -838,8 +838,8 @@ RageFileBasic *RageFileManager::OpenForWriting( const RString &sPath, int mode,
* *
* The purpose of this is to create files in the expected place. For example, if we * The purpose of this is to create files in the expected place. For example, if we
* have both C:/games/StepMania and C:/games/DWI loaded, and we're writing * have both C:/games/StepMania and C:/games/DWI loaded, and we're writing
* "Songs/Music/Waltz/waltz.sm", and the song was loaded out of * "Songs/Music/Waltz/waltz.ssc", and the song was loaded out of
* "C:/games/DWI/Songs/Music/Waltz/waltz.dwi", we want to write the new SM into the * "C:/games/DWI/Songs/Music/Waltz/waltz.dwi", we want to write the new SSC into the
* same directory (if possible). Don't split up files in the same directory any * same directory (if possible). Don't split up files in the same directory any
* more than we have to. * more than we have to.
* *
+21 -12
View File
@@ -709,7 +709,7 @@ void Song::TidyUpData()
{ {
/* Generated filename; this doesn't always point to a loadable file, /* Generated filename; this doesn't always point to a loadable file,
* but instead points to the file we should write changed files to, * but instead points to the file we should write changed files to,
* and will always be an .SM. * and will always be a .SSC.
* *
* This is a little tricky. We can't always use the song title directly, * This is a little tricky. We can't always use the song title directly,
* since it might contain characters we can't store in filenames. Two * since it might contain characters we can't store in filenames. Two
@@ -723,23 +723,32 @@ void Song::TidyUpData()
* but not KSFs and BMSs. * but not KSFs and BMSs.
* *
* So, let's do this (by priority): * So, let's do this (by priority):
* 1. If there's an .SM file, use that filename. No reason to use anything * 1. If there's a .SSC file, use that filename. No reason to use anything
* else; it's the filename in use. * else; it's the filename in use.
* 2. If there's a .DWI, use it with a changed extension. * 2. If there's an .SM, use it with a changed extension.
* 3. Otherwise, use the name of the directory, since it's definitely a valid * 3. If there's a .DWI, use it with a changed extension.
* 4. Otherwise, use the name of the directory, since it's definitely a valid
* filename, and should always be the title of the song (unlike KSFs). */ * filename, and should always be the title of the song (unlike KSFs). */
m_sSongFileName = m_sSongDir; m_sSongFileName = m_sSongDir;
vector<RString> asFileNames; vector<RString> asFileNames;
GetDirListing( m_sSongDir+"*.sm", asFileNames ); GetDirListing( m_sSongDir+"*.ssc", asFileNames );
if( !asFileNames.empty() ) if( !asFileNames.empty() )
{
m_sSongFileName += asFileNames[0]; m_sSongFileName += asFileNames[0];
else { }
GetDirListing( m_sSongDir+"*.dwi", asFileNames ); else
if( !asFileNames.empty() ) { {
m_sSongFileName += SetExtension( asFileNames[0], "sm" ); GetDirListing( m_sSongDir+"*.sm", asFileNames );
} else { if( !asFileNames.empty() )
m_sSongFileName += Basename(m_sSongDir); m_sSongFileName += SetExtension( asFileNames[0], "ssc" );
m_sSongFileName += ".sm"; else {
GetDirListing( m_sSongDir+"*.dwi", asFileNames );
if( !asFileNames.empty() ) {
m_sSongFileName += SetExtension( asFileNames[0], "ssc" );
} else {
m_sSongFileName += Basename(m_sSongDir);
m_sSongFileName += ".ssc";
}
} }
} }
} }