Change TrailEntry so it uses a StepsID instead of a Steps*.

Now Edit Mode can change the Steps pointers without causing crashes
because of the Trails.  (Exception: deleted song or steps.)
This commit is contained in:
John Bauer
2006-11-10 05:47:10 +00:00
parent 5d2bf93725
commit 00b40c7468
3 changed files with 14 additions and 6 deletions
+8
View File
@@ -69,6 +69,7 @@ namespace StepsUtil
class StepsID
{
private:
StepsType st;
Difficulty dc;
RString sDescription;
@@ -89,6 +90,13 @@ public:
static void ClearCache();
StepsType GetStepsType() const { return st; }
bool operator==( const StepsID &other ) const
{
#define X(x) (x == other.x)
return X(st) && X(dc) && X(sDescription) && X(uHash);
#undef X
}
};
#endif
+3 -3
View File
@@ -21,7 +21,7 @@ bool TrailEntry::operator== ( const TrailEntry &rhs ) const
#define EQUAL(a) (a==rhs.a)
return
EQUAL(pSong) &&
EQUAL(pSteps) &&
EQUAL(m_StepsID) &&
EQUAL(Modifiers) &&
EQUAL(Attacks) &&
EQUAL(bSecret) &&
@@ -32,12 +32,12 @@ bool TrailEntry::operator== ( const TrailEntry &rhs ) const
Steps *TrailEntry::GetSteps() const
{
return pSteps;
return m_StepsID.ToSteps( pSong, false );
}
void TrailEntry::SetSteps(Steps *steps)
{
pSteps = steps;
m_StepsID.FromSteps( steps );
}
bool TrailEntry::ContainsTransformOrTurn() const
+3 -3
View File
@@ -4,8 +4,9 @@
#define TRAIL_H
#include "Attack.h"
#include "RadarValues.h"
#include "Difficulty.h"
#include "RadarValues.h"
#include "StepsUtil.h"
class Song;
class Steps;
@@ -16,7 +17,6 @@ struct TrailEntry
public:
TrailEntry():
pSong(NULL),
pSteps(NULL),
bSecret(false),
iLowMeter(-1),
iHighMeter(-1),
@@ -29,7 +29,7 @@ public:
bool ContainsTransformOrTurn() const;
Song* pSong;
Steps* pSteps;
StepsID m_StepsID;
RString Modifiers;
AttackArray Attacks;
bool bSecret; // show "???"