[Scummvm-cvs-logs] scummvm master -> 89f9c5a9c35834856bb3692fb30a9eb42606ec91

bluegr md5 at scummvm.org
Sun Mar 20 14:30:49 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
89f9c5a9c3 SCI: Moved the engine hunk pointer processing code inside the GfxPorts class


Commit: 89f9c5a9c35834856bb3692fb30a9eb42606ec91
    https://github.com/scummvm/scummvm/commit/89f9c5a9c35834856bb3692fb30a9eb42606ec91
Author: md5 (md5 at scummvm.org)
Date: 2011-03-20T06:29:12-07:00

Commit Message:
SCI: Moved the engine hunk pointer processing code inside the GfxPorts class

This allows us make _windowList private again

Changed paths:
    engines/sci/engine/gc.cpp
    engines/sci/engine/gc.h
    engines/sci/graphics/ports.cpp
    engines/sci/graphics/ports.h



diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index d205763..e395eea 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -49,28 +49,23 @@ const char *segmentTypeNames[] = {
 };
 #endif
 
-struct WorklistManager {
-	Common::Array<reg_t> _worklist;
-	AddrSet _map;	// used for 2 contains() calls, inside push() and run_gc()
+void WorklistManager::push(reg_t reg) {
+	if (!reg.segment) // No numbers
+		return;
 
-	void push(reg_t reg) {
-		if (!reg.segment) // No numbers
-			return;
+	debugC(kDebugLevelGC, "[GC] Adding %04x:%04x", PRINT_REG(reg));
 
-		debugC(kDebugLevelGC, "[GC] Adding %04x:%04x", PRINT_REG(reg));
+	if (_map.contains(reg))
+		return; // already dealt with it
 
-		if (_map.contains(reg))
-			return; // already dealt with it
-
-		_map.setVal(reg, true);
-		_worklist.push_back(reg);
-	}
+	_map.setVal(reg, true);
+	_worklist.push_back(reg);
+}
 
-	void pushArray(const Common::Array<reg_t> &tmp) {
-		for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
-			push(*it);
-	}
-};
+void WorklistManager::pushArray(const Common::Array<reg_t> &tmp) {
+	for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
+		push(*it);
+}
 
 static AddrSet *normalizeAddresses(SegManager *segMan, const AddrSet &nonnormal_map) {
 	AddrSet *normal_map = new AddrSet();
@@ -103,18 +98,6 @@ static void processWorkList(SegManager *segMan, WorklistManager &wm, const Commo
 	}
 }
 
-static void processEngineHunkList(WorklistManager &wm) {
-	PortList windowList = g_sci->_gfxPorts->_windowList;
-
-	for (PortList::const_iterator it = windowList.begin(); it != windowList.end(); ++it) {
-		if ((*it)->isWindow()) {
-			Window *wnd = ((Window *)*it);
-			wm.push(wnd->hSaved1);
-			wm.push(wnd->hSaved2);
-		}
-	}
-}
-
 AddrSet *findAllActiveReferences(EngineState *s) {
 	assert(!s->_executionStack.empty());
 
@@ -174,8 +157,8 @@ AddrSet *findAllActiveReferences(EngineState *s) {
 
 	processWorkList(s->_segMan, wm, heap);
 
-	if (getSciVersion() <= SCI_VERSION_1_1)
-		processEngineHunkList(wm);
+	if (g_sci->_gfxPorts)
+		g_sci->_gfxPorts->processEngineHunkList(wm);
 
 	return normalizeAddresses(s->_segMan, wm._map);
 }
diff --git a/engines/sci/engine/gc.h b/engines/sci/engine/gc.h
index f4318a1..48e1c6b 100644
--- a/engines/sci/engine/gc.h
+++ b/engines/sci/engine/gc.h
@@ -58,6 +58,15 @@ AddrSet *findAllActiveReferences(EngineState *s);
  */
 void run_gc(EngineState *s);
 
+struct WorklistManager {
+	Common::Array<reg_t> _worklist;
+	AddrSet _map;	// used for 2 contains() calls, inside push() and run_gc()
+
+	void push(reg_t reg);
+	void pushArray(const Common::Array<reg_t> &tmp);
+};
+
+
 } // End of namespace Sci
 
 #endif // SCI_ENGINE_GC_H
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index aca278f..cc206bd 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -28,6 +28,7 @@
 #include "sci/console.h"
 #include "sci/sci.h"
 #include "sci/engine/features.h"
+#include "sci/engine/gc.h"
 #include "sci/engine/kernel.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
@@ -708,6 +709,16 @@ int16 GfxPorts::kernelPriorityToCoordinate(byte priority) {
 	return _priorityBottom;
 }
 
+void GfxPorts::processEngineHunkList(WorklistManager &wm) {
+	for (PortList::const_iterator it = _windowList.begin(); it != _windowList.end(); ++it) {
+		if ((*it)->isWindow()) {
+			Window *wnd = ((Window *)*it);
+			wm.push(wnd->hSaved1);
+			wm.push(wnd->hSaved2);
+		}
+	}
+}
+
 void GfxPorts::printWindowList(Console *con) {
 	for (PortList::const_iterator it = _windowList.begin(); it != _windowList.end(); ++it) {
 		if ((*it)->isWindow()) {
diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h
index d142727..31ed671 100644
--- a/engines/sci/graphics/ports.h
+++ b/engines/sci/graphics/ports.h
@@ -35,6 +35,7 @@ namespace Sci {
 class GfxPaint16;
 class GfxScreen;
 class GfxText16;
+struct WorklistManager;
 
 // window styles
 enum {
@@ -102,6 +103,7 @@ public:
 	void kernelGraphAdjustPriority(int top, int bottom);
 	byte kernelCoordinateToPriority(int16 y);
 	int16 kernelPriorityToCoordinate(byte priority);
+	void processEngineHunkList(WorklistManager &wm);
 	void printWindowList(Console *con);
 
 	Port *_wmgrPort;
@@ -115,10 +117,10 @@ public:
 
 	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 
+private:
 	/** The list of open 'windows' (and ports), in visual order. */
 	PortList _windowList;
 
-private:
 	/** The list of all open 'windows' (and ports), ordered by their id. */
 	PortArray _windowsById;
 






More information about the Scummvm-git-logs mailing list