This commit is contained in:
Glenn Maynard
2006-02-14 11:16:39 +00:00
parent 958299c734
commit 62a0ac1370
10 changed files with 42 additions and 45 deletions
+2 -2
View File
@@ -362,7 +362,7 @@ bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) c
ASSERT( bOK ); ASSERT( bOK );
} }
ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(), ASSERT_M( trail.m_vEntries.size() == SortTrail.m_vEntries.size(),
ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) ); ssprintf("%i %i", int(trail.m_vEntries.size()), int(SortTrail.m_vEntries.size())) );
vector<SortTrailEntry> entries; vector<SortTrailEntry> entries;
for( unsigned i = 0; i < trail.m_vEntries.size(); ++i ) for( unsigned i = 0; i < trail.m_vEntries.size(); ++i )
@@ -665,7 +665,7 @@ void Course::GetAllTrails( vector<Trail*> &AddTo ) const
int Course::GetMeter( StepsType st, CourseDifficulty cd ) const int Course::GetMeter( StepsType st, CourseDifficulty cd ) const
{ {
if( m_iCustomMeter[cd] != -1 ) if( m_iCustomMeter[cd] != -1 )
return m_iCustomMeter[cd]; return m_iCustomMeter[cd];
const Trail* pTrail = GetTrail( st ); const Trail* pTrail = GetTrail( st );
if( pTrail != NULL ) if( pTrail != NULL )
+2 -2
View File
@@ -45,7 +45,7 @@ bool DateTime::operator==( const DateTime& other ) const
DateTime DateTime::GetNowDateTime() DateTime DateTime::GetNowDateTime()
{ {
time_t now = time(NULL); time_t now = time(NULL);
tm tNow; tm tNow;
localtime_r( &now, &tNow ); localtime_r( &now, &tNow );
DateTime dtNow; DateTime dtNow;
#define COPY_M( v ) dtNow.v = tNow.v; #define COPY_M( v ) dtNow.v = tNow.v;
@@ -61,7 +61,7 @@ DateTime DateTime::GetNowDateTime()
DateTime DateTime::GetNowDate() DateTime DateTime::GetNowDate()
{ {
DateTime tNow = GetNowDateTime(); DateTime tNow = GetNowDateTime();
tNow.StripTime(); tNow.StripTime();
return tNow; return tNow;
} }
+1 -1
View File
@@ -87,7 +87,7 @@ static const RString EMPTY_STRING;
{ \ { \
RString s2 = s; \ RString s2 = s; \
s2.MakeLower(); \ s2.MakeLower(); \
unsigned i; \ unsigned i; \
for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \ for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \
if( !s2.CompareNoCase(X##Names[i]) ) \ if( !s2.CompareNoCase(X##Names[i]) ) \
return (X)i; \ return (X)i; \
+2 -2
View File
@@ -309,8 +309,8 @@ bool Font::FontCompleteForString( const wstring &str ) const
void Font::CapsOnly() void Font::CapsOnly()
{ {
/* For each uppercase character that we have a mapping for, add /* For each uppercase character that we have a mapping for, add
* a lowercase one. */ * a lowercase one. */
for(char c = 'A'; c <= 'Z'; ++c) for( char c = 'A'; c <= 'Z'; ++c )
{ {
map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(c); map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(c);
+5 -8
View File
@@ -283,14 +283,10 @@ void LifeMeterBar::AfterLifeChanged()
bool LifeMeterBar::IsPastPassmark() const bool LifeMeterBar::IsPastPassmark() const
{ {
if( m_pPlayerState->m_PlayerOptions.m_fPassmark > 0 ) if( m_pPlayerState->m_PlayerOptions.m_fPassmark > 0 )
{
return m_fLifePercentage >= m_pPlayerState->m_PlayerOptions.m_fPassmark; return m_fLifePercentage >= m_pPlayerState->m_PlayerOptions.m_fPassmark;
} else
else
{
return false; return false;
}
} }
bool LifeMeterBar::IsHot() const bool LifeMeterBar::IsHot() const
@@ -367,7 +363,8 @@ void LifeMeterBar::UpdateNonstopLifebar(const int cleared,
if (m_fLifeDifficulty >= 0.4) return; if (m_fLifeDifficulty >= 0.4) return;
/* Approximate deductions for a miss /*
* Approximate deductions for a miss
* Life 1 : 5 % * Life 1 : 5 %
* Life 2 : 5.7 % * Life 2 : 5.7 %
* Life 3 : 6.6 % * Life 3 : 6.6 %
@@ -389,7 +386,7 @@ void LifeMeterBar::UpdateNonstopLifebar(const int cleared,
* a miss, and a W5 would suck up half of your lifebar. * a miss, and a W5 would suck up half of your lifebar.
* *
* Everything past 7 is intended mainly for nonstop mode. * Everything past 7 is intended mainly for nonstop mode.
*/ */
// the lifebar is pretty harsh at 0.4 already (you lose // the lifebar is pretty harsh at 0.4 already (you lose
+5 -5
View File
@@ -19,12 +19,12 @@ void RageException::SetCleanupHandler( void (*pHandler)(const RString &sError) )
* the same way to code in practice. */ * the same way to code in practice. */
void RageException::Throw(const char *fmt, ...) void RageException::Throw(const char *fmt, ...)
{ {
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
RString error = vssprintf( fmt, va ); RString error = vssprintf( fmt, va );
va_end(va); va_end(va);
RString msg = ssprintf( RString msg = ssprintf(
"\n" "\n"
"//////////////////////////////////////////////////////\n" "//////////////////////////////////////////////////////\n"
"Exception: %s\n" "Exception: %s\n"
+2 -2
View File
@@ -13,7 +13,7 @@
RageFile::RageFile() RageFile::RageFile()
{ {
m_File = NULL; m_File = NULL;
} }
RageFile::RageFile( const RageFile &cpy ): RageFile::RageFile( const RageFile &cpy ):
@@ -73,7 +73,7 @@ bool RageFile::Open( const RString& path, int mode )
return false; return false;
} }
return true; return true;
} }
void RageFile::Close() void RageFile::Close()
+1 -1
View File
@@ -76,7 +76,7 @@ int RageFileObj::Seek( int offset, int whence )
int RageFileObj::Read( void *pBuffer, size_t iBytes ) int RageFileObj::Read( void *pBuffer, size_t iBytes )
{ {
int ret = 0; int ret = 0;
while( !m_bEOF && iBytes > 0 ) while( !m_bEOF && iBytes > 0 )
{ {
+18 -18
View File
@@ -169,8 +169,8 @@ void RageLog::SetShowLogOutput( bool show )
{ {
// create a new console window and attach standard handles // create a new console window and attach standard handles
AllocConsole(); AllocConsole();
freopen("CONOUT$","wb",stdout); freopen( "CONOUT$","wb", stdout );
freopen("CONOUT$","wb",stderr); freopen( "CONOUT$","wb", stderr );
} }
else else
{ {
@@ -181,32 +181,32 @@ void RageLog::SetShowLogOutput( bool show )
void RageLog::Trace( const char *fmt, ...) void RageLog::Trace( const char *fmt, ...)
{ {
va_list va; va_list va;
va_start(va, fmt); va_start( va, fmt );
RString sBuff = vssprintf( fmt, va ); RString sBuff = vssprintf( fmt, va );
va_end(va); va_end( va);
Write(0, sBuff); Write(0, sBuff );
} }
/* Use this for more important information; it'll always be included /* Use this for more important information; it'll always be included
* in crash dumps. */ * in crash dumps. */
void RageLog::Info( const char *fmt, ...) void RageLog::Info( const char *fmt, ...)
{ {
va_list va; va_list va;
va_start(va, fmt); va_start( va, fmt );
RString sBuff = vssprintf( fmt, va ); RString sBuff = vssprintf( fmt, va );
va_end(va); va_end( va );
Write(WRITE_TO_INFO, sBuff); Write( WRITE_TO_INFO, sBuff );
} }
void RageLog::Warn( const char *fmt, ...) void RageLog::Warn( const char *fmt, ...)
{ {
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
RString sBuff = vssprintf( fmt, va ); RString sBuff = vssprintf( fmt, va );
va_end(va); va_end(va);
Write( WRITE_TO_INFO | WRITE_LOUD, sBuff ); Write( WRITE_TO_INFO | WRITE_LOUD, sBuff );
} }
@@ -362,9 +362,9 @@ void RageLog::MapLog(const RString &key, const char *fmt, ...)
RString s; RString s;
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
s += vssprintf( fmt, va ); s += vssprintf( fmt, va );
va_end(va); va_end(va);
LogMaps[key] = s; LogMaps[key] = s;
UpdateMappedLog(); UpdateMappedLog();
+4 -4
View File
@@ -672,8 +672,8 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// formatting (using wsprintf style formatting) // formatting (using wsprintf style formatting)
// If they want a Format() function that safely handles string objects // If they want a Format() function that safely handles string objects
// without casting // without casting
void Format(const CT* szFmt, ...) void Format(const CT* szFmt, ...)
@@ -804,7 +804,7 @@ public:
MYTYPE Left(int nCount) const MYTYPE Left(int nCount) const
{ {
// Range check the count. // Range check the count.
nCount = max(0, min(nCount, static_cast<int>(this->size()))); nCount = max(0, min(nCount, static_cast<int>(this->size())));
return this->substr(0, static_cast<MYSIZE>(nCount)); return this->substr(0, static_cast<MYSIZE>(nCount));
@@ -867,7 +867,7 @@ public:
MYTYPE Right(int nCount) const MYTYPE Right(int nCount) const
{ {
// Range check the count. // Range check the count.
nCount = max(0, min(nCount, static_cast<int>(this->size()))); nCount = max(0, min(nCount, static_cast<int>(this->size())));
return this->substr(this->size()-static_cast<MYSIZE>(nCount)); return this->substr(this->size()-static_cast<MYSIZE>(nCount));