From 089c04f6f7a13d40db1e5df5829e84c9a728371f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 Aug 2019 20:31:04 +0300 Subject: STARTREK: Cleanup away mission chain loading code --- engines/startrek/room.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'engines/startrek') diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp index 79e6621b72..976d9f4b0a 100644 --- a/engines/startrek/room.cpp +++ b/engines/startrek/room.cpp @@ -586,20 +586,25 @@ void Room::endMission(int16 score, int16 arg1, int16 arg2) { // TODO: This is a stopgap measure (loading the next away mission immediately). // Replace this with the proper code later. _vm->_gameMode = GAMEMODE_BEAMDOWN; - if (_vm->_missionName == "DEMON") - _vm->_missionToLoad = "TUG"; - if (_vm->_missionName == "TUG") - _vm->_missionToLoad = "LOVE"; - if (_vm->_missionName == "LOVE") - _vm->_missionToLoad = "MUDD"; - if (_vm->_missionName == "MUDD") - _vm->_missionToLoad = "FEATHER"; - if (_vm->_missionName == "FEATHER") - _vm->_missionToLoad = "TRIAL"; - if (_vm->_missionName == "TRIAL") - _vm->_missionToLoad = "SINS"; - if (_vm->_missionName == "SINS") - _vm->_missionToLoad = "VENG"; + + const char *missionNames[] = { + "DEMON", + "TUG", + "LOVE", + "MUDD", + "FEATHER", + "TRIAL", + "SINS", + "VENG" + }; + + for (int i = 0; i < ARRAYSIZE(missionNames); i++) { + if (_vm->_missionName == missionNames[i]) { + _vm->_missionToLoad = missionNames[i + 1]; + break; + } + } + _vm->_roomIndexToLoad = 0; } -- cgit v1.2.3