From 3325d42487d10a533ccf918ef37aa69e545d9ed5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 1 Aug 2016 20:05:16 -0400 Subject: TITANIC: Fix Coverity warnings --- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/pet_control/pet_inventory.cpp | 9 ++++----- engines/titanic/support/avi_surface.cpp | 2 +- engines/titanic/support/font.cpp | 8 +++++--- engines/titanic/true_talk/deskbot_script.cpp | 1 - 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 56069a9799..dff93514e2 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -250,7 +250,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) { bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { CMouseButtonUpMsg *upMsg = dynamic_cast(msg); - if (msg->isButtonUpMsg()) { + if (upMsg) { handleButtonUpMsg(upMsg); return true; } diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 2fb60bf9a6..55176d8b0e 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -202,16 +202,15 @@ int CPetInventory::getItemIndex(CGameObject *item) const { CGameObject *CPetInventory::getImage(int index) { if (index >= 0 && index < 46) { - int offset = index - 20; int bits = 0; - switch (offset) { - case 0: + switch (index) { + case 20: bits = 4; break; - case 1: + case 21: bits = 8; break; - case 2: + case 22: bits = 1; break; case 23: diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 6507c8bbd4..c37bd83616 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -258,7 +258,7 @@ void AVISurface::setupDecompressor() { g_system->getScreenFormat()); // TODO: See whether this simplified form of original works - if (idx == 2) + if (idx == 1) _videoSurface->_transBlitFlag = true; } } diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 07e4c28991..69c0efe504 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -260,12 +260,14 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons if (*srcPtr == ' ' && flag) break; - if (*srcPtr == TEXTCMD_NPC) + if (*srcPtr == TEXTCMD_NPC) { srcPtr += 3; - else if (*srcPtr == TEXTCMD_SET_COLOR) + } else if (*srcPtr == TEXTCMD_SET_COLOR) { srcPtr += 4; - else + } else { totalWidth += _chars[(byte)*srcPtr]._width; + flag = true; + } } if ((textSize.x + totalWidth) >= maxWidth && totalWidth < maxWidth) { diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 3f358889dc..f3a997e218 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -69,7 +69,6 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen bool flag20 = getValue(20) != 0; CTrueTalkManager::setFlags(20, 0); checkItems(nullptr, nullptr); - getState(); if (preprocess(roomScript, sentence) != 1) return 1; -- cgit v1.2.3