aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authormd52011-03-02 16:33:12 +0200
committermd52011-03-02 16:33:12 +0200
commit840178a9071971a816c0fa184e262dfff379fa07 (patch)
tree2cb2b7447c750f70e5d9f128e3a05cd675111403 /engines
parent36e3dede0f741a7b592a2ea7c2ff004723d33de7 (diff)
downloadscummvm-rg350-840178a9071971a816c0fa184e262dfff379fa07.tar.gz
scummvm-rg350-840178a9071971a816c0fa184e262dfff379fa07.tar.bz2
scummvm-rg350-840178a9071971a816c0fa184e262dfff379fa07.zip
SCI: Bug fixes to the reg_t addition operator
Thanks to fingolfin's comments regarding these
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/vm_types.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index dea4d63bf0..0fc8144da4 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -46,7 +46,7 @@ reg_t reg_t::lookForWorkaround(const reg_t right) const {
}
reg_t reg_t::operator+(const reg_t right) const {
- if (isPointer() && isInitialized()) {
+ if (isPointer()) {
// Pointer arithmetics. Only some pointer types make sense here
SegmentObj *mobj = g_sci->getEngineState()->_segMan->getSegmentObj(segment);
@@ -59,13 +59,13 @@ reg_t reg_t::operator+(const reg_t right) const {
case SEG_TYPE_STACK:
case SEG_TYPE_DYNMEM:
// Make sure that we are adding an offset to the pointer
- if (right.isPointer())
+ if (!right.isNumber())
return lookForWorkaround(right);
return make_reg(segment, offset + right.toSint16());
default:
return lookForWorkaround(right);
}
- } else if (isNumber() && isInitialized() && right.isPointer()) {
+ } else if (isNumber() && right.isPointer()) {
// Adding a pointer to a number, flip the order
return right + *this;
} else {