Make all uses of the Steps* in the TrailEntry class use an accessor method.

This makes it simple to switch to something else, such as using a StepsId
instead of a Steps*.
This commit is contained in:
John Bauer
2006-11-10 05:04:09 +00:00
parent 2c14373639
commit 5d2bf93725
7 changed files with 24 additions and 11 deletions
+2 -2
View File
@@ -349,7 +349,7 @@ bool Course::GetTrailSorted( StepsType st, CourseDifficulty cd, Trail &trail ) c
{
SortTrailEntry ste;
ste.entry = trail.m_vEntries[i];
ste.SortMeter = SortTrail.m_vEntries[i].pSteps->GetMeter();
ste.SortMeter = SortTrail.m_vEntries[i].GetSteps()->GetMeter();
entries.push_back( ste );
}
@@ -567,7 +567,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
TrailEntry te;
te.pSong = resolved.pSong;
te.pSteps = resolved.pSteps;
te.SetSteps(resolved.pSteps);
te.Modifiers = e->sModifiers;
te.Attacks = e->attacks;
te.bSecret = e->bSecret;
+1 -1
View File
@@ -173,7 +173,7 @@ void CourseEntryDisplay::SetFromGameState( int iCourseEntryIndex )
const TrailEntry *te = tes[pn];
if( te == NULL )
continue;
SetDifficulty( pn, ssprintf("%d", te->pSteps->GetMeter()), te->pSteps->GetDifficulty() );
SetDifficulty( pn, ssprintf("%d", te->GetSteps()->GetMeter()), te->GetSteps()->GetDifficulty() );
}
m_TextBanner.LoadFromSong( te->pSong );
+1 -1
View File
@@ -630,7 +630,7 @@ bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail )
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
if( e->pSong && IsEasierForSongAndSteps(e->pSong, e->pSteps, PLAYER_1) )
if( e->pSong && IsEasierForSongAndSteps(e->pSong, e->GetSteps(), PLAYER_1) )
return true;
}
return false;
+2 -2
View File
@@ -850,8 +850,8 @@ void ScreenGameplay::InitSongQueues()
pi->m_asModifiersQueue.clear();
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{
ASSERT( e->pSteps );
pi->m_vpStepsQueue.push_back( e->pSteps );
ASSERT( e->GetSteps() );
pi->m_vpStepsQueue.push_back( e->GetSteps() );
AttackArray a;
e->GetAttackArray( a );
pi->m_asModifiersQueue.push_back( a );
+1 -1
View File
@@ -1144,7 +1144,7 @@ bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, RString sPreferredG
}
pSongOut = pTrail->m_vEntries[0].pSong;
pStepsOut = pTrail->m_vEntries[0].pSteps;
pStepsOut = pTrail->m_vEntries[0].GetSteps();
return true;
}
+12 -2
View File
@@ -30,6 +30,16 @@ bool TrailEntry::operator== ( const TrailEntry &rhs ) const
EQUAL(dc);
}
Steps *TrailEntry::GetSteps() const
{
return pSteps;
}
void TrailEntry::SetSteps(Steps *steps)
{
pSteps = steps;
}
bool TrailEntry::ContainsTransformOrTurn() const
{
PlayerOptions po;
@@ -68,7 +78,7 @@ const RadarValues &Trail::GetRadarValues() const
FOREACH_CONST( TrailEntry, m_vEntries, e )
{
const Steps *pSteps = e->pSteps;
const Steps *pSteps = e->GetSteps();
ASSERT( pSteps );
/* Hack: don't calculate for autogen entries; it makes writing Catalog.xml
* take way too long. (Tournamix 4 Sample.crs takes me ~10s.) */
@@ -120,7 +130,7 @@ int Trail::GetTotalMeter() const
int iTotalMeter = 0;
FOREACH_CONST( TrailEntry, m_vEntries, e )
{
iTotalMeter += e->pSteps->GetMeter();
iTotalMeter += e->GetSteps()->GetMeter();
}
return iTotalMeter;
+5 -2
View File
@@ -13,6 +13,7 @@ struct lua_State;
struct TrailEntry
{
public:
TrailEntry():
pSong(NULL),
pSteps(NULL),
@@ -22,7 +23,10 @@ struct TrailEntry
dc(Difficulty_Invalid)
{
}
void GetAttackArray( AttackArray &out ) const;
void GetAttackArray( AttackArray &out ) const;
Steps* GetSteps() const;
void SetSteps(Steps *steps);
bool ContainsTransformOrTurn() const;
Song* pSong;
Steps* pSteps;
@@ -37,7 +41,6 @@ struct TrailEntry
Difficulty dc;
bool operator== ( const TrailEntry &rhs ) const;
bool operator!= ( const TrailEntry &rhs ) const { return !(*this==rhs); }
bool ContainsTransformOrTurn() const;
};
class Trail