Skip to content

Commit

Permalink
TITANIC: Fix Coverity warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 2, 2016
1 parent 903dc7d commit 3325d42
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion engines/titanic/core/view_item.cpp
Expand Up @@ -250,7 +250,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) {

bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) {
CMouseButtonUpMsg *upMsg = dynamic_cast<CMouseButtonUpMsg *>(msg);
if (msg->isButtonUpMsg()) {
if (upMsg) {
handleButtonUpMsg(upMsg);
return true;
}
Expand Down
9 changes: 4 additions & 5 deletions engines/titanic/pet_control/pet_inventory.cpp
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/support/avi_surface.cpp
Expand Up @@ -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;
}
}
Expand Down
8 changes: 5 additions & 3 deletions engines/titanic/support/font.cpp
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion engines/titanic/true_talk/deskbot_script.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 3325d42

Please sign in to comment.