From ef61c64f3f84eb0e055593e1940fd1c2890a5dc9 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 6 Feb 2013 13:56:55 +0100 Subject: WINTERMUTE: Detach BaseQuickMsg from the class-hierarchy. (Remove useless inheritance) --- engines/wintermute/base/base_quick_msg.cpp | 14 ++++---------- engines/wintermute/base/base_quick_msg.h | 11 ++++++----- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp index 0a9907ac6b..50a9031eee 100644 --- a/engines/wintermute/base/base_quick_msg.cpp +++ b/engines/wintermute/base/base_quick_msg.cpp @@ -32,26 +32,20 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// -BaseQuickMsg::BaseQuickMsg(BaseGame *inGame, const char *text) : BaseClass(inGame) { - _text = new char [strlen(text) + 1]; - if (_text) { - strcpy(_text, text); - } +BaseQuickMsg::BaseQuickMsg(BaseGame *inGame, const char *text) { + _text = text; _startTime = _gameRef->_currentTime; } ////////////////////////////////////////////////////////////////////////// BaseQuickMsg::~BaseQuickMsg() { - if (_text) { - delete[] _text; - } } ////////////////////////////////////////////////////////////////////////// -char *BaseQuickMsg::getText() { - return _text; +const char *BaseQuickMsg::getText() const { + return _text.c_str(); } } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h index 67f9613461..0d342b3b12 100644 --- a/engines/wintermute/base/base_quick_msg.h +++ b/engines/wintermute/base/base_quick_msg.h @@ -29,18 +29,19 @@ #ifndef WINTERMUTE_BASE_QUICKMSG_H #define WINTERMUTE_BASE_QUICKMSG_H -#include "engines/wintermute/base/base.h" +#include "common/str.h" namespace Wintermute { - -class BaseQuickMsg : public BaseClass { +class BaseGame; +class BaseQuickMsg { public: - char *getText(); + const char *getText() const; uint32 _startTime; BaseQuickMsg(BaseGame *inGame, const char *text); virtual ~BaseQuickMsg(); private: - char *_text; + BaseGame *_gameRef; + Common::String _text; }; } // end of namespace Wintermute -- cgit v1.2.3