From a191c25a13006993405bea514660b4831bc207db Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 27 May 2008 17:40:30 +0000 Subject: [PATCH] readd missing operator= (needed for STL use) --- stepmania/src/BitmapText.cpp | 15 ++++++++++++--- stepmania/src/BitmapText.h | 1 + stepmania/src/MessageManager.cpp | 13 +++++++++++++ stepmania/src/MessageManager.h | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index c7a2d51f88..15f20c8a1a 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -66,10 +66,9 @@ BitmapText::~BitmapText() FONT->UnloadFont( m_pFont ); } -BitmapText::BitmapText( const BitmapText &cpy ): - Actor( cpy ) +BitmapText & BitmapText::operator=(const BitmapText &cpy) { - m_pFont = NULL; + Actor::operator=(cpy); #define CPY(a) a = cpy.a CPY( m_bUppercase ); @@ -96,6 +95,16 @@ BitmapText::BitmapText( const BitmapText &cpy ): m_pFont = FONT->CopyFont( cpy.m_pFont ); else m_pFont = NULL; + + return *this; +} + +BitmapText::BitmapText( const BitmapText &cpy ): + Actor( cpy ) +{ + m_pFont = NULL; + + *this = cpy; } void BitmapText::LoadFromNode( const XNode* pNode ) diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index 7758d8ee7f..28559110fd 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -15,6 +15,7 @@ class BitmapText : public Actor public: BitmapText(); BitmapText( const BitmapText &cpy ); + BitmapText &operator=(const BitmapText &cpy); virtual ~BitmapText(); virtual void LoadFromNode( const XNode* pNode ); diff --git a/stepmania/src/MessageManager.cpp b/stepmania/src/MessageManager.cpp index 6a1cfd09f7..c4125bb083 100644 --- a/stepmania/src/MessageManager.cpp +++ b/stepmania/src/MessageManager.cpp @@ -228,6 +228,19 @@ MessageSubscriber::MessageSubscriber( const MessageSubscriber &cpy ): this->SubscribeToMessage( *msg ); } +MessageSubscriber &MessageSubscriber::operator=(const MessageSubscriber &cpy) +{ + if(&cpy == this) + return *this; + + UnsubscribeAll(); + + FOREACH_CONST( RString, cpy.m_vsSubscribedTo, msg ) + this->SubscribeToMessage( *msg ); + + return *this; +} + void MessageSubscriber::SubscribeToMessage( const RString &sMessageName ) { MESSAGEMAN->Subscribe( this, sMessageName ); diff --git a/stepmania/src/MessageManager.h b/stepmania/src/MessageManager.h index 2a7247b7e1..59397afb8d 100644 --- a/stepmania/src/MessageManager.h +++ b/stepmania/src/MessageManager.h @@ -151,6 +151,7 @@ class MessageSubscriber : public IMessageSubscriber public: MessageSubscriber() {} MessageSubscriber( const MessageSubscriber &cpy ); + MessageSubscriber &operator=(const MessageSubscriber &cpy); // // Messages