SAGA: Fix Missing Default Switch Cases

These are flagged by GCC if -Wswitch-default is enabled.
This commit is contained in:
D G Turner 2019-12-01 15:11:36 +00:00
parent 7b275b454c
commit f26bb57ef8
13 changed files with 70 additions and 0 deletions

View File

@ -644,6 +644,9 @@ int Actor::getFrameType(ActorFrameTypes frameType) {
return kFrameITEPickUp;
case kFrameLook:
return kFrameITELook;
default:
error("Actor::getFrameType() unknown frame type %d", frameType);
return kFrameITEStand; // for compilers that don't support NORETURN
}
#ifdef ENABLE_IHNM
} else if (_vm->getGameId() == GID_IHNM) {
@ -661,12 +664,14 @@ int Actor::getFrameType(ActorFrameTypes frameType) {
case kFrameGive:
case kFramePickUp:
case kFrameLook:
default:
error("Actor::getFrameType() unknown frame type %d", frameType);
return kFrameIHNMStand; // for compilers that don't support NORETURN
}
#endif
}
error("Actor::getFrameType() unknown frame type %d", frameType);
return kFrameITEStand; // for compilers that don't support NORETURN
}
ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) {
@ -797,6 +802,8 @@ void Actor::handleSpeech(int msec) {
case 0:
_activeSpeech.playingTime = 0x7fffff;
break;
default:
break;
}
} else {
_activeSpeech.playingTime = sampleLength;

View File

@ -569,6 +569,7 @@ void Actor::handleActions(int msec, bool setup) {
case kActionAccept:
case kActionStoop:
default:
break;
case kActionCycleFrames:
@ -1199,6 +1200,8 @@ void Actor::moveDragon(ActorData *actor) {
actor->_partialTarget.u() += 16;
moveType = kDragonMoveUpRight;
break;
default:
break;
}
switch (dir2) {
@ -1214,6 +1217,8 @@ void Actor::moveDragon(ActorData *actor) {
case kDirUpRight:
actor->_partialTarget.u() += 16;
break;
default:
break;
}
actor->_walkStepIndex++;

View File

@ -489,6 +489,8 @@ int Events::handleOneShot(Event *event) {
case kEventThreadWake:
_vm->_script->wakeUpThreads(event->param);
break;
default:
break;
}
break;
case kCursorEvent:
@ -605,6 +607,8 @@ void Events::initializeEvent(Event &event) {
break;
case kEvTInterval:
break;
default:
break;
}
}

View File

@ -656,6 +656,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) {
if (_vm->getGameId() == GID_ITE || _vm->isIHNMDemo()) {
switch (font) {
case (kKnownFontSmall):
default:
fontId = kSmallFont;
break;
case (kKnownFontMedium):
@ -679,6 +680,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) {
} else if (_vm->getGameId() == GID_IHNM && !_vm->isIHNMDemo()) {
switch (font) {
case (kKnownFontSmall):
default:
fontId = kSmallFont;
break;
case (kKnownFontMedium):

View File

@ -477,6 +477,8 @@ void Interface::setMode(int mode) {
// to flip through the pages of the help system
}
break;
default:
break;
}
draw();
@ -655,6 +657,9 @@ bool Interface::processAscii(Common::KeyState keystate) {
case '9':
converseSetPos(ascii);
break;
default:
break;
}
break;
case kPanelMap:
@ -708,6 +713,8 @@ bool Interface::processAscii(Common::KeyState keystate) {
}
#endif
break;
default:
break;
}
return false;
}
@ -1074,6 +1081,8 @@ void Interface::setQuit(PanelButton *panelButton) {
#endif
_vm->quitGame();
break;
default:
break;
}
}
@ -1147,6 +1156,8 @@ void Interface::setLoad(PanelButton *panelButton) {
// IHNM only
setMode(kPanelOption);
break;
default:
break;
}
}
@ -1410,6 +1421,8 @@ void Interface::setSave(PanelButton *panelButton) {
_textInput = false;
setMode(kPanelOption);
break;
default:
break;
}
}
@ -1563,6 +1576,9 @@ void Interface::handleChapterSelectionClick(const Point& mousePoint) {
o = _vm->_actor->getObj(obj);
script = o->_scriptEntrypointNumber;
break;
default:
break;
}
if (script > 0) {
@ -1673,6 +1689,8 @@ void Interface::setOption(PanelButton *panelButton) {
ConfMan.setBool("subtitles", _vm->_subtitlesEnabled);
ConfMan.setBool("voices", _vm->_voicesEnabled);
break;
default:
break;
}
}
@ -1867,6 +1885,9 @@ void Interface::update(const Point& mousePoint, int updateFlag) {
_vm->_scene->showIHNMDemoSpecialScreen();
#endif
break;
default:
break;
}
_lastMousePoint = mousePoint;
@ -2299,6 +2320,8 @@ void Interface::drawPanelButtonText(InterfacePanel *panel, PanelButton *panelBut
else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled)
textId = kTextAudio;
break;
default:
break;
}
if (_vm->getGameId() == GID_ITE) {
if (textId > kTextEnterProtectAnswer)

View File

@ -263,6 +263,9 @@ bool Scene::playTitle(int title, int time, int mode) {
case 9: // end
done = true;
break;
default:
break;
}
_vm->_system->updateScreen();

View File

@ -447,6 +447,7 @@ void IsoMap::drawTiles(const Location *location) {
case kEdgeTypeBlack:
continue;
case kEdgeTypeFill0:
default:
break;
case kEdgeTypeFill1:
metaTileIndex = 1;
@ -491,6 +492,7 @@ void IsoMap::drawTiles(const Location *location) {
case kEdgeTypeBlack:
continue;
case kEdgeTypeFill0:
default:
break;
case kEdgeTypeFill1:
metaTileIndex = 1;
@ -744,6 +746,7 @@ void IsoMap::drawTile(uint16 tileIndex, const Point &point, const Location *loca
case kMaskRuleNever:
return;
case kMaskRuleAlways:
default:
break;
case kMaskRuleUMIN:
if (location->u() < THRESH0) {
@ -1009,6 +1012,7 @@ int16 IsoMap::getTileIndex(int16 u, int16 v, int16 z) {
case kEdgeTypeBlack:
return 0;
case kEdgeTypeFill0:
default:
break;
case kEdgeTypeFill1:
metaTileIndex = 1;
@ -1431,6 +1435,8 @@ void IsoMap::findDragonTilePath(ActorData* actor, const Location &start, const L
pushDragonPoint(tilePoint->u + 1, tilePoint->v + 1, kDirUpRight);
}
break;
default:
break;
}
if (first && (_queueCount == _readCount)) {

View File

@ -517,6 +517,9 @@ void Puzzle::handleReply(int reply) {
_vm->getTimerManager()->installTimerProc(&hintTimerCallback, kPuzzleHintTime * 2, this, "sagaPuzzleHint");
clearHint();
break;
default:
break;
}
}

View File

@ -237,6 +237,8 @@ Common::Error SagaEngine::run() {
_resource = new Resource_HRS(this);
break;
#endif
default:
break;
}
// Detect game and open resource files
@ -484,6 +486,8 @@ const char *SagaEngine::getObjectName(uint16 objectId) const {
return "";
return _scene->_sceneStrings.getString(hitZone->getNameIndex());
default:
break;
}
warning("SagaEngine::getObjectName name not found for 0x%X", objectId);
return NULL;

View File

@ -657,6 +657,8 @@ void Scene::loadScene(LoadSceneParams &loadSceneParams) {
_sceneNumber = loadSceneParams.sceneDescriptor;
_sceneResourceId = getSceneResourceId(_sceneNumber);
break;
default:
break;
}
debug(3, "Loading scene number %d:", _sceneNumber);

View File

@ -140,6 +140,8 @@ SAGA1Script::SAGA1Script(SagaEngine *vm) : Script(vm) {
setupIHNMScriptFuncList();
break;
#endif
default:
break;
}
}
@ -1238,6 +1240,8 @@ int Script::getVerbType(VerbTypes verbType) {
return kVerbITELookOnly;
case kVerbOptions:
return kVerbITEOptions;
default:
break;
}
#ifdef ENABLE_IHNM
} else if (_vm->getGameId() == GID_IHNM) {
@ -1268,6 +1272,8 @@ int Script::getVerbType(VerbTypes verbType) {
return kVerbIHNMLookOnly;
case kVerbOptions:
return kVerbIHNMOptions;
default:
break;
}
#endif
}

View File

@ -417,6 +417,8 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by
for (i = 0; i < blockSize; i++)
buffer[curChannel][i] += channelOffset;
break;
default:
break;
}

View File

@ -149,6 +149,9 @@ void Script::executeThreads(uint msec) {
if (thread._frameWait < _vm->_frameCount)
thread._flags &= ~kTFlagWaiting;
break;
default:
break;
}
}