Handle all ops consistently for StopSegments.
If there is a reason why not all operators were implemented, I haven't seen one. Blame the Java experience within me.
This commit is contained in:
+16
-2
@@ -54,10 +54,24 @@ struct StopSegment
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operator!=( const StopSegment &other ) const { return !operator==(other); }
|
bool operator!=( const StopSegment &other ) const { return !operator==(other); }
|
||||||
|
// Delays need to come before stops to not render them pointless.
|
||||||
bool operator<( const StopSegment &other ) const
|
bool operator<( const StopSegment &other ) const
|
||||||
{
|
{
|
||||||
return ( m_iStartRow < other.m_iStartRow ) ||
|
return ( m_iStartRow < other.m_iStartRow ) ||
|
||||||
( m_iStartRow == other.m_iStartRow && m_bDelay );
|
( m_iStartRow == other.m_iStartRow && m_bDelay && !other.m_bDelay );
|
||||||
|
}
|
||||||
|
bool operator<=( const StopSegment &other ) const
|
||||||
|
{
|
||||||
|
return ( operator<(other) || operator==(other) );
|
||||||
|
}
|
||||||
|
bool operator>( const StopSegment &other ) const
|
||||||
|
{
|
||||||
|
return ( m_iStartRow > other.m_iStartRow ) ||
|
||||||
|
( m_iStartRow == other.m_iStartRow && !m_bDelay && other.m_bDelay );
|
||||||
|
}
|
||||||
|
bool operator>=( const StopSegment &other ) const
|
||||||
|
{
|
||||||
|
return ( operator>(other) || operator==(other) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user