aboutsummaryrefslogtreecommitdiff
path: root/engines/prince
diff options
context:
space:
mode:
authorAdrian Frühwirth2018-05-05 23:58:16 +0200
committerAdrian Frühwirth2018-05-06 00:00:38 +0200
commitb09dab8c9fc6e4d3af35d154921a03c9511dd688 (patch)
treec63e8877e8ed94396c06ee31690853caa48dc8e3 /engines/prince
parent13a08a0bb0ac9153e7f597bf7b906329548024e3 (diff)
downloadscummvm-rg350-b09dab8c9fc6e4d3af35d154921a03c9511dd688.tar.gz
scummvm-rg350-b09dab8c9fc6e4d3af35d154921a03c9511dd688.tar.bz2
scummvm-rg350-b09dab8c9fc6e4d3af35d154921a03c9511dd688.zip
PRINCE: Add FIXMEs for potential bugs
Diffstat (limited to 'engines/prince')
-rw-r--r--engines/prince/inventory.cpp3
-rw-r--r--engines/prince/script.cpp12
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/prince/inventory.cpp b/engines/prince/inventory.cpp
index fdb17b1182..3183b94334 100644
--- a/engines/prince/inventory.cpp
+++ b/engines/prince/inventory.cpp
@@ -394,6 +394,9 @@ void PrinceEngine::inventoryLeftMouseButton() {
int invObjExamEvent = _script->scanMobEvents(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjExam);
if (invObjExamEvent == -1) {
// do_standard
+ // FIXME: UB?
+ // Constness of the pointer returned by c_str() is cast away (which generates a compiler warning)
+ // while it potentially gets modified inside printAt()
printAt(0, 216, (char *)_invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY);
_interpreter->setCurrentString(_invMobList[_selectedMob]._mask + 70000);
setVoice(0, 28, 1);
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index e40492fe27..d6d325181c 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1015,6 +1015,12 @@ void Interpreter::O_XORFLAG() {
void Interpreter::O_GETMOBTEXT() {
int32 mob = readScriptFlagValue();
_currentString = _vm->_locationNr * 100 + mob + 60001;
+ // FIXME: UB?
+ // This casts away the constness of the pointer returned by c_str() which is
+ // stored and potentially modified later (for example in printAt()).
+ // Also, the pointer is only valid as long as _vm->_mobList[mob]
+ // is around and _vm->_mobList[mob]._examText hasn't been modified by any of its
+ // non-const member functions which also might or might not be a problem.
_string = (byte *)_vm->_mobList[mob]._examText.c_str();
debugInterpreter("O_GETMOBTEXT mob %d", mob);
}
@@ -1831,6 +1837,12 @@ void Interpreter::O_DISABLENAK() {
void Interpreter::O_GETMOBNAME() {
int32 modId = readScriptFlagValue();
+ // FIXME: UB?
+ // This casts away the constness of the pointer returned by c_str() which is
+ // stored and potentially modified later (for example in printAt()).
+ // Also, the pointer is only valid as long as _vm->_mobList[mobId]
+ // is around and _vm->_mobList[mobId]._name hasn't been modified by any of its
+ // non-const member functions which also might or might not be a problem.
_string = (byte *)_vm->_mobList[modId]._name.c_str();
debugInterpreter("O_GETMOBNAME modId %d", modId);
}