diff options
author | Max Horn | 2009-12-08 20:44:01 +0000 |
---|---|---|
committer | Max Horn | 2009-12-08 20:44:01 +0000 |
commit | 923cbff625f91c5afc6163813852e9a58ed43912 (patch) | |
tree | eed259896dc3ef187d21bcc9b2760265fe18aa03 /engines/sci/engine | |
parent | f46e76c9b4bddb24eb69f4ca03ea3975d03f0ac6 (diff) | |
download | scummvm-rg350-923cbff625f91c5afc6163813852e9a58ed43912.tar.gz scummvm-rg350-923cbff625f91c5afc6163813852e9a58ed43912.tar.bz2 scummvm-rg350-923cbff625f91c5afc6163813852e9a58ed43912.zip |
SCI: Cleanup DirSeeker a little bit
svn-id: r46290
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kfile.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 4 |
2 files changed, 11 insertions, 13 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 7a05d2ab32..c3b5f0f296 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -619,13 +619,12 @@ enum { }; -void DirSeeker::firstFile(const char *mask, reg_t buffer) { +reg_t DirSeeker::firstFile(const Common::String &mask, reg_t buffer) { // Verify that we are given a valid buffer if (!buffer.segment) { - error("DirSeeker::firstFile('%s') invoked with invalid buffer", mask); - _state->r_acc = NULL_REG; - return; + error("DirSeeker::firstFile('%s') invoked with invalid buffer", mask.c_str()); + return NULL_REG; } _outbuffer = buffer; @@ -636,13 +635,12 @@ void DirSeeker::firstFile(const char *mask, reg_t buffer) { // Reset the list iterator and write the first match to the output buffer, if any. _iter = _savefiles.begin(); - nextFile(); + return nextFile(); } -void DirSeeker::nextFile() { +reg_t DirSeeker::nextFile() { if (_iter == _savefiles.end()) { - _state->r_acc = NULL_REG; - return; + return NULL_REG; } // TODO: Transform the string back into a format usable by the SCI scripts. @@ -653,8 +651,8 @@ void DirSeeker::nextFile() { _state->_segMan->strcpy(_outbuffer, string.c_str()); // Return the result and advance the list iterator :) - _state->r_acc = _outbuffer; ++_iter; + return _outbuffer; } @@ -797,13 +795,13 @@ reg_t kFileIO(EngineState *s, int argc, reg_t *argv) { if (mask == "*.*") mask = "*"; // For UNIX #endif - s->_dirseeker.firstFile(mask.c_str(), buf); + s->r_acc = s->_dirseeker.firstFile(mask, buf); break; } case K_FILEIO_FIND_NEXT : { debug(3, "K_FILEIO_FIND_NEXT()"); - s->_dirseeker.nextFile(); + s->r_acc = s->_dirseeker.nextFile(); break; } case K_FILEIO_FILE_EXISTS : { diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 7e78867cf3..600717e558 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -75,8 +75,8 @@ public: _iter = _savefiles.begin(); } - void firstFile(const char *mask, reg_t buffer); - void nextFile(); + reg_t firstFile(const Common::String &mask, reg_t buffer); + reg_t nextFile(); }; enum { |