aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2014-10-10 14:34:14 +0200
committerEugene Sandulenko2014-10-10 14:34:14 +0200
commit430c271b878ce4f5596ee4e8f2c07c432d5e7e17 (patch)
tree5c7e70361d4d1b5a0abfbb04e25f1c219081ccce /engines
parent44c90d31d74cc6954d7c2efc49f4e6492085e357 (diff)
downloadscummvm-rg350-430c271b878ce4f5596ee4e8f2c07c432d5e7e17.tar.gz
scummvm-rg350-430c271b878ce4f5596ee4e8f2c07c432d5e7e17.tar.bz2
scummvm-rg350-430c271b878ce4f5596ee4e8f2c07c432d5e7e17.zip
PRINCE: Fix const'ness
Diffstat (limited to 'engines')
-rw-r--r--engines/prince/prince.cpp18
-rw-r--r--engines/prince/prince.h2
2 files changed, 12 insertions, 8 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index ea4869e48b..fb6ba511c6 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1125,17 +1125,21 @@ int PrinceEngine::checkMob(Graphics::Surface *screen, Common::Array<Mob> &mobLis
return mobNumber;
}
-void PrinceEngine::printAt(uint32 slot, uint8 color, char *s, uint16 x, uint16 y) {
+void PrinceEngine::printAt(uint32 slot, uint8 color, const 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);
- if (getLanguage() == Common::DE_DEU) {
- correctStringDEU(s);
- }
+
+ char tmpStr[1024];
+ strncpy(tmpStr, s, 1024);
+
+ if (getLanguage() == Common::DE_DEU)
+ correctStringDEU(tmpStr);
+
Text &text = _textSlots[slot];
- text._str = s;
+ text._str = tmpStr;
text._x = x;
text._y = y;
text._color = color;
- int lines = calcTextLines(s);
+ int lines = calcTextLines(tmpStr);
text._time = calcTextTime(lines);
}
@@ -2469,7 +2473,7 @@ void PrinceEngine::inventoryLeftMouseButton() {
int invObjExamEvent = _script->scanMobEvents(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjExam);
if (invObjExamEvent == -1) {
// do_standard
- printAt(0, 216, (char *)_invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY);
+ printAt(0, 216, _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 9e892f1206..e443ebd38a 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, char *s, uint16 x, uint16 y);
+ void printAt(uint32 slot, uint8 color, const char *s, uint16 x, uint16 y);
int calcTextLines(const char *s);
int calcTextTime(int numberOfLines);
void correctStringDEU(char *s);