revert SubscriptionManager. It makes the line order nondeterministic.
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "LocalizedString.h"
|
||||
#include "Profile.h"
|
||||
#include "SongManager.h"
|
||||
#include "SubscriptionManager.h"
|
||||
#include "GameLoop.h"
|
||||
|
||||
static bool g_bIsDisplayed = false;
|
||||
@@ -35,20 +34,20 @@ static float g_fImageScaleDestination = 1;
|
||||
|
||||
//
|
||||
// self-registering debug lines
|
||||
// We don't use SubscriptionManager, because we want to keep the line order.
|
||||
//
|
||||
class IDebugLine;
|
||||
static SubscriptionManager<IDebugLine> g_Subscribers;
|
||||
static vector<IDebugLine*> *g_pvpSubscribers = NULL;
|
||||
class IDebugLine
|
||||
{
|
||||
public:
|
||||
IDebugLine()
|
||||
{
|
||||
g_Subscribers.Subscribe( this );
|
||||
}
|
||||
virtual ~IDebugLine()
|
||||
{
|
||||
g_Subscribers.Unsubscribe( this );
|
||||
if( g_pvpSubscribers == NULL )
|
||||
g_pvpSubscribers = new vector<IDebugLine*>;
|
||||
g_pvpSubscribers->push_back( this );
|
||||
}
|
||||
virtual ~IDebugLine() { }
|
||||
virtual RString GetDescription() = 0;
|
||||
virtual RString GetValue() = 0;
|
||||
virtual bool IsEnabled() = 0;
|
||||
@@ -168,7 +167,7 @@ void ScreenDebugOverlay::Init()
|
||||
m_textHeader.SetText( "Debug Menu" );
|
||||
this->AddChild( &m_textHeader );
|
||||
|
||||
FOREACHS_CONST( IDebugLine*, g_Subscribers.Get(), p )
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
{
|
||||
BitmapText *pT1 = new BitmapText;
|
||||
@@ -238,10 +237,11 @@ void ScreenDebugOverlay::UpdateText()
|
||||
const RageColor off(0.6f, 0.6f, 0.6f, 1.0f);
|
||||
const RageColor on(1, 1, 1, 1);
|
||||
|
||||
const unsigned NUM_DEBUG_LINES = g_Subscribers.Get().size();
|
||||
int i = 0;
|
||||
FOREACHS_CONST( IDebugLine*, g_Subscribers.Get(), p )
|
||||
const unsigned NUM_DEBUG_LINES = g_pvpSubscribers->size();
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
int i = p-g_pvpSubscribers->begin();
|
||||
|
||||
BitmapText &txt1 = *m_vptextButton[i];
|
||||
txt1.SetX( SCREEN_CENTER_X-50 );
|
||||
txt1.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) );
|
||||
@@ -267,8 +267,6 @@ void ScreenDebugOverlay::UpdateText()
|
||||
if( !s2.empty() )
|
||||
s1 += " - ";
|
||||
txt2.SetText( s1 + s2 );
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
if( g_bIsHalt )
|
||||
@@ -298,9 +296,10 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
|
||||
g_bIsDisplayed = false;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
FOREACHS_CONST( IDebugLine*, g_Subscribers.Get(), p )
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
int i = p-g_pvpSubscribers->begin();
|
||||
|
||||
if( (g_bIsDisplayed && input.DeviceI == g_Mappings.debugButton[i]) ||
|
||||
(IsGameplay() && input.DeviceI == g_Mappings.gameplayButton[i]) )
|
||||
{
|
||||
@@ -322,7 +321,6 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
|
||||
UpdateText();
|
||||
return true;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user