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
|
class StepsID
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
StepsType st;
|
StepsType st;
|
||||||
Difficulty dc;
|
Difficulty dc;
|
||||||
RString sDescription;
|
RString sDescription;
|
||||||
@@ -89,6 +90,13 @@ public:
|
|||||||
static void ClearCache();
|
static void ClearCache();
|
||||||
|
|
||||||
StepsType GetStepsType() const { return st; }
|
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
|
#endif
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ bool TrailEntry::operator== ( const TrailEntry &rhs ) const
|
|||||||
#define EQUAL(a) (a==rhs.a)
|
#define EQUAL(a) (a==rhs.a)
|
||||||
return
|
return
|
||||||
EQUAL(pSong) &&
|
EQUAL(pSong) &&
|
||||||
EQUAL(pSteps) &&
|
EQUAL(m_StepsID) &&
|
||||||
EQUAL(Modifiers) &&
|
EQUAL(Modifiers) &&
|
||||||
EQUAL(Attacks) &&
|
EQUAL(Attacks) &&
|
||||||
EQUAL(bSecret) &&
|
EQUAL(bSecret) &&
|
||||||
@@ -32,12 +32,12 @@ bool TrailEntry::operator== ( const TrailEntry &rhs ) const
|
|||||||
|
|
||||||
Steps *TrailEntry::GetSteps() const
|
Steps *TrailEntry::GetSteps() const
|
||||||
{
|
{
|
||||||
return pSteps;
|
return m_StepsID.ToSteps( pSong, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrailEntry::SetSteps(Steps *steps)
|
void TrailEntry::SetSteps(Steps *steps)
|
||||||
{
|
{
|
||||||
pSteps = steps;
|
m_StepsID.FromSteps( steps );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TrailEntry::ContainsTransformOrTurn() const
|
bool TrailEntry::ContainsTransformOrTurn() const
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
#define TRAIL_H
|
#define TRAIL_H
|
||||||
|
|
||||||
#include "Attack.h"
|
#include "Attack.h"
|
||||||
#include "RadarValues.h"
|
|
||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
|
#include "RadarValues.h"
|
||||||
|
#include "StepsUtil.h"
|
||||||
|
|
||||||
class Song;
|
class Song;
|
||||||
class Steps;
|
class Steps;
|
||||||
@@ -16,7 +17,6 @@ struct TrailEntry
|
|||||||
public:
|
public:
|
||||||
TrailEntry():
|
TrailEntry():
|
||||||
pSong(NULL),
|
pSong(NULL),
|
||||||
pSteps(NULL),
|
|
||||||
bSecret(false),
|
bSecret(false),
|
||||||
iLowMeter(-1),
|
iLowMeter(-1),
|
||||||
iHighMeter(-1),
|
iHighMeter(-1),
|
||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
bool ContainsTransformOrTurn() const;
|
bool ContainsTransformOrTurn() const;
|
||||||
|
|
||||||
Song* pSong;
|
Song* pSong;
|
||||||
Steps* pSteps;
|
StepsID m_StepsID;
|
||||||
RString Modifiers;
|
RString Modifiers;
|
||||||
AttackArray Attacks;
|
AttackArray Attacks;
|
||||||
bool bSecret; // show "???"
|
bool bSecret; // show "???"
|
||||||
|
|||||||
Reference in New Issue
Block a user