[Scummvm-cvs-logs] CVS: scummvm/kyra resource.cpp,1.1,1.2 resource.h,1.1,1.2 script.cpp,1.1,1.2

James Brown ender at users.sourceforge.net
Fri Oct 15 03:39:19 CEST 2004


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10970/kyra

Modified Files:
	resource.cpp resource.h script.cpp 
Log Message:
Fix a few things


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/resource.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- resource.cpp	15 Oct 2004 06:06:47 -0000	1.1
+++ resource.cpp	15 Oct 2004 10:32:17 -0000	1.2
@@ -29,6 +29,7 @@
 namespace Kyra {
 	Resourcemanager::Resourcemanager(KyraEngine* engine, const char* gamedir) {
 		_gameDir = gamedir;
+		_engine = engine;
 		
 		// prefetches all PAK Files
 		
@@ -41,12 +42,11 @@
 		};
 		
 		for (uint32 tmp = 0; kyraFilelist[tmp]; ++tmp)	{
-				
 			// prefetch file
 			PAKFile* file = new PAKFile(getPath() + kyraFilelist[tmp]);
 			assert(file);			
      
-			if (file->isValid())		
+			if (file->isOpen() && file->isValid())		
 				_pakfiles.push_back(file);
 			else
 				warning("couldn't load file '%s' correctly", kyraFilelist[tmp]);
@@ -179,9 +179,10 @@
 ///////////////////////////////////////////
 // Pak file manager
 	#define PAKFile_Iterate Common::List<PakChunk*>::iterator start=_files.begin();start != _files.end(); ++start
-
 	PAKFile::PAKFile(const Common::String& file) {
 		File pakfile;
+		_buffer = 0;
+		_open = false;
 
 		if (!pakfile.open(file.c_str())) {
 			warning("PAKFile couldn't open: '%s'", file.c_str());
@@ -221,11 +222,13 @@
 
 			_files.push_back(chunk);
 		}
+		_open = true;
  	}
 
 	PAKFile::~PAKFile() {
 		delete [] _buffer;
 		_buffer = 0;
+		_open = false;
 
 		for (PAKFile_Iterate) {
  			delete *start;

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/resource.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- resource.h	15 Oct 2004 06:06:47 -0000	1.1
+++ resource.h	15 Oct 2004 10:32:17 -0000	1.2
@@ -34,7 +34,6 @@
 
 	// standard Package format for Kyrandia games
 	class PAKFile {
-
 		struct PakChunk {
 			const char* _name;
 			const uint8* _data;
@@ -49,10 +48,10 @@
 		const uint8* getFile(const char* file);
 		uint32 getFileSize(const char* file);
 
-		bool isValid(void) { return (_buffer != 0); }
-
+		bool isValid(void) {return (_buffer != 0);}
+		bool isOpen(void) {return _open;}
 	private:
-
+		bool _open;
 		uint8* _buffer; // the whole file
 		Common::List<PakChunk*> _files; // the entries
 

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- script.cpp	15 Oct 2004 06:06:47 -0000	1.1
+++ script.cpp	15 Oct 2004 10:32:17 -0000	1.2
@@ -345,6 +345,9 @@
 			{ 0, 0 }
 		};
 
+		_commands = commandProcs;
+//		_opcodes = opcodeProcs;
+
 		_scriptFile = NULL;
 		_scriptFileSize = 0;
 	}





More information about the Scummvm-git-logs mailing list