diff options
author | Paul Gilbert | 2019-06-19 20:28:19 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-22 14:40:49 -0700 |
commit | b4ae2ec4374a8f920fa3287b6906e09c6c68f57f (patch) | |
tree | 1417fde297db24b3cef52271fdb7d966f2ea994e /engines/glk/alan2/alan2.cpp | |
parent | 51a142aaf89fc5231b5a7b390ede08b1f7f1e08d (diff) | |
download | scummvm-rg350-b4ae2ec4374a8f920fa3287b6906e09c6c68f57f.tar.gz scummvm-rg350-b4ae2ec4374a8f920fa3287b6906e09c6c68f57f.tar.bz2 scummvm-rg350-b4ae2ec4374a8f920fa3287b6906e09c6c68f57f.zip |
GLK: ALAN2: Open text data file on startup
Diffstat (limited to 'engines/glk/alan2/alan2.cpp')
-rw-r--r-- | engines/glk/alan2/alan2.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp index 05a024d4d4..c9625a7076 100644 --- a/engines/glk/alan2/alan2.cpp +++ b/engines/glk/alan2/alan2.cpp @@ -63,14 +63,15 @@ void Alan2::initialize() { winmethod_Fixed, 1, wintype_TextGrid, 0); g_vm->glk_set_window(glkMainWin); - _advName = getFilename(); - while (_advName.contains('.')) - _advName.deleteLastChar(); - advnam = _advName.c_str(); - + // Set up the code file to point to the already opened game file codfil = &_gameFile; strncpy(codfnm, getFilename().c_str(), 255); codfnm[255] = '\0'; + + // Open up the text file + txtfil = new Common::File(); + if (!txtfil->open(Common::String::format("%s.dat", advnam))) + ::error("Could not open adventure text data file"); } Common::Error Alan2::readSaveData(Common::SeekableReadStream *rs) { @@ -84,6 +85,12 @@ Common::Error Alan2::writeGameData(Common::WriteStream *ws) { } bool Alan2::is_gamefile_valid() { + // Set up adventure name + _advName = getFilename(); + while (_advName.contains('.')) + _advName.deleteLastChar(); + advnam = _advName.c_str(); + if (_gameFile.size() < 8) { GUIErrorMessage(_("This is too short to be a valid Alan2 file.")); return false; @@ -94,7 +101,7 @@ bool Alan2::is_gamefile_valid() { return false; } - return true; + return Common::File::exists(Common::String::format("%s.dat", advnam)); } } // End of namespace Alan2 |