Checking for the file's existence in DataIO::getDataStream()

svn-id: r41837
This commit is contained in:
Sven Hesse 2009-06-24 21:48:13 +00:00
parent 483c3a51c3
commit 53c4e66b71
3 changed files with 10 additions and 6 deletions

View File

@ -585,6 +585,9 @@ byte *DataIO::getData(const char *path) {
}
DataStream *DataIO::getDataStream(const char *path) {
if (!path || (path[0] == '\0') || !existData(path))
return 0;
uint32 size = getDataSize(path);
byte *data = getData(path);

View File

@ -508,10 +508,9 @@ uint16 Script::getFunctionOffset(uint8 function) const {
}
uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
if (!vm->_dataIO->existData(fileName))
return 0;
DataStream *stream = vm->_dataIO->getDataStream(fileName);
if (!stream)
return 0;
stream->seek(0x2C);
uint32 variablesCount = stream->readUint32LE();

View File

@ -44,9 +44,11 @@ TOTFile::~TOTFile() {
}
bool TOTFile::load(const Common::String &fileName) {
if (_vm->_dataIO->existData(fileName.c_str()))
_stream = _vm->_dataIO->getDataStream(fileName.c_str());
else
// Trying to open normally
_stream = _vm->_dataIO->getDataStream(fileName.c_str());
if (!_stream)
// Trying to open from video video
_stream = _vm->_vidPlayer->getExtraData(fileName.c_str());
if (!_stream)