From 3899532440d2d532fda60cc6fb8568e1e6d9eeb3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 10 Oct 2014 14:52:10 +0200 Subject: [PATCH] PRINCE: Revert incorrect const'ness at printAt() --- engines/prince/prince.cpp | 13 +++++-------- engines/prince/prince.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 7aa4ef145d6..afa5f34a954 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -1125,21 +1125,18 @@ int PrinceEngine::checkMob(Graphics::Surface *screen, Common::Array &mobLis return mobNumber; } -void PrinceEngine::printAt(uint32 slot, uint8 color, const char *s, uint16 x, uint16 y) { +void PrinceEngine::printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y) { debugC(1, DebugChannel::kEngine, "PrinceEngine::printAt slot %d, color %d, x %02d, y %02d, str %s", slot, color, x, y, s); - char tmpStr[1024]; - strncpy(tmpStr, s, 1024); - if (getLanguage() == Common::DE_DEU) - correctStringDEU(tmpStr); + correctStringDEU(s); Text &text = _textSlots[slot]; - text._str = tmpStr; + text._str = s; text._x = x; text._y = y; text._color = color; - int lines = calcTextLines(tmpStr); + int lines = calcTextLines(s); text._time = calcTextTime(lines); } @@ -2473,7 +2470,7 @@ void PrinceEngine::inventoryLeftMouseButton() { int invObjExamEvent = _script->scanMobEvents(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjExam); if (invObjExamEvent == -1) { // do_standard - printAt(0, 216, _invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY); + printAt(0, 216, (char *)_invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY); _interpreter->setCurrentString(_invMobList[_selectedMob]._mask + 70000); setVoice(0, 28, 1); playSample(28, 0); diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 7143251b4f8..0e5bf97dde7 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -308,7 +308,7 @@ public: virtual GUI::Debugger *getDebugger(); void changeCursor(uint16 curId); - void printAt(uint32 slot, uint8 color, const char *s, uint16 x, uint16 y); + void printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y); int calcTextLines(const char *s); int calcTextTime(int numberOfLines); void correctStringDEU(char *s);