WINTERMUTE: Const'fy members of class SubtitleCard

This commit is contained in:
Tobia Tesan 2014-02-22 11:37:56 +01:00
parent 856e281bf1
commit 578edde66f
2 changed files with 15 additions and 14 deletions

View File

@ -31,27 +31,28 @@
namespace Wintermute {
SubtitleCard::SubtitleCard(BaseGame *inGame, const Common::String &text, const uint &startFrame, const uint &endFrame) {
SubtitleCard::SubtitleCard(BaseGame *inGame,
const Common::String &text,
const uint &startFrame,
const uint &endFrame) : _gameRef(inGame),
_startFrame(startFrame),
_endFrame(endFrame) {
// TODO: Fix expandStringByStringTable instead of this ugly hack
char *tmp = new char[text.size()];
strcpy(tmp, text.c_str());
_gameRef = inGame;
_gameRef->expandStringByStringTable(&tmp);
_text = Common::String(tmp);
_startFrame = startFrame;
_endFrame = endFrame;
}
uint32 SubtitleCard::getStartFrame() {
uint32 SubtitleCard::getStartFrame() const {
return _startFrame;
}
uint32 SubtitleCard::getEndFrame() {
uint32 SubtitleCard::getEndFrame() const {
return _endFrame;
}
Common::String SubtitleCard::getText() {
Common::String SubtitleCard::getText() const {
return _text;
}

View File

@ -38,13 +38,13 @@ class BaseGame;
class SubtitleCard {
public:
SubtitleCard(BaseGame *inGame, const Common::String &text, const uint &startFrame, const uint &endFrame);
uint32 getEndFrame();
uint32 getStartFrame();
Common::String getText();
uint32 getEndFrame() const;
uint32 getStartFrame() const;
Common::String getText() const;
private:
BaseGame* _gameRef;
uint32 _endFrame;
uint32 _startFrame;
const BaseGame* _gameRef;
const uint32 _endFrame;
const uint32 _startFrame;
Common::String _text;
};