Skip to content

Commit

Permalink
MORTEVIELLE: Silent the remaining errors reported by CppCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Apr 6, 2012
1 parent be68aad commit 7ebfcb1
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 86 deletions.
74 changes: 35 additions & 39 deletions engines/mortevielle/mor.cpp
Expand Up @@ -178,14 +178,10 @@ void ecrf2() {
}

void ecr2(Common::String str_) {
int tab;

if (res == 1)
tab = 10;
else
tab = 6;
// Some dead code was present in the original: removed
g_vm->_screenSurface.putxy(8, 177);
int tlig = 59 + (res - 1) * 36;

if ((int)str_.size() < tlig)
g_vm->_screenSurface.writeg(str_, 5);
else if ((int)str_.size() < (tlig << 1)) {
Expand Down Expand Up @@ -339,7 +335,6 @@ void repon(int f, int m) {
Common::String str_;
Common::String str1;
Common::String tmpStr;
int i, xco, dx, caspe;

if ((m > 499) && (m < 563)) {
tmpStr = deline(m - 501 + c_st41);
Expand Down Expand Up @@ -372,6 +367,7 @@ void repon(int f, int m) {
}
}
if ((f == 6) || (f == 9)) {
int i;
if (f == 6)
i = 4;
else
Expand All @@ -389,6 +385,8 @@ void repon(int f, int m) {
if (f == 7) { /* messint */
ecrf7();
tmpStr = deline(m);

int xco, dx, caspe;
if (res == 1) {
xco = 252 - tmpStr.size() * 5;
caspe = 100;
Expand Down Expand Up @@ -516,7 +514,11 @@ void cpl1(int &p) {
int j, h, m;

calch(j, h, m);
if ((h > 7) || (h < 11))
// The original uses an || instead of an &&, resulting
// in an always true condition. Based on the other tests,
// and on other scenes, we use an && instead.
// if ((h > 7) || (h < 11))
if ((h > 7) && (h < 11))
p = 25;
else if ((h > 10) && (h < 14))
p = 35;
Expand Down Expand Up @@ -810,11 +812,10 @@ void quelq6(int l) {
}

void quelq10(int h, int &per) {
int min = 0, max = 0;

if ((h >= 0) && (h < 8))
chlm(per);
else {
int min = 0, max = 0;
if ((h > 7) && (h < 10)) {
min = 5;
max = 7;
Expand All @@ -834,11 +835,10 @@ void quelq10(int h, int &per) {
}

void quelq11(int h, int &per) {
int min = 0, max = 0;

if ((h >= 0) && (h < 8))
chlm(per);
else {
int min = 0, max = 0;
if (((h > 7) && (h < 10)) || ((h > 20) && (h < 24))) {
min = 1;
max = 3;
Expand Down Expand Up @@ -882,11 +882,10 @@ void quelq15(int &per) {
}

void quelq20(int h, int &per) {
int min = 0, max = 0;

if (((h >= 0) && (h < 10)) || ((h > 18) && (h < 24)))
chlm(per);
else {
int min = 0, max = 0;
if ((h > 9) && (h < 12)) {
min = 3;
max = 7;
Expand All @@ -904,13 +903,13 @@ void quelq20(int h, int &per) {


void frap() {
int j, h, m, haz;
int j, h, m;

calch(j, h, m);
if ((h >= 0) && (h < 8))
crep = 190;
else {
haz = hazard(1, 100);
int haz = hazard(1, 100);
if (haz > 70)
crep = 190;
else
Expand Down Expand Up @@ -993,10 +992,8 @@ void ecfren(int &p, int &haz, int cf, int l) {
}

void becfren(int l) {
int haz;

if ((l == 1) || (l == 4)) {
haz = hazard(1, 2);
int haz = hazard(1, 2);
if (l == 1)
if (haz == 1)
bh1 = true;
Expand Down Expand Up @@ -1092,11 +1089,11 @@ void dprog() {
}

void pl1(int cf) {
int p, haz;

if (((li == 1) && (! bh1) && (! bf1)) || ((li == 4) && (! bh4) && (! bf4))) {
int p, haz;
cpl1(p);
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand All @@ -1105,11 +1102,11 @@ void pl1(int cf) {
}

void pl2(int cf) {
int p, haz;

if (! bh2) {
int p, haz;
cpl2(p);
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand All @@ -1118,11 +1115,11 @@ void pl2(int cf) {
}

void pl5(int cf) {
int p, haz;

if (! bh5) {
int p, haz;
cpl5(p);
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand All @@ -1131,11 +1128,11 @@ void pl5(int cf) {
}

void pl6(int cf) {
int p, haz;

if (((li == 6) && (! bh6)) || ((li == 8) && (! bh8))) {
int p, haz;
cpl6(p);
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand All @@ -1144,11 +1141,11 @@ void pl6(int cf) {
}

void pl9(int cf) {
int p, haz;

if (! bh9) {
cf = -10;
int p, haz;
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand All @@ -1158,9 +1155,9 @@ void pl9(int cf) {

void pl10(int cf) {
int p, h, haz;

cpl10(p, h);
phaz(haz, p, cf);

if (haz > p)
person();
else
Expand Down Expand Up @@ -1223,7 +1220,7 @@ void pl20(int cf) {
}

void t11(int l11, int &a) {
int p, haz, h = 0;
int p, haz;

ecfren(p, haz, s.conf, l11);
li = l11;
Expand All @@ -1244,6 +1241,7 @@ void t11(int l11, int &a) {
if ((l11 > 15) && (l11 != 20) && (l11 != 26))
person();
else {
int h = 0;
if (l11 == 10)
cpl10(p, h);
if (l11 == 11)
Expand Down Expand Up @@ -1312,6 +1310,7 @@ void writetp(Common::String s, int t) {
*/
void messint(int nu) {
// Method is deprecated
warning("DEPRECATED: messint");
}

void aniof(int ouf, int num) {
Expand Down Expand Up @@ -1339,34 +1338,31 @@ void aniof(int ouf, int num) {
}

void musique(int so) {
bool i;
int haz;

if (so == 0) {
/* musik(0) */
;
} else if ((prebru == 0) && (! s.ipre)) {
parole(10, 1, 1);
++prebru;
} else {
i = false;
bool i = false;
if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22)) {
haz = hazard(1, 3);
int haz = hazard(1, 3);
if (haz == 2) {
haz = hazard(2, 4);
parole(9, haz, 1);
i = true;
}
}
if (s.mlieu == 20) {
haz = hazard(1, 2);
int haz = hazard(1, 2);
if (haz == 1) {
parole(8, 1, 1);
i = true;
}
}
if (s.mlieu == 24) {
haz = hazard(1, 2);
int haz = hazard(1, 2);
if (haz == 2) {
parole(12, 1, 1);
i = true;
Expand All @@ -1377,7 +1373,7 @@ void musique(int so) {
i = true;
}
if (! i) {
haz = hazard(1, 17);
int haz = hazard(1, 17);
parole(haz, 1, 2);
}
}
Expand Down
29 changes: 14 additions & 15 deletions engines/mortevielle/mor2.cpp
Expand Up @@ -46,9 +46,8 @@ void tinke() {
const char d4 = ']';
const char d5 = '1';
Common::String d6 = g_vm->getEngineString(S_OK);
int cx, haz, nh, cf, j, h, m;
int cx, cf, j, h, m;
Common::String stpo;
bool am;

anyone = false;
calch(j, h, m);
Expand Down Expand Up @@ -109,9 +108,9 @@ void tinke() {
if (cf > 65)
t -= ((t / 3) * 2);

nh = readclock();
int nh = readclock();
if ((nh - mh) > t) {
am = g_vm->_menu._menuActive;
bool activeMenu = g_vm->_menu._menuActive;
g_vm->_menu.eraseMenu();
jh += ((nh - mh) / t);
mh = nh;
Expand Down Expand Up @@ -165,7 +164,7 @@ void tinke() {
if (! brt) {
brt = true;
hdb = readclock();
haz = hazard(1, 5);
int haz = hazard(1, 5);
if (haz < 5) {
clsf3();
ecrf2();
Expand All @@ -176,7 +175,7 @@ void tinke() {
}
}
}
if (am)
if (activeMenu)
g_vm->_menu.drawMenu();
}
}
Expand Down Expand Up @@ -217,7 +216,6 @@ void afdes(int ad) {
void tkey1(bool d) {
bool quest;
int x, y, c;
int key;

hideMouse();
fenat('K');
Expand All @@ -232,7 +230,7 @@ void tkey1(bool d) {
CHECK_QUIT;
} while (!(quest || (c != 0) || (d && anyone)));
if (quest)
key = testou();
testou();
g_vm->setMouseClick(false);
showMouse();
}
Expand Down Expand Up @@ -288,15 +286,16 @@ void mfouen() {
/* NIVEAU 6 */

void tperd() {
int cx;

initouv();
ment = 0;
iouv = 0;
mchai = 0;
mfouen();
if (!blo)
if (!blo) {
int cx;
t11(21, cx);
}

g_vm->_loseGame = true;
clsf1();
g_vm->_screenSurface.drawBox(60, 35, 400, 50, 15);
Expand Down Expand Up @@ -469,10 +468,10 @@ void ajjer(int ob) {

void t1sama() { //Entering manor
int j, h, m;
bool d;

calch(j, h, m);
if ((h < 5) && (s.mlieu > 18)) {
bool d;
cherjer(137, d);
if (!d) { //You don't have the keys, and it's late
crep = 1511;
Expand Down Expand Up @@ -548,10 +547,9 @@ void tctrm() {


void quelquun() {
int haz, cx;

if (imen)
g_vm->_menu.eraseMenu();

finfouil();
crep = 997;
L1:
Expand All @@ -572,6 +570,7 @@ void quelquun() {
s.conf += 3 * (s.conf / 10);
tsort();
tmlieu(15);
int cx;
tip(ipers, cx);
caff = 69 + cx;
crep = caff;
Expand All @@ -580,7 +579,7 @@ void quelquun() {
syn = true;
col = true;
} else {
haz = hazard(1, 3);
int haz = hazard(1, 3);
if (haz == 2) {
cache = false;
crep = 137;
Expand Down

0 comments on commit 7ebfcb1

Please sign in to comment.