diff options
| author | Willem Jan Palenstijn | 2011-02-28 20:32:46 +0100 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2011-02-28 21:37:12 +0100 | 
| commit | db536da8d3838bc69cd2c18f49d62e9151d425a5 (patch) | |
| tree | 4b6e413413084426de15e8ffaad0219837c44685 | |
| parent | ce288024b495032d15940dc4b93069a3bc845f48 (diff) | |
| download | scummvm-rg350-db536da8d3838bc69cd2c18f49d62e9151d425a5.tar.gz scummvm-rg350-db536da8d3838bc69cd2c18f49d62e9151d425a5.tar.bz2 scummvm-rg350-db536da8d3838bc69cd2c18f49d62e9151d425a5.zip  | |
SCI: Skip Ports when iterating over Windows in GC
| -rw-r--r-- | engines/sci/engine/gc.cpp | 10 | ||||
| -rw-r--r-- | engines/sci/graphics/helpers.h | 6 | ||||
| -rw-r--r-- | engines/sci/graphics/ports.cpp | 12 | ||||
| -rw-r--r-- | engines/sci/graphics/ports.h | 3 | 
4 files changed, 19 insertions, 12 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index e080ad6e4b..15be17fd32 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -89,11 +89,11 @@ static void processEngineHunkList(WorklistManager &wm) {  	PortList windowList = g_sci->_gfxPorts->_windowList;  	for (PortList::const_iterator it = windowList.begin(); it != windowList.end(); ++it) { -		// FIXME: We also store Port objects in the window list. -		// We should add a check that we really only pass windows here... -		Window *wnd = ((Window *)*it); -		wm.push(wnd->hSaved1); -		wm.push(wnd->hSaved2); +		if ((*it)->isWindow()) { +			Window *wnd = ((Window *)*it); +			wm.push(wnd->hSaved1); +			wm.push(wnd->hSaved2); +		}  	}  } diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h index f6cb214a2b..3c6515ae73 100644 --- a/engines/sci/graphics/helpers.h +++ b/engines/sci/graphics/helpers.h @@ -45,6 +45,10 @@ typedef int GuiResourceId; // is a resource-number and -1 means no parameter giv  typedef int16 TextAlignment; +#define PORTS_FIRSTWINDOWID 2 +#define PORTS_FIRSTSCRIPTWINDOWID 3 + +  struct Port {  	uint16 id;  	int16 top, left; @@ -62,6 +66,8 @@ struct Port {  		fontHeight(0), fontId(0), greyedOutput(false),  		penClr(0), backClr(0xFF), penMode(0), counterTillFree(0) {  	} + +	bool isWindow() const { return id >= PORTS_FIRSTWINDOWID && id != 0xFFFF; }  };  struct Window : public Port, public Common::Serializable { diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index b19a8627f9..9aa539a29a 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -246,8 +246,10 @@ void GfxPorts::beginUpdate(Window *wnd) {  	PortList::iterator it = _windowList.reverse_begin();  	const PortList::iterator end = Common::find(_windowList.begin(), _windowList.end(), wnd);  	while (it != end) { -		// FIXME: We also store Port objects in the window list. -		// We should add a check that we really only pass windows here... +		// We also store Port objects in the window list, but they +		// shouldn't be encountered during this iteration. +		assert((*it)->isWindow()); +  		updateWindow((Window *)*it);  		--it;  	} @@ -263,8 +265,10 @@ void GfxPorts::endUpdate(Window *wnd) {  	assert(it != end);  	while (++it != end) { -		// FIXME: We also store Port objects in the window list. -		// We should add a check that we really only pass windows here... +		// We also store Port objects in the window list, but they +		// shouldn't be encountered during this iteration. +		assert((*it)->isWindow()); +  		updateWindow((Window *)*it);  	} diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h index b94d54ab10..9faee2be8d 100644 --- a/engines/sci/graphics/ports.h +++ b/engines/sci/graphics/ports.h @@ -37,9 +37,6 @@ class GfxPaint16;  class GfxScreen;  class GfxText16; -#define PORTS_FIRSTWINDOWID 2 -#define PORTS_FIRSTSCRIPTWINDOWID 3 -  // window styles  enum {  	SCI_WINDOWMGR_STYLE_TRANSPARENT = (1 << 0),  | 
