Mostly cleanup, but allow lines starting with ';' in .ini files to be treated as comments.

This commit is contained in:
AJ Kelly
2010-03-26 01:02:49 -05:00
parent 50aa3e141e
commit 4bd7076334
6 changed files with 14 additions and 71 deletions
-2
View File
@@ -6,9 +6,7 @@
class Steps;
class Trail;
//
// Player number stuff
//
enum Difficulty
{
Difficulty_Beginner,
-57
View File
@@ -2,7 +2,6 @@
#include "FadingBanner.h"
#include "RageTextureManager.h"
#include "BannerCache.h"
#include "BackgroundCache.h"
#include "Song.h"
#include "RageLog.h"
#include "Course.h"
@@ -167,62 +166,6 @@ bool FadingBanner::LoadFromCachedBanner( const RString &path )
return bLowRes;
}
/* If this returns true, a low-resolution background was loaded, and the full-res
* background should be loaded later. */
/*
bool FadingBanner::LoadFromCachedBackground( const RString &path )
{
// If we're already on the given background, don't fade again.
if( path != "" && m_Banner[m_iIndexLatest].GetTexturePath() == path )
return false;
if( path == "" )
{
// xxx: should load fallback background
LoadFallback();
return false;
}
// If we're currently fading to the given banner, go through this again,
// which will cause the fade-in to be further delayed.
RageTextureID ID;
bool bLowRes = (PREFSMAN->m_BackgroundCache != BGCACHE_FULL);
if( !bLowRes )
{
ID = Sprite::SongBGTexture( path );
}
else
{
// Try to load the low quality version.
ID = BACKGROUNDCACHE->LoadCachedBackground( path );
}
if( !TEXTUREMAN->IsTextureRegistered(ID) )
{
/* Oops. We couldn't load a background quickly. We can load the actual
* background, but that's slow, so we don't want to do that when we're moving
* fast on the music wheel. In that case, we should just keep the background
* that's there (or load a "moving fast" background). Once we settle down,
* we'll get called again and load the real background. */
/*
if( m_bMovingFast )
return false;
if( IsAFile(path) )
Load( path );
else
LoadFallback();
return false;
}
Load( ID );
return bLowRes;
}
*/
void FadingBanner::LoadFromSong( const Song* pSong )
{
if( pSong == NULL )
+10 -8
View File
@@ -37,7 +37,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
while( 1 )
{
RString line;
/* Read lines until we reach a line that doesn't end in a backslash */
// Read lines until we reach a line that doesn't end in a backslash
while( true )
{
RString s;
@@ -47,7 +47,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
m_sError = f.GetError();
return false;
case 0:
return true; /* eof */
return true; // eof
}
utf8_remove_bom( s );
@@ -63,21 +63,23 @@ bool IniFile::ReadFile( RageFileBasic &f )
if( line.size() == 0 )
continue;
if( line[0] == ';' )
continue; // comment
if( line[0] == '#' )
continue; /* comment */
continue; // comment
if( line.size() > 1 && line[0] == '/' && line[1] == '/' )
continue; /* comment */
continue; // comment
if( line.size() > 1 && line[0] == '-' && line[1] == '-' )
continue; /* comment (Lua style) */
continue; // comment (Lua style)
if( line[0] == '[' && line[line.size()-1] == ']' )
{
/* New section. */
// New section.
keyname = line.substr(1, line.size()-2);
}
else
{
/* New value. */
// New value.
size_t iEqualIndex = line.find("=");
if( iEqualIndex != string::npos )
{
@@ -162,7 +164,7 @@ bool IniFile::DeleteKey(const RString &keyname)
bool IniFile::RenameKey(const RString &from, const RString &to)
{
/* If to already exists, do nothing. */
// If to already exists, do nothing.
if( GetChild(to) != NULL )
return false;
+1 -1
View File
@@ -13,7 +13,7 @@ class IniFile : public XNode
public:
IniFile();
/* Retrieve the filename of the last file loaded. */
// Retrieve the filename of the last file loaded.
RString GetPath() const { return m_sPath; }
const RString &GetError() const { return m_sError; }
+2 -2
View File
@@ -1071,8 +1071,8 @@ void ScreenGameplay::LoadNextSong()
// No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks();
/* If we're in battery mode, force FailImmediate. We assume in Player::Step that
* failed players can't step. */
/* If we're in battery mode, force FailImmediate. We assume in Player::Step
* that failed players can't step. */
if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType == SongOptions::LIFE_BATTERY )
{
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
+1 -1
View File
@@ -1153,7 +1153,7 @@ int main(int argc, char* argv[])
BANNERCACHE = new BannerCache;
//BACKGROUNDCACHE = new BackgroundCache;
/* depends on SONGINDEX: */
// depends on SONGINDEX:
SONGMAN = new SongManager;
SONGMAN->InitAll( pLoadingWindow ); // this takes a long time
CRYPTMAN = new CryptManager; // need to do this before ProfileMan