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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 "???"
|
||||
|
||||
Reference in New Issue
Block a user