Skip to content

Commit

Permalink
TONY: Fix three warnings reported by CppCheck in inventory (reported …
Browse files Browse the repository at this point in the history
…by eriktorbjorn)
  • Loading branch information
Strangerke committed Jun 14, 2012
1 parent e55a162 commit 7951881
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions engines/tony/inventory.cpp
Expand Up @@ -190,11 +190,7 @@ void RMInventory::draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *pr

CORO_BEGIN_CODE(_ctx);

if (_state == OPENING || _state == CLOSING)
prim->setDst(RMPoint(0, _curPutY));
else
prim->setDst(RMPoint(0, _curPutY));

prim->setDst(RMPoint(0, _curPutY));
g_system->lockMutex(_csModifyInterface);
CORO_INVOKE_2(RMGfxWoodyBuffer::draw, bigBuf, prim);
g_system->unlockMutex(_csModifyInterface);
Expand Down Expand Up @@ -257,9 +253,9 @@ void RMInventory::removeItem(int code) {
}

void RMInventory::addItem(int code) {
if (code <= 10000 && code >= 10101) {
if (code <= 10000 || code >= 10101) {
// If we are here, it means that we are adding an item that should not be in the inventory
warning("Cannot find a valid icon for this item, and then it will not be added to the inventory");
warning("RMInventory::addItem(%d) - Cannot find a valid icon for this item, and then it will not be added to the inventory", code);
} else {
g_system->lockMutex(_csModifyInterface);
if (_curPos + 8 == _nInv) {
Expand All @@ -277,8 +273,8 @@ void RMInventory::addItem(int code) {
}

void RMInventory::changeItemStatus(uint32 code, uint32 dwStatus) {
if (code <= 10000 && code >= 10101) {
error("Specified object code is not valid");
if (code <= 10000 || code >= 10101) {
error("RMInventory::changeItemStatus(%d) - Specified object code is not valid", code);
} else {
g_system->lockMutex(_csModifyInterface);
_items[code - 10000]._icon.setPattern(dwStatus);
Expand Down

0 comments on commit 7951881

Please sign in to comment.