These are also not member variables. If you only need a value in a function, just make it a local variable.

This commit is contained in:
Steve Checkoway
2007-02-14 10:50:13 +00:00
parent cb57db0d03
commit d4cd093daf
2 changed files with 31 additions and 35 deletions
+31 -31
View File
@@ -69,8 +69,8 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
return false; return false;
} }
m_iTickCount = -1; // this is the value we read for TICKCOUNT int iTickCount = -1; // this is the value we read for TICKCOUNT
m_vNoteRows.clear(); //Start from a clean slate. vector<RString> vNoteRows;
for( unsigned i=0; i<msd.GetNumValues(); i++ ) for( unsigned i=0; i<msd.GetNumValues(); i++ )
{ {
@@ -80,10 +80,10 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
// handle the data // handle the data
if( 0==stricmp(sValueName,"TICKCOUNT") ) if( 0==stricmp(sValueName,"TICKCOUNT") )
{ {
m_iTickCount = atoi( sParams[1] ); iTickCount = atoi( sParams[1] );
if( m_iTickCount <= 0 ) if( iTickCount <= 0 )
{ {
LOG->UserLog( "Song file", sPath, "has an invalid tick count: %d.", m_iTickCount ); LOG->UserLog( "Song file", sPath, "has an invalid tick count: %d.", iTickCount );
return false; return false;
} }
} }
@@ -91,7 +91,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
{ {
RString theSteps = sParams[1]; RString theSteps = sParams[1];
TrimLeft( theSteps ); TrimLeft( theSteps );
split( theSteps, "\n", m_vNoteRows, true ); split( theSteps, "\n", vNoteRows, true );
} }
else if( 0==stricmp(sValueName,"DIFFICULTY") ) else if( 0==stricmp(sValueName,"DIFFICULTY") )
{ {
@@ -99,10 +99,10 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
} }
} }
if( m_iTickCount == -1 ) if( iTickCount == -1 )
{ {
m_iTickCount = 2; iTickCount = 2;
LOG->UserLog( "Song file", sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", m_iTickCount ); LOG->UserLog( "Song file", sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", iTickCount );
} }
NoteData notedata; // read it into here NoteData notedata; // read it into here
@@ -163,13 +163,13 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
for( t=0; t<13; t++ ) for( t=0; t<13; t++ )
iHoldStartRow[t] = -1; iHoldStartRow[t] = -1;
m_bTickChangeNeeded = false; bool bTickChangeNeeded = false;
int newTick = -1; int newTick = -1;
float fCurBeat = 0.0f; float fCurBeat = 0.0f;
float prevBeat = 0.0f; // Used for hold tails. float prevBeat = 0.0f; // Used for hold tails.
for( unsigned r=0; r<m_vNoteRows.size(); r++ ) for( unsigned r=0; r<vNoteRows.size(); r++ )
{ {
RString& sRowString = m_vNoteRows[r]; RString& sRowString = vNoteRows[r];
StripCrnl( sRowString ); StripCrnl( sRowString );
if( sRowString == "" ) if( sRowString == "" )
@@ -209,7 +209,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
{ {
RString temp = sRowString.substr(2,sRowString.size()-3); RString temp = sRowString.substr(2,sRowString.size()-3);
newTick = atoi(temp); newTick = atoi(temp);
m_bTickChangeNeeded = true; bTickChangeNeeded = true;
continue; continue;
} }
else else
@@ -225,10 +225,10 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
sRowString.erase( 0, 2 ); sRowString.erase( 0, 2 );
// Update TICKCOUNT for Direct Move files. // Update TICKCOUNT for Direct Move files.
if( m_bTickChangeNeeded ) if( bTickChangeNeeded )
{ {
m_iTickCount = newTick; iTickCount = newTick;
m_bTickChangeNeeded = false; bTickChangeNeeded = false;
} }
for( t=0; t < notedata.GetNumTracks(); t++ ) for( t=0; t < notedata.GetNumTracks(); t++ )
@@ -268,7 +268,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
notedata.SetTapNote(t, BeatToNoteRow(fCurBeat), tap); notedata.SetTapNote(t, BeatToNoteRow(fCurBeat), tap);
} }
prevBeat = fCurBeat; prevBeat = fCurBeat;
fCurBeat = prevBeat + 1.0f / m_iTickCount; fCurBeat = prevBeat + 1.0f / iTickCount;
} }
/* We need to remove holes where the BPM increases. */ /* We need to remove holes where the BPM increases. */
@@ -341,9 +341,9 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
} }
float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1; float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;
m_iTickCount = -1; int iTickCount = -1;
m_bKIUCompliant = false; m_bKIUCompliant = false;
m_vNoteRows.clear(); vector<RString> vNoteRows;
for( unsigned i=0; i < msd.GetNumValues(); i++ ) for( unsigned i=0; i < msd.GetNumValues(); i++ )
{ {
@@ -398,8 +398,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
{ {
/* TICKCOUNT is will be used below if there are DM complient BPM changes and stops. /* TICKCOUNT is will be used below if there are DM complient BPM changes and stops.
* It will be called again in LoadFromKSFFile for the actual steps. */ * It will be called again in LoadFromKSFFile for the actual steps. */
m_iTickCount = atoi( sParams[1] ); iTickCount = atoi( sParams[1] );
m_iTickCount = m_iTickCount > 0 ? m_iTickCount : 2; iTickCount = iTickCount > 0 ? iTickCount : 2;
} }
else if ( 0==stricmp(sValueName,"STEP") ) else if ( 0==stricmp(sValueName,"STEP") )
{ {
@@ -407,7 +407,7 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
* the Direct Move syntax, it is best to get the rows of notes here. */ * the Direct Move syntax, it is best to get the rows of notes here. */
RString theSteps = sParams[1]; RString theSteps = sParams[1];
TrimLeft( theSteps ); TrimLeft( theSteps );
split( theSteps, "\n", m_vNoteRows, true ); split( theSteps, "\n", vNoteRows, true );
} }
else if( 0==stricmp(sValueName,"DIFFICULTY")) else if( 0==stricmp(sValueName,"DIFFICULTY"))
@@ -450,17 +450,17 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
else else
{ {
int tickToChange = m_iTickCount; int tickToChange = iTickCount;
float fCurBeat = 0.0f; float fCurBeat = 0.0f;
float speedToChange = 0.0f, timeToStop = 0.0f; float speedToChange = 0.0f, timeToStop = 0.0f;
bool bDMRequired = false; bool bDMRequired = false;
bool bBPMChangeNeeded = false; bool bBPMChangeNeeded = false;
bool bBPMStopNeeded = false; bool bBPMStopNeeded = false;
m_bTickChangeNeeded = false; bool bTickChangeNeeded = false;
for (unsigned i=0; i < m_vNoteRows.size(); i++) for (unsigned i=0; i < vNoteRows.size(); i++)
{ {
RString& NoteRowString = m_vNoteRows[i]; RString& NoteRowString = vNoteRows[i];
StripCrnl( NoteRowString ); StripCrnl( NoteRowString );
if( NoteRowString == "" ) if( NoteRowString == "" )
@@ -484,7 +484,7 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
float numTemp = StringToFloat(temp); float numTemp = StringToFloat(temp);
if (BeginsWith(NoteRowString, "|T")) if (BeginsWith(NoteRowString, "|T"))
{ {
m_bTickChangeNeeded = true; bTickChangeNeeded = true;
tickToChange = (int)numTemp; tickToChange = (int)numTemp;
continue; continue;
} }
@@ -510,10 +510,10 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
} }
} }
if( m_bTickChangeNeeded ) if( bTickChangeNeeded )
{ {
m_iTickCount = tickToChange; iTickCount = tickToChange;
m_bTickChangeNeeded = false; bTickChangeNeeded = false;
} }
if( bBPMChangeNeeded ) if( bBPMChangeNeeded )
{ {
@@ -527,7 +527,7 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
out.AddStopSegment( StopSegment(BeatToNoteRow(fCurBeat),timeToStop) ); out.AddStopSegment( StopSegment(BeatToNoteRow(fCurBeat),timeToStop) );
bBPMStopNeeded = false; bBPMStopNeeded = false;
} }
fCurBeat += 1.0f / m_iTickCount; fCurBeat += 1.0f / iTickCount;
} }
} }
-4
View File
@@ -22,10 +22,6 @@ public:
private: private:
bool m_bKIUCompliant; bool m_bKIUCompliant;
bool m_bTickChangeNeeded;
int m_iTickCount;
vector<RString> m_vNoteRows;
}; };
#endif #endif