From a15ef652c35b939399afe24dae0bf5a206965767 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 31 May 2004 20:04:56 +0000 Subject: [PATCH] Attack::operator==, TrailEntry::operator== --- stepmania/src/Attack.cpp | 12 ++++++++++++ stepmania/src/Attack.h | 1 + stepmania/src/Trail.cpp | 14 ++++++++++++++ stepmania/src/Trail.h | 2 ++ 4 files changed, 29 insertions(+) diff --git a/stepmania/src/Attack.cpp b/stepmania/src/Attack.cpp index a2506552ff..3b0a04aff9 100644 --- a/stepmania/src/Attack.cpp +++ b/stepmania/src/Attack.cpp @@ -26,3 +26,15 @@ void Attack::GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBea RAGE_ASSERT_M( fEndBeat >= fStartBeat, ssprintf("%f >= %f", fEndBeat, fStartBeat) ); } + +bool Attack::operator== ( const Attack &rhs ) const +{ +#define EQUAL(a) (a==rhs.a) + return + EQUAL(level) && + EQUAL(fStartSecond) && + EQUAL(fSecsRemaining) && + EQUAL(sModifier) && + EQUAL(bOn) && + EQUAL(bGlobal); +} diff --git a/stepmania/src/Attack.h b/stepmania/src/Attack.h index 9a92fb0e78..0db3ef3e5e 100644 --- a/stepmania/src/Attack.h +++ b/stepmania/src/Attack.h @@ -18,6 +18,7 @@ struct Attack bool IsBlank() { return sModifier.empty(); } void MakeBlank() { sModifier=""; } Attack() { fStartSecond = -1; bOn = false; bGlobal = false; } + bool operator== ( const Attack &rhs ) const; }; typedef vector AttackArray; diff --git a/stepmania/src/Trail.cpp b/stepmania/src/Trail.cpp index a35a3ddef4..49db8355ae 100644 --- a/stepmania/src/Trail.cpp +++ b/stepmania/src/Trail.cpp @@ -32,6 +32,20 @@ void TrailEntry::GetAttackArray( AttackArray &out ) const out.insert( out.end(), Attacks.begin(), Attacks.end() ); } +bool TrailEntry::operator== ( const TrailEntry &rhs ) const +{ +#define EQUAL(a) (a==rhs.a) + return + EQUAL(pSong) && + EQUAL(pSteps) && + EQUAL(Modifiers) && + EQUAL(Attacks) && + EQUAL(bMystery) && + EQUAL(iLowMeter) && + EQUAL(iHighMeter) && + EQUAL(dc); +} + RadarValues Trail::GetRadarValues() const { RadarValues rv; diff --git a/stepmania/src/Trail.h b/stepmania/src/Trail.h index dbb2d3e850..e10e776b26 100644 --- a/stepmania/src/Trail.h +++ b/stepmania/src/Trail.h @@ -40,6 +40,8 @@ struct TrailEntry int iLowMeter; int iHighMeter; Difficulty dc; + bool operator== ( const TrailEntry &rhs ) const; + bool operator!= ( const TrailEntry &rhs ) const { return !(*this==rhs); } }; class Trail