MACVENTURE: Fix MSVC warnings

- Added a CHECKME for a code which is never used at the moment
- Add default cases to switch statements
- Remove unused variables
- Fix integer variable assignments from booleans
This commit is contained in:
Filippos Karapetis 2019-05-27 14:22:04 +03:00
parent ea39214f7a
commit e94026e800
2 changed files with 14 additions and 9 deletions

View file

@ -802,6 +802,7 @@ void Gui::updateWindow(WindowReference winID, bool containerOpen) {
ObjID child = children[i].obj;
BlitMode mode = kBlitDirect;
bool off = !_engine->isObjVisible(child);
// CHECKME: Since flag = 0, this always evaluates to false
if (flag || !off || !_engine->isObjClickable(child)) {
mode = kBlitBIC;
if (off || flag) {
@ -1021,9 +1022,8 @@ WindowReference Gui::getObjWindow(ObjID objID) {
case 0xfffd: return kSelfWindow;
case 0xfffe: return kOutConsoleWindow;
case 0xffff: return kCommandsWindow;
default: return findObjWindow(objID);
}
return findObjWindow(objID);
}
WindowReference Gui::findObjWindow(ObjID objID) {
@ -1250,7 +1250,7 @@ void Gui::invertWindowColors(WindowReference winID) {
}
bool Gui::tryCloseWindow(WindowReference winID) {
WindowData data = findWindowData(winID);
//WindowData data = findWindowData(winID);
Graphics::MacWindow *win = findWindow(winID);
_wm.removeWindow(win);
if (winID < 0x80) {

View file

@ -614,6 +614,8 @@ void MacVentureEngine::runObjQueue() {
case 0xe:
zoomObject(obj.object);
break;
default:
break;
}
}
}
@ -635,6 +637,8 @@ void MacVentureEngine::printTexts() {
_gui->printText(_world->getText(text.asset, text.source, text.destination));
gameChanged();
break;
default:
break;
}
}
}
@ -654,6 +658,8 @@ void MacVentureEngine::playSounds(bool pause) {
case kSoundWait:
// Empty in the original.
break;
default:
break;
}
}
if (pause && delay > 0) {
@ -804,7 +810,6 @@ void MacVentureEngine::openObject(ObjID objID) {
void MacVentureEngine::closeObject(ObjID objID) {
warning("closeObject: not fully implemented");
_gui->tryCloseWindow(getObjWindow(objID));
return;
}
void MacVentureEngine::checkObject(QueuedObject old) {
@ -819,8 +824,8 @@ void MacVentureEngine::checkObject(QueuedObject old) {
if (old.parent != _world->getObjAttr(id, kAttrParentObject)) {
enqueueObject(kSetToPlayerParent, id);
}
if (old.offscreen != _world->getObjAttr(id, kAttrInvisible) ||
old.invisible != _world->getObjAttr(id, kAttrUnclickable)) {
if (old.offscreen != !!_world->getObjAttr(id, kAttrInvisible) ||
old.invisible != !!_world->getObjAttr(id, kAttrUnclickable)) {
updateWindow(findParentWindow(id));
}
} else if (old.parent != _world->getObjAttr(id, kAttrParentObject) ||
@ -837,14 +842,14 @@ void MacVentureEngine::checkObject(QueuedObject old) {
_gui->addChild(newWin, id);
hasChanged = true;
}
} else if (old.offscreen != _world->getObjAttr(id, kAttrInvisible) ||
old.invisible != _world->getObjAttr(id, kAttrUnclickable)) {
} else if (old.offscreen != !!_world->getObjAttr(id, kAttrInvisible) ||
old.invisible != !!_world->getObjAttr(id, kAttrUnclickable)) {
updateWindow(findParentWindow(id));
}
if (_world->getObjAttr(id, kAttrIsExit)) {
if (hasChanged ||
old.hidden != _world->getObjAttr(id, kAttrHiddenExit) ||
old.hidden != !!_world->getObjAttr(id, kAttrHiddenExit) ||
old.exitx != _world->getObjAttr(id, kAttrExitX) ||
old.exity != _world->getObjAttr(id, kAttrExitY))
_gui->updateExit(id);