[Scummvm-cvs-logs] CVS: scummvm/sword1 resman.cpp,1.23,1.24 resman.h,1.10,1.11 sword1.cpp,1.60,1.61 sword1.h,1.17,1.18

Robert Göffringmann lavosspawn at users.sourceforge.net
Thu Nov 18 23:56:05 CET 2004


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

Modified Files:
	resman.cpp resman.h sword1.cpp sword1.h 
Log Message:
a little cleanup

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- resman.cpp	9 Nov 2004 04:06:09 -0000	1.23
+++ resman.cpp	19 Nov 2004 07:55:33 -0000	1.24
@@ -46,8 +46,8 @@
 
 #define MAX_PATH_LEN 260
 
-ResMan::ResMan(const char *resFile, MemMan *pMemoMan) {
-	_memMan = pMemoMan;
+ResMan::ResMan(const char *resFile) {
+	_memMan = new MemMan();
 	loadCluDescript(resFile);
 }
 
@@ -71,7 +71,9 @@
 	}
 	debug(0, "ResMan closed\n");
 #endif
+	flush();
 	freeCluDescript();
+	delete _memMan;
 }
 
 void ResMan::loadCluDescript(const char *fileName) {
@@ -165,6 +167,8 @@
 							_memMan->setCondition(group->resHandle + resCnt, MEM_CAN_FREE);
 							group->resHandle[resCnt].refCount = 0;
 						}
+	// the memory manager cached the blocks we asked it to free, so explicitly make it free them
+	_memMan->flush();
 }
 
 void *ResMan::fetchRes(uint32 id) {

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- resman.h	5 Nov 2004 22:12:07 -0000	1.10
+++ resman.h	19 Nov 2004 07:55:33 -0000	1.11
@@ -50,7 +50,7 @@
 
 class ResMan {
 public:
-	ResMan(const char *resFile, MemMan *pMemoMan);
+	ResMan(const char *resFile);
 	~ResMan(void);
 	void flush(void);
 	void resClose(uint32 id);

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- sword1.cpp	15 Nov 2004 08:23:09 -0000	1.60
+++ sword1.cpp	19 Nov 2004 07:55:33 -0000	1.61
@@ -29,7 +29,6 @@
 #include "common/file.h"
 #include "common/timer.h"
 
-#include "sword1/memman.h"
 #include "sword1/resman.h"
 #include "sword1/objectman.h"
 #include "sword1/mouse.h"
@@ -121,10 +120,7 @@
 	delete _screen;
 	delete _mouse;
 	delete _objectMan;
-	_resMan->flush(); // free all memory
-	_memMan->flush();
 	delete _resMan;
-	delete _memMan;
 }
 
 void SwordEngine::initialize(void) {
@@ -140,10 +136,8 @@
 	File::addDefaultDirectory(_gameDataPath + "video/");
 
 	_system->initSize(640, 480);
-	debug(5, "Starting memory manager");
-	_memMan = new MemMan();
 	debug(5, "Starting resource manager");
-	_resMan = new ResMan("swordres.rif", _memMan);
+	_resMan = new ResMan("swordres.rif");
 	debug(5, "Starting object manager");
 	_objectMan = new ObjectMan(_resMan);
 	_mixer->setVolume(255);
@@ -207,8 +201,7 @@
 }
 
 void SwordEngine::reinitialize(void) {
-	_resMan->flush(); // free everything that's currently alloced and opened.
-	_memMan->flush(); // Handle with care.
+	_resMan->flush(); // free everything that's currently alloced and opened. (*evil*)
 
 	_logic->initialize();     // now reinitialize these objects as they (may) have locked
 	_objectMan->initialize(); // resources which have just been wiped.

Index: sword1.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- sword1.h	15 Nov 2004 02:48:30 -0000	1.17
+++ sword1.h	19 Nov 2004 07:55:33 -0000	1.18
@@ -45,7 +45,6 @@
 class Logic;
 class Mouse;
 class ResMan;
-class MemMan;
 class ObjectMan;
 class Menu;
 class Music;
@@ -89,7 +88,6 @@
 	uint16 _mouseX, _mouseY, _mouseState;
 	uint8 _keyPressed;
 
-	MemMan		*_memMan;
 	ResMan		*_resMan;
 	ObjectMan	*_objectMan;
 	Screen		*_screen;





More information about the Scummvm-git-logs mailing list