diff options
author | Travis Howell | 2006-09-20 06:39:27 +0000 |
---|---|---|
committer | Travis Howell | 2006-09-20 06:39:27 +0000 |
commit | e63717a2eb4df76fb97736daebb40b72c2f888fa (patch) | |
tree | 3326874a5d61b5940fea0dea912b6daad4ed795b /engines/simon/res.cpp | |
parent | 68360e4ddedd8806d269320bac91ab6cace34a18 (diff) | |
download | scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.tar.gz scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.tar.bz2 scummvm-rg350-e63717a2eb4df76fb97736daebb40b72c2f888fa.zip |
Fix crashes during WW startup
svn-id: r23944
Diffstat (limited to 'engines/simon/res.cpp')
-rw-r--r-- | engines/simon/res.cpp | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/engines/simon/res.cpp b/engines/simon/res.cpp index 28f1e23946..212b66bcbe 100644 --- a/engines/simon/res.cpp +++ b/engines/simon/res.cpp @@ -269,27 +269,6 @@ void SimonEngine::loadGamePcFile() { in.close(); - if (getGameType() == GType_WW) { - /* Read list of TABLE resources */ - in.open(getFileName(GAME_XTBLFILE)); - if (in.isOpen() == false) { - error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_XTBLFILE)); - } - - file_size = in.size(); - - _xtblList = (byte *)malloc(file_size); - if (_xtblList == NULL) - error("loadGamePcFile: Out of memory for strip table list"); - in.read(_xtblList, file_size); - in.close(); - - /* Remember the current state */ - _xsubroutineListOrg = _subroutineList; - _xtablesHeapPtrOrg = _tablesHeapPtr; - _xtablesHeapCurPosOrg = _tablesHeapCurPos; - } - /* Read list of TABLE resources */ in.open(getFileName(GAME_TBLFILE)); if (in.isOpen() == false) { @@ -323,6 +302,43 @@ void SimonEngine::loadGamePcFile() { error("loadGamePcFile: Out of memory for strip text list"); in.read(_strippedTxtMem, file_size); in.close(); + + if (getGameType() != GType_WW) + return; + + /* Read list of ROOM ITEMS resources */ + in.open(getFileName(GAME_RMSLFILE)); + if (in.isOpen() == false) { + error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_XTBLFILE)); + } + + file_size = in.size(); + + _roomsList = (byte *)malloc(file_size); + if (_roomsList == NULL) + error("loadGamePcFile: Out of memory for room items list"); + in.read(_roomsList, file_size); + in.close(); + + /* Read list of XTABLE resources */ + in.open(getFileName(GAME_XTBLFILE)); + if (in.isOpen() == false) { + error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE)); + } + + file_size = in.size(); + + _xtblList = (byte *)malloc(file_size); + if (_xtblList == NULL) + error("loadGamePcFile: Out of memory for strip xtable list"); + in.read(_xtblList, file_size); + in.close(); + + /* Remember the current state */ + _xsubroutineListOrg = _subroutineList; + _xtablesHeapPtrOrg = _tablesHeapPtr; + _xtablesHeapCurPosOrg = _tablesHeapCurPos; + } void SimonEngine::readGamePcText(Common::File *in) { |