aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2017-06-20 19:52:11 -0400
committerPaul Gilbert2017-06-20 19:52:11 -0400
commitc9b5c524cabb20d2db6924a388c23057d3c973d6 (patch)
tree5ef88a896cd7626fe0f33760aade6e286ddd0edd /engines/titanic/support
parent4a22c085b995e2893ebbd40a090fca662c90bc76 (diff)
downloadscummvm-rg350-c9b5c524cabb20d2db6924a388c23057d3c973d6.tar.gz
scummvm-rg350-c9b5c524cabb20d2db6924a388c23057d3c973d6.tar.bz2
scummvm-rg350-c9b5c524cabb20d2db6924a388c23057d3c973d6.zip
TITANIC: Show GUI error dialog if titanic.dat is missing
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/files_manager.cpp17
-rw-r--r--engines/titanic/support/files_manager.h7
2 files changed, 16 insertions, 8 deletions
diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp
index 8fd5107ada..5fc9379917 100644
--- a/engines/titanic/support/files_manager.cpp
+++ b/engines/titanic/support/files_manager.cpp
@@ -30,21 +30,24 @@ namespace Titanic {
CFilesManager::CFilesManager(TitanicEngine *vm) : _vm(vm), _gameManager(nullptr),
_assetsPath("Assets"), _drive(-1) {
- loadResourceIndex();
}
CFilesManager::~CFilesManager() {
_datFile.close();
}
-void CFilesManager::loadResourceIndex() {
- if (!_datFile.open("titanic.dat"))
- error("Could not find titanic.dat data file");
+bool CFilesManager::loadResourceIndex() {
+ if (!_datFile.open("titanic.dat")) {
+ g_vm->GUIError("Could not find titanic.dat data file");
+ return false;
+ }
uint headerId = _datFile.readUint32BE();
uint version = _datFile.readUint16LE();
- if (headerId != MKTAG('S', 'V', 'T', 'N') || version < 1)
- error("Invalid data file");
+ if (headerId != MKTAG('S', 'V', 'T', 'N') || version < 1) {
+ g_vm->GUIError("titanic.dat has invalid contents");
+ return false;
+ }
// Read in entries
uint offset, size;
@@ -62,6 +65,8 @@ void CFilesManager::loadResourceIndex() {
_resources[resName] = ResourceEntry(offset, size);
}
+
+ return true;
}
bool CFilesManager::fileExists(const CString &name) {
diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h
index 45b067e86e..7627ececdd 100644
--- a/engines/titanic/support/files_manager.h
+++ b/engines/titanic/support/files_manager.h
@@ -52,13 +52,16 @@ private:
CFilesManagerList _list;
int _drive;
const CString _assetsPath;
-private:
- void loadResourceIndex();
public:
CFilesManager(TitanicEngine *vm);
~CFilesManager();
/**
+ * Opens up the titanic.dat support file and loads it's index
+ */
+ bool loadResourceIndex();
+
+ /**
* Sets the game manager
*/
void setGameManager(CGameManager *gameManager) {