diff options
author | Strangerke | 2012-02-29 23:50:49 +0100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:22:17 +0200 |
commit | 38c9aa8b5623df4536598aec4e841bcb936cd9a2 (patch) | |
tree | 214088504057aaa026de497431ebd75c1b7ebeb2 /engines | |
parent | 10132f3632ecb86ba928db3d1510d5ac16eb5529 (diff) | |
download | scummvm-rg350-38c9aa8b5623df4536598aec4e841bcb936cd9a2.tar.gz scummvm-rg350-38c9aa8b5623df4536598aec4e841bcb936cd9a2.tar.bz2 scummvm-rg350-38c9aa8b5623df4536598aec4e841bcb936cd9a2.zip |
MORTEVIELLE: silent several warning reported by cppCheck
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mortevielle/actions.cpp | 93 | ||||
-rw-r--r-- | engines/mortevielle/menu.cpp | 11 | ||||
-rw-r--r-- | engines/mortevielle/mor.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/mor2.cpp | 44 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/outtext.cpp | 3 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/prog.cpp | 2 | ||||
-rw-r--r-- | engines/mortevielle/taffich.cpp | 12 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.cpp | 4 | ||||
-rw-r--r-- | engines/mortevielle/var_mor.h | 10 |
11 files changed, 91 insertions, 94 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 63f432b81a..b2a23f5814 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -179,10 +179,8 @@ L2: * @remarks Originally called 'tprendre' */ void fctTake() { - int cx; - if (caff > 99) { - cx = caff; + int cx = caff; avpoing(cx); if (crep != 139) { if (ipers > 0) @@ -475,27 +473,30 @@ void fctSelftLook() { */ void fctSearch() { const byte r[14] = {123, 104, 123, 131, 131, 123, 104, 131, 123, 123, 106, 123, 123, 107}; - int cx; if (caff > 99) { st7(caff); return; } + if (!syn) ecr3(g_vm->getEngineString(S_SEARCH)); + tfleche(); if (anyone || iesc) return; + if (s.mlieu == 23) { crep = 1504; tperd(); return; } + tcoord(6); if (num == 0) { tcoord(7); if (num != 0) { - cx = 0; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -504,6 +505,7 @@ void fctSearch() { else { if (ipers > 0) s.conf += 3; + rechai(mchai); if (mchai != 0) { cs = 0; @@ -540,14 +542,17 @@ void fctSearch() { crep = 997; if (s.mlieu < 14) crep = r[s.mlieu]; + if ((s.mlieu == 3) && (num == 2)) crep = 162; + if (s.mlieu == 12) { if ((num == 3) || (num == 4)) crep = 162; else if (num == 5) crep = 159; } + if (s.mlieu == 19) crep = 104; else if (s.mlieu == 16) @@ -571,10 +576,9 @@ void fctSelfSearch() { * @remarks Originally called 'touvrir' */ void fctOpen() { - int cx, haz; - if (!syn) ecr3(g_vm->getEngineString(S_OPEN)); + if (caff == 26) { if (ment != 0) { msg[4] = OPCODE_ENTER; @@ -583,19 +587,22 @@ void fctOpen() { crep = 997; return; } + if (caff == 15) { aldepl(); return; } + tfleche(); if ((anyone) || (iesc)) return; + tcoord(7); if (num != 0) { if (ipers > 0) s.conf += 2; ++iouv; - cx = 0; + int cx = 0; do { ++cx; } while (!((cx > 6) || (ord(touv[cx]) == 0) || (ord(touv[cx]) == num))); @@ -609,8 +616,7 @@ void fctOpen() { if ( ((s.mlieu > 10) && (s.mlieu < 14)) || ((s.mlieu > 6) && (s.mlieu < 10)) || (s.mlieu == 0) || (s.mlieu == 2) || (s.mlieu == 5)) { - haz = hazard(1, 4); - if (haz == 3) + if (hazard(1, 4) == 3) parole(7, 9, 1); } touv[cx] = chr(num); @@ -632,10 +638,6 @@ void fctOpen() { * @remarks Originally called 'tmettre' */ void fctPlace() { - bool enterPassageFl; - Common::String str_; - int i; - if (s.derobj == 0) { crep = 186; return; @@ -684,10 +686,10 @@ void fctPlace() { int answer = Alert::show(g_vm->getEngineString(S_YES_NO), 1); if (answer== 1) { Common::String alertTxt = deline(582); - i = Alert::show(alertTxt, 1); + Alert::show(alertTxt, 1); tesok = false; - enterPassageFl = Ques::show(); + bool enterPassageFl = Ques::show(); hideMouse(); hirs(); dessine_rouleau(); @@ -712,7 +714,7 @@ void fctPlace() { aniof(1, 2); aniof(1, 1); alertTxt = deline(577); - i = Alert::show(alertTxt, 1); + Alert::show(alertTxt, 1); aniof(2, 1); crep = 166; } @@ -844,10 +846,9 @@ void fctAttach() { * @remarks Originally called 'tfermer' */ void fctClose() { - int cx, chai; - if (!syn) ecr3(g_vm->getEngineString(S_CLOSE)); + if (caff < 26) { tfleche(); if (iesc) @@ -856,7 +857,7 @@ void fctClose() { return; tcoord(7); if (num != 0) { - cx = 0; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -867,7 +868,7 @@ void fctClose() { iouv = iouv - 1; if (iouv < 0) iouv = 0; - chai = 9999; + int chai = 9999; rechai(chai); if (mchai == chai) mchai = 0; @@ -883,14 +884,14 @@ void fctClose() { * @remarks Originally called 'tfrapper' */ void fctKnock() { - int l, p, haz; - if (!syn) ecr3(g_vm->getEngineString(S_HIT)); + if (s.mlieu == 15) { - l = Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); + Alert::show(g_vm->getEngineString(S_BEFORE_USE_DEP_MENU), 1); return; } + if (s.mlieu < 25) { tfleche(); if (!(anyone) && !(iesc)) @@ -900,12 +901,14 @@ void fctKnock() { crep = 997; return; } + if (s.mlieu == 26) { - haz = (hazard(0, 8)) - 4; + int haz = (hazard(0, 8)) - 4; parole(11, haz, 1); + int p; ecfren(p, haz, s.conf, ment); - l = ment; - if (l != 0) + int l = ment; + if (l != 0) { if (p != -500) { if (haz > p) crep = 190; @@ -915,6 +918,8 @@ void fctKnock() { } } else frap(); + } + if (ment == 8) crep = 190; } @@ -925,8 +930,6 @@ void fctKnock() { * @remarks Originally called 'tposer' */ void fctSelfPut() { - int cx, chai; - if (!syn) ecr3(g_vm->getEngineString(S_POSE)); if (s.derobj == 0) @@ -945,11 +948,12 @@ void fctSelfPut() { tcoord(7); crep = 124; if (num != 0) { + int chai; rechai(chai); if (chai == 0) crep = 997; else { - cx = 0; + int cx = 0; do { ++cx; } while ((cx <= 6) && (num != ord(touv[cx]))); @@ -1014,21 +1018,21 @@ void fctSelfPut() { * @remarks Originally called 'tecouter' */ void fctListen() { - int l, p, haz, j, h, m; - if (s.mlieu != 26) crep = 101; else { if (ipers != 0) ++s.conf; + int p, haz; ecfren(p, haz, s.conf, ment); - l = ment; + int l = ment; if (l != 0) { if (p != -500) { if (haz > p) crep = 101; else { becfren(l); + int j, h, m; calch(j, h, m); haz = hazard(1, 100); if ((h >= 0) && (h < 8)) { @@ -1052,8 +1056,6 @@ void fctListen() { * @remarks Originally called 'tmanger' */ void fctEat() { - int j, h, m; - if ((s.mlieu > 15) && (s.mlieu < 26)) crep = 148; else { @@ -1062,6 +1064,8 @@ void fctEat() { caff = 10; debloc(s.mlieu); tmlieu(s.mlieu); + + int j, h, m; calch(j, h, m); if ((h == 12) || (h == 13) || (h == 19)) { s.conf = s.conf - (s.conf / 7); @@ -1088,7 +1092,7 @@ void fctEat() { * @remarks Originally called 'tentrer' */ void fctEnter() { - int x, z = 0; +// int x; if ((s.mlieu == 21) || (s.mlieu == 22)) { t1sama(); @@ -1101,21 +1105,22 @@ void fctEnter() { crep = 189; s.teauto[8] = '*'; } else { + int z = 0; if (! blo) t11(ment, z); if (z != 0) { if ((ment == 3) || (ment == 7)) crep = 179; else { - x = (hazard(0, 10)) - 5; - parole(7, x, 1); + g_x = (hazard(0, 10)) - 5; + parole(7, g_x, 1); aniof(1, 1); - tip(z, x); + tip(z, g_x); ++s.conf; s.mlieu = 15; msg[3] = MENU_DISCUSS; - msg[4] = g_vm->_menu._discussMenu[x]; + msg[4] = g_vm->_menu._discussMenu[g_x]; syn = true; if (ment == 9) { col = true; @@ -1128,8 +1133,8 @@ void fctEnter() { ment = 0; } } else { - x = (hazard(0, 10)) - 5; - parole(7, x, 1); + g_x = (hazard(0, 10)) - 5; + parole(7, g_x, 1); aniof(1, 1); s.mlieu = ment; @@ -1213,13 +1218,13 @@ void fctForce() { * @remarks Originally called 'tsortir' */ void fctLeave() { - int lx = 0; - tsort(); crep = 0; if ((s.mlieu == 19) || (s.mlieu == 21) || (s.mlieu == 22) || (s.mlieu == 24)) crep = 997; else { + int lx = 0; + if ((s.mlieu < 16) || (s.mlieu == 26)) lx = 10; if ((s.mlieu == 10) || (s.mlieu == 20)) diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 6bbfa62df5..6ff97164f0 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -393,14 +393,11 @@ void Menu::eraseMenu() { * Handle updates to the menu */ void Menu::mdn() { - int x, y, ix; - bool tes; - if (!_menuActive) return; - x = x_s; - y = y_s; + int x = x_s; + int y = y_s; if (!g_vm->getMouseClick()) { if ((x == xprec) && (y == yprec)) return; @@ -409,7 +406,7 @@ void Menu::mdn() { yprec = y; } - tes = (y < 11) + bool tes = (y < 11) && ((x >= (28 * res) && x <= (28 * res + 24)) || (x >= (76 * res) && x <= (76 * res + 24)) || ((x > 124 * res) && (x < 124 * res + 24)) @@ -417,6 +414,8 @@ void Menu::mdn() { || ((x > 220 * res) && (x < 220 * res + 24)) || ((x > 268 * res) && (x < 268 * res + 24))); if (tes) { + int ix; + if (x < 76 * res) ix = MENU_INVENTORY; else if (x < 124 * res) diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 97b116f869..12df21ea9c 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -674,7 +674,7 @@ void drawClock() { void debloc(int l) { num = 0; - x = 0; + g_x = 0; y = 0; if ((l != 26) && (l != 15)) t5(l); diff --git a/engines/mortevielle/mor2.cpp b/engines/mortevielle/mor2.cpp index 33016faba9..2a80cecee1 100644 --- a/engines/mortevielle/mor2.cpp +++ b/engines/mortevielle/mor2.cpp @@ -649,45 +649,49 @@ void tfleche() { if (qust && (touch == '\103')) Alert::show(_hintPctMessage, 1); - } while (!((touch == '\73') || ((touch == '\104') && (x != 0) && (y != 0)) || (anyone) || (rect))); + } while (!((touch == '\73') || ((touch == '\104') && (g_x != 0) && (y != 0)) || (anyone) || (rect))); if (touch == '\73') iesc = true; if (rect) { - x = x_s; + g_x = x_s; y = y_s; } } void tcoord(int sx) { - int sy, ix, iy, cb, cy, ib; - int a, b, atdon; + int sy, ix, iy; + int ib; num = 0; crep = 999; - a = 0; - atdon = amzon + 3; - cy = 0; + int a = 0; + int atdon = amzon + 3; + int cy = 0; while (cy < caff) { a += tabdon[atdon]; atdon += 4; ++cy; } - b = tabdon[atdon]; - if (b == 0) - goto L1; + if (tabdon[atdon] == 0) { + crep = 997; + return; + } + a += fleche; - cb = 0; + int cb = 0; for (cy = 0; cy <= (sx - 2); ++cy) { ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; cb += (ib * 4) + 2; } ib = (tabdon[a + cb] << 8) + tabdon[(a + cb + 1)]; - if (ib == 0) - goto L1; + if (ib == 0) { + crep = 997; + return; + } cy = 1; do { @@ -698,14 +702,13 @@ void tcoord(int sx) { ix = tabdon[a + cb] * res; iy = tabdon[(a + cb + 1)]; ++cy; - } while (!(((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); + } while (!(((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) || (cy > ib))); - if ((x >= sx) && (x <= ix) && (y >= sy) && (y <= iy)) { + if ((g_x >= sx) && (g_x <= ix) && (y >= sy) && (y <= iy)) { num = cy - 1; return; } -L1: crep = 997; } @@ -733,10 +736,9 @@ void st7(int ob) { } void treg(int ob) { - int mdes; - - mdes = caff; + int mdes = caff; caff = ob; + if (((caff > 29) && (caff < 33)) || (caff == 144) || (caff == 147) || (caff == 149) || (msg[4] == OPCODE_SLOOK)) { afdes(0); if ((caff > 29) && (caff < 33)) @@ -758,6 +760,7 @@ void avpoing(int &ob) { crep = 999; if (s.derobj != 0) ajjer(s.derobj); + if (crep != 139) { modobj(ob + 400); s.derobj = ob; @@ -766,9 +769,8 @@ void avpoing(int &ob) { } void rechai(int &ch) { - int cx; + int cx = s.mlieu; - cx = s.mlieu; if (s.mlieu == 16) cx = 14; ch = tabdon[achai + (cx * 7) + num - 1]; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index c9ea556c80..50631663e1 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -594,7 +594,7 @@ void MortevielleEngine::handleAction() { } else return; } else if (inkey == '\104') { - if ((x != 0) && (y != 0)) + if ((g_x != 0) && (y != 0)) num = 9999; return; } diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 2cdfbe4188..3cc9b342fd 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -154,9 +154,6 @@ Common::String deline(int num) { return wrkStr; } -void afftex(const char *ch, int x, int y, int dx, int dy, int typ); - - static int l_motsuiv(int p, const char *ch, int &tab) { int c = p; diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 64bb6cb463..1ea8d509ed 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -61,7 +61,7 @@ void charpal() { if (!ft.open("fxx.mor")) error("Missing file - fxx.mor"); for (int i = 0; i < 108; ++i) - l[i] = ft.readSint16LE(); + g_l[i] = ft.readSint16LE(); ft.close(); if (!f.open("plxx.mor")) diff --git a/engines/mortevielle/prog.cpp b/engines/mortevielle/prog.cpp index 4953f86a00..635140f048 100644 --- a/engines/mortevielle/prog.cpp +++ b/engines/mortevielle/prog.cpp @@ -94,7 +94,7 @@ void MortevielleEngine::gameLoaded() { mnumo = 0; prebru = 0; g[4] = 'T'; - x = 0; + g_x = 0; y = 0; num = 0; hdb = 0; diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp index 29cdc0a288..52ed011604 100644 --- a/engines/mortevielle/taffich.cpp +++ b/engines/mortevielle/taffich.cpp @@ -193,16 +193,16 @@ void taffich() { npal = a; for (cx = 0; cx <= (a - 1); ++cx) - lgt = lgt + l[cx]; - handle = l[a]; + lgt = lgt + g_l[cx]; + handle = g_l[a]; filename = "DXX.mor"; } else { filename = "DZZ.mor"; - handle = l[87]; + handle = g_l[87]; if (a == 51) { lgt = handle; - handle = l[88]; + handle = g_l[88]; } _maff = a; npal = a + 37; @@ -235,8 +235,8 @@ void taffich() { else if (b > 15) --b; for (cx = 0; cx <= (b - 1); ++cx) - lgt += l[cx + 89]; - handle = l[b + 89]; + lgt += g_l[cx + 89]; + handle = g_l[b + 89]; filename = "AXX.mor"; } else if (b == 50) { filename = "AZZ.mor"; diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp index ef9dbcf23a..d63d9aa808 100644 --- a/engines/mortevielle/var_mor.cpp +++ b/engines/mortevielle/var_mor.cpp @@ -113,7 +113,7 @@ bool blo, rech_cfiec; -int x, +int g_x, y, t, vj, @@ -194,7 +194,7 @@ ind t_rec[maxtd + 1]; //file<ind> sauv_t; //untyped_file fibyte; byte v_lieu[8][25]; -int l[108]; +int g_l[108]; int tbi[256]; chariot c1, c2, c3; float addfix; diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h index d9a11f5528..5769b61064 100644 --- a/engines/mortevielle/var_mor.h +++ b/engines/mortevielle/var_mor.h @@ -182,12 +182,6 @@ struct chariot { rep; }; -/* -struct doublet { - byte x, y; -}; -*/ - struct rectangle { int x1, x2, y1, y2; bool enabled; @@ -259,7 +253,7 @@ extern bool blo, rech_cfiec; -extern int x, +extern int g_x, y, t, vj, @@ -340,7 +334,7 @@ extern ind t_rec[maxtd + 1]; //file<ind> sauv_t; //untyped_file fibyte; extern byte v_lieu[8][25]; -extern int l[108]; +extern int g_l[108]; extern int tbi[256]; extern chariot c1, c2, c3; extern float addfix; |