[Scummvm-cvs-logs] SF.net SVN: scummvm:[41822] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Wed Jun 24 01:55:35 CEST 2009
Revision: 41822
http://scummvm.svn.sourceforge.net/scummvm/?rev=41822&view=rev
Author: drmccoy
Date: 2009-06-23 23:55:35 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
Putting TOT filename generation and LOM checking into TOTFile
Modified Paths:
--------------
scummvm/trunk/engines/gob/script.cpp
scummvm/trunk/engines/gob/script.h
scummvm/trunk/engines/gob/totfile.cpp
scummvm/trunk/engines/gob/totfile.h
Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp 2009-06-23 23:55:19 UTC (rev 41821)
+++ scummvm/trunk/engines/gob/script.cpp 2009-06-23 23:55:35 UTC (rev 41822)
@@ -319,33 +319,16 @@
return _expression->getResultStr();
}
-bool Script::load(const char *fileName) {
+bool Script::load(const Common::String &fileName) {
unload();
_finished = false;
- bool lom = false;
+ bool isLOM;
- Common::String *fileBase;
+ _totFile = TOTFile::createFileName(fileName, isLOM);
- const char *dot;
- if ((dot = strrchr(fileName, '.'))) {
- // fileName includes an extension
-
- fileBase = new Common::String(fileName, dot);
-
- // Is it a LOM file?
- if (!scumm_stricmp(dot + 1, "LOM"))
- lom = true;
- } else
- fileBase = new Common::String(fileName);
-
- // If it's a LOM file, it includes the TOT file
- _totFile = *fileBase + (lom ? ".lom" : ".tot");
-
- delete fileBase;
-
- if (lom) {
+ if (isLOM) {
if (!loadLOM(_totFile)) {
unload();
return false;
Modified: scummvm/trunk/engines/gob/script.h
===================================================================
--- scummvm/trunk/engines/gob/script.h 2009-06-23 23:55:19 UTC (rev 41821)
+++ scummvm/trunk/engines/gob/script.h 2009-06-23 23:55:35 UTC (rev 41822)
@@ -99,7 +99,7 @@
byte *getData();
/** Load a script file. */
- bool load(const char *fileName);
+ bool load(const Common::String &fileName);
/** Unload the script. */
void unload();
/** Was a script loaded? */
Modified: scummvm/trunk/engines/gob/totfile.cpp
===================================================================
--- scummvm/trunk/engines/gob/totfile.cpp 2009-06-23 23:55:19 UTC (rev 41821)
+++ scummvm/trunk/engines/gob/totfile.cpp 2009-06-23 23:55:35 UTC (rev 41822)
@@ -98,4 +98,20 @@
return true;
}
+Common::String TOTFile::createFileName(const Common::String &base, bool &isLOM) {
+ isLOM = false;
+
+ const char *dot;
+ if ((dot = strrchr(base.c_str(), '.'))) {
+ // fileName includes an extension
+
+ if (!scumm_stricmp(dot + 1, "LOM"))
+ isLOM = true;
+
+ return base;
+ }
+
+ return base + ".tot";
+}
+
} // End of namespace Gob
Modified: scummvm/trunk/engines/gob/totfile.h
===================================================================
--- scummvm/trunk/engines/gob/totfile.h 2009-06-23 23:55:19 UTC (rev 41821)
+++ scummvm/trunk/engines/gob/totfile.h 2009-06-23 23:55:35 UTC (rev 41822)
@@ -26,8 +26,9 @@
#ifndef GOB_TOTFILE_H
#define GOB_TOTFILE_H
+#include "common/str.h"
+
namespace Common {
- class String;
class SeekableReadStream;
}
@@ -62,6 +63,8 @@
Common::SeekableReadStream *getStream() const;
bool getProperties(Properties &props) const;
+ static Common::String createFileName(const Common::String &base, bool &isLOM);
+
private:
GobEngine *_vm;
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