diff options
author | Strangerke | 2016-09-11 10:59:18 +0200 |
---|---|---|
committer | Strangerke | 2016-09-11 11:00:03 +0200 |
commit | b0bfa2e4f535cdaafb389950381fc3fff340e634 (patch) | |
tree | 5790917d1f7c6316963e62bf24c010a3e2b9e9ed /engines/dm | |
parent | 557680bdb771a5bc83889a53ba69f0801f61275f (diff) | |
download | scummvm-rg350-b0bfa2e4f535cdaafb389950381fc3fff340e634.tar.gz scummvm-rg350-b0bfa2e4f535cdaafb389950381fc3fff340e634.tar.bz2 scummvm-rg350-b0bfa2e4f535cdaafb389950381fc3fff340e634.zip |
DM: Replace multiple if statements by a switch in commandMoveParty
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/eventman.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 7534927ad7..19db589aaa 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -989,25 +989,33 @@ void EventManager::commandMoveParty(CommandType cmdType) { _vm->_dungeonMan->mapCoordsAfterRelMovement(_vm->_dungeonMan->_partyDir, movementArrowToStepForwardCount[movementArrowIdx], movementArrowToSepRightCount[movementArrowIdx], partyMapX, partyMapY); curSquare = _vm->_dungeonMan->getSquare(partyMapX, partyMapY); - int16 partySquareType = curSquare.getType(); - if (partySquareType == k3_ElementTypeStairs) { + + bool isMovementBlocked = false; + SquareType partySquareType = curSquare.getType(); + switch (partySquareType){ + case k0_ElementTypeWall: + isMovementBlocked = true; + break; + case k3_ElementTypeStairs: { _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kM1_MapXNotOnASquare, 0); _vm->_dungeonMan->_partyMapX = partyMapX; _vm->_dungeonMan->_partyMapY = partyMapY; byte stairState = curSquare.toByte(); commandTakeStairs(getFlag(stairState, k0x0004_StairsUp)); return; - } - - bool isMovementBlocked = false; - if (partySquareType == k0_ElementTypeWall) - isMovementBlocked = true; - else if (partySquareType == k4_DoorElemType) { + } + case k4_DoorElemType: { byte doorState = curSquare.getDoorState(); isMovementBlocked = (doorState != k0_doorState_OPEN) && (doorState != k1_doorState_FOURTH) && (doorState != k5_doorState_DESTROYED); - } else if (partySquareType == k6_ElementTypeFakeWall) { + } + break; + case k6_ElementTypeFakeWall: { byte wallState = curSquare.toByte(); isMovementBlocked = (!getFlag(wallState, k0x0004_FakeWallOpen) && !getFlag(wallState, k0x0001_FakeWallImaginary)); + } + break; + default: + break; } if (_vm->_championMan->_partyChampionCount) { |