aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/cruise/font.cpp2
-rw-r--r--engines/cruise/function.cpp6
-rw-r--r--engines/cruise/script.cpp4
3 files changed, 5 insertions, 7 deletions
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index 80fb0e8a02..5c04154b01 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -89,7 +89,7 @@ int32 getTextLineCount(int32 rightBorder_X, int16 wordSpacingWidth,
if (lineLength > 0)
total += rightBorder_X;
- return (total / rightBorder_X);
+ return (total / (rightBorder_X == 0 ? 1 : rightBorder_X));
}
void loadFNT(const char *fileName) {
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 327dec4d6c..e0053ec017 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -87,9 +87,7 @@ int16 Op_Exec() {
int numOfArgToPop = popVar();
- int i = 0;
-
- for (i = 0; i < numOfArgToPop; i++) {
+ for (int i = 0; i < numOfArgToPop; i++) {
popTable[numOfArgToPop - i - 1] = popVar();
}
@@ -111,7 +109,7 @@ int16 Op_Exec() {
ptr2 = ptr;
- for (i = 0; i < numOfArgToPop; i++) {
+ for (int i = 0; i < numOfArgToPop; i++) {
WRITE_BE_UINT16(ptr2, popTable[i]);
ptr2 += 2;
}
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index 65da84b9ce..75cf428787 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -415,7 +415,7 @@ int32 opcodeType3() { // math
return (0);
}
case 1: {
- pushVar(pop1 / pop2);
+ pushVar(pop1 / (pop2 == 0 ? 1 : pop2));
return (0);
}
case 2: {
@@ -427,7 +427,7 @@ int32 opcodeType3() { // math
return (0);
}
case 4: {
- pushVar(pop1 % pop2);
+ pushVar(pop1 % (pop2 == 0 ? 1 : pop2));
return (0);
}
case 7: