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

View file

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