From c489be38d6c9a1297ff6feab8981c758887e9708 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 1 Mar 2007 17:15:26 +0000 Subject: Removed obsolete 'if' (resp. replaced it by an assert) svn-id: r25918 --- engines/sword2/resman.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp index d016a5ad18..b8e79a610e 100644 --- a/engines/sword2/resman.cpp +++ b/engines/sword2/resman.cpp @@ -423,27 +423,27 @@ Common::File *ResourceManager::openCluFile(uint16 fileNum) { } void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) { - if (_resFiles[fileNum].entryTab == NULL) { - // we didn't read from this file before, get its index table - assert(file); - - // 1st DWORD of a cluster is an offset to the look-up table - uint32 table_offset = file->readUint32LE(); - debug(6, "table offset = %d", table_offset); - uint32 tableSize = file->size() - table_offset; // the table is stored at the end of the file - file->seek(table_offset); - - assert((tableSize % 8) == 0); - _resFiles[fileNum].entryTab = (uint32*)malloc(tableSize); - _resFiles[fileNum].numEntries = tableSize / 8; - file->read(_resFiles[fileNum].entryTab, tableSize); - if (file->ioFailed()) - error("unable to read index table from file %s\n", _resFiles[fileNum].fileName); + // we didn't read from this file before, get its index table + assert(_resFiles[fileNum].entryTab == NULL); + assert(file); + + // 1st DWORD of a cluster is an offset to the look-up table + uint32 table_offset = file->readUint32LE(); + debug(6, "table offset = %d", table_offset); + uint32 tableSize = file->size() - table_offset; // the table is stored at the end of the file + file->seek(table_offset); + + assert((tableSize % 8) == 0); + _resFiles[fileNum].entryTab = (uint32*)malloc(tableSize); + _resFiles[fileNum].numEntries = tableSize / 8; + file->read(_resFiles[fileNum].entryTab, tableSize); + if (file->ioFailed()) + error("unable to read index table from file %s\n", _resFiles[fileNum].fileName); + #ifdef SCUMM_BIG_ENDIAN - for (int tabCnt = 0; tabCnt < _resFiles[fileNum].numEntries * 2; tabCnt++) - _resFiles[fileNum].entryTab[tabCnt] = FROM_LE_32(_resFiles[fileNum].entryTab[tabCnt]); + for (int tabCnt = 0; tabCnt < _resFiles[fileNum].numEntries * 2; tabCnt++) + _resFiles[fileNum].entryTab[tabCnt] = FROM_LE_32(_resFiles[fileNum].entryTab[tabCnt]); #endif - } } /** -- cgit v1.2.3