Skip to content

Commit

Permalink
TONY: Silent more CppCheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 14, 2012
1 parent 42a322d commit d4e9aa7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 27 deletions.
7 changes: 7 additions & 0 deletions engines/tony/gfxcore.h
Expand Up @@ -112,11 +112,13 @@ class RMGfxPrimitive {
_task = NULL;
_src.setEmpty();
_dst.setEmpty();
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task) {
_task = task;
_bFlag = 0;
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMRect &dst) {
Expand All @@ -132,34 +134,39 @@ class RMGfxPrimitive {
_src.topLeft() = src;
_dst = dst;
_bFlag = 0;
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task, const RMPoint &src, RMPoint &dst) {
_task = task;
_src.topLeft() = src;
_dst.topLeft() = dst;
_bFlag = 0;
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task, const RMRect &src, RMPoint &dst) {
_task = task;
_src = src;
_dst.topLeft() = dst;
_bFlag = 0;
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task, const RMRect &dst) {
_task = task;
_dst = dst;
_src.setEmpty();
_bFlag = 0;
_bStretch = false;
}

RMGfxPrimitive(RMGfxTask *task, const RMPoint &dst) {
_task = task;
_dst.topLeft() = dst;
_src.setEmpty();
_bFlag = 0;
_bStretch = false;
}

virtual ~RMGfxPrimitive() { }
Expand Down
18 changes: 9 additions & 9 deletions engines/tony/loc.cpp
Expand Up @@ -710,14 +710,13 @@ void RMItem::setStatus(int nStatus) {
}

void RMItem::setPattern(int nPattern, bool bPlayP0) {
int i;

assert(nPattern >= 0 && nPattern <= _nPatterns);

if (_sfx)
if (_sfx) {
if (_nCurPattern > 0)
_patterns[_nCurPattern].stopSfx(_sfx);

}

// Remember the current pattern
_nCurPattern = nPattern;

Expand All @@ -728,10 +727,12 @@ void RMItem::setPattern(int nPattern, bool bPlayP0) {
_nCurSprite = -1;

// Look for the sound effect for pattern 0
if (bPlayP0)
for (i = 0; i < _nSfx; i++)
if (bPlayP0) {
for (int i = 0; i < _nSfx; i++) {
if (strcmp(_sfx[i]._name, "p0") == 0)
_sfx[i].play();
}
}
}
}

Expand Down Expand Up @@ -783,6 +784,8 @@ RMItem::RMItem() {
_bPal = 0;
_nCurSprite = 0;

_bIsActive = false;

_hEndPattern = CoroScheduler.createEvent(false, false);
}

Expand Down Expand Up @@ -1967,11 +1970,8 @@ bool RMLocation::load(const char *lpszFileName) {
* @returns True if succeeded OK, false in case of error.
*/
bool RMLocation::load(Common::File &file) {
int size;
bool bRet;

// Get the file size
size = file.size();
file.seek(0);

RMFileStreamSlow fs;
Expand Down
22 changes: 11 additions & 11 deletions engines/tony/mpal/expr.cpp
Expand Up @@ -124,8 +124,8 @@ static byte *duplicateExpression(HGLOBAL h) {
two->val.pson = duplicateExpression(two->val.son);
}

one++;
two++;
++one;
++two;
}

globalUnlock(h);
Expand Down Expand Up @@ -183,23 +183,23 @@ static void solve(LPEXPRESSION one, int num) {
int j;

while (num > 1) {
two=one + 1;
two = one + 1;
if ((two->symbol == 0) || (one->symbol & 0xF0) <= (two->symbol & 0xF0)) {
two->val.num = Compute(one->val.num, two->val.num,one->symbol);
two->val.num = Compute(one->val.num, two->val.num, one->symbol);
copyMemory(one, two, (num - 1) * sizeof(EXPRESSION));
num--;
--num;
} else {
j = 1;
three = two + 1;
while ((three->symbol != 0) && (two->symbol & 0xF0) > (three->symbol & 0xF0)) {
two++;
three++;
j++;
++two;
++three;
++j;
}

three->val.num = Compute(two->val.num, three->val.num, two->symbol);
copyMemory(two, three, (num - j - 1) * sizeof(EXPRESSION));
num--;
--num;
}
}
}
Expand Down Expand Up @@ -390,8 +390,8 @@ bool compareExpressions(HGLOBAL h1, HGLOBAL h2) {
break;
}

one++;
two++;
++one;
++two;
}

globalUnlock(h1);
Expand Down
4 changes: 2 additions & 2 deletions engines/tony/mpal/mpal.cpp
Expand Up @@ -1565,7 +1565,7 @@ void mpalFree() {
* method that returns numeric results.
*/
uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
int x, y, z;
int x, y;
Common::String buf;
uint32 dwRet = 0;
char *n;
Expand Down Expand Up @@ -1718,7 +1718,7 @@ uint32 mpalQueryDWORD(uint16 wQueryType, ...) {
lockItems();
lockVar();
x = GETARG(uint32);
z = GETARG(uint32);
int z = GETARG(uint32);
y = itemGetOrderFromNum(z);
if (y != -1) {
dwRet = doAction(x, y, GETARG(uint32));
Expand Down
8 changes: 3 additions & 5 deletions engines/tony/window.cpp
Expand Up @@ -214,10 +214,7 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
int dimx = RM_SX / dezoom;
int dimy = RM_SY / dezoom;

int u, v, curv;

uint32 k = 0;
int sommar, sommab, sommag;
uint16 *cursrc;

if (lpDestBuf == NULL)
Expand Down Expand Up @@ -247,10 +244,11 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
for (int y = 0; y < dimy; y++) {
for (int x = 0; x < dimx; x++) {
cursrc = &src[RM_SKIPX + x * dezoom];
int sommar, sommab, sommag, curv;
sommar = sommab = sommag = 0;

for (v = 0; v < dezoom; v++) {
for (u = 0; u < dezoom; u++) {
for (int v = 0; v < dezoom; v++) {
for (int u = 0; u < dezoom; u++) {
if (lpDestBuf == NULL)
curv = -v;
else
Expand Down

0 comments on commit d4e9aa7

Please sign in to comment.