diff options
| author | Filippos Karapetis | 2010-05-19 08:50:24 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2010-05-19 08:50:24 +0000 |
| commit | 174a043aa7459478326a771581d39f3480ca82f6 (patch) | |
| tree | 9c627a18dc95fd39c46f39d8cf8f2a81217a6e17 /engines/sci/engine/segment.cpp | |
| parent | 852cb16c49aaca1891d25e420ddf1459efa55ae8 (diff) | |
| download | scummvm-rg350-174a043aa7459478326a771581d39f3480ca82f6.tar.gz scummvm-rg350-174a043aa7459478326a771581d39f3480ca82f6.tar.bz2 scummvm-rg350-174a043aa7459478326a771581d39f3480ca82f6.zip | |
Removed the exportsAreWide variable from the segment manager and save games, and moved validateExportFunc() in the Script class, thus resolving a TODO
svn-id: r49093
Diffstat (limited to 'engines/sci/engine/segment.cpp')
| -rw-r--r-- | engines/sci/engine/segment.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 0c6bb93aed..ab1a68d165 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -26,6 +26,7 @@ #include "common/endian.h" #include "sci/sci.h" +#include "sci/engine/features.h" #include "sci/engine/segment.h" #include "sci/engine/seg_manager.h" #include "sci/engine/state.h" @@ -366,22 +367,18 @@ void Script::setExportTableOffset(int offset) { } } -// TODO: This method should be Script method. The only reason -// that it isn't is that it uses _exportsAreWide, which is true if -// detectLofsType() == SCI_VERSION_1_MIDDLE -// Maybe _exportsAreWide should become a Script member var, e.g. set -// by setExportTableOffset? -uint16 SegManager::validateExportFunc(int pubfunct, SegmentId seg) { - Script *scr = getScript(seg); - if (scr->_numExports <= pubfunct) { +uint16 Script::validateExportFunc(int pubfunct) { + bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE); + + if (_numExports <= pubfunct) { warning("validateExportFunc(): pubfunct is invalid"); return 0; } - if (_exportsAreWide) + if (exportsAreWide) pubfunct *= 2; - uint16 offset = READ_SCI11ENDIAN_UINT16((byte *)(scr->_exportTable + pubfunct)); - VERIFY(offset < scr->_bufSize, "invalid export function pointer"); + uint16 offset = READ_SCI11ENDIAN_UINT16((byte *)(_exportTable + pubfunct)); + VERIFY(offset < _bufSize, "invalid export function pointer"); return offset; } |
