[Scummvm-cvs-logs] SF.net SVN: scummvm:[46290] scummvm/trunk/engines/sci/engine
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Dec 8 21:44:01 CET 2009
Revision: 46290
http://scummvm.svn.sourceforge.net/scummvm/?rev=46290&view=rev
Author: fingolfin
Date: 2009-12-08 20:44:01 +0000 (Tue, 08 Dec 2009)
Log Message:
-----------
SCI: Cleanup DirSeeker a little bit
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kfile.cpp
scummvm/trunk/engines/sci/engine/state.h
Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp 2009-12-08 20:40:26 UTC (rev 46289)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp 2009-12-08 20:44:01 UTC (rev 46290)
@@ -619,13 +619,12 @@
};
-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 @@
// 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 @@
_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 @@
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 : {
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2009-12-08 20:40:26 UTC (rev 46289)
+++ scummvm/trunk/engines/sci/engine/state.h 2009-12-08 20:44:01 UTC (rev 46290)
@@ -75,8 +75,8 @@
_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 {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list