diff options
author | md5 | 2011-03-20 15:29:12 +0200 |
---|---|---|
committer | md5 | 2011-03-20 15:29:12 +0200 |
commit | 89f9c5a9c35834856bb3692fb30a9eb42606ec91 (patch) | |
tree | c357cf62e94a9ec4f518b797ee86c26583e21629 /engines/sci/engine/gc.cpp | |
parent | 4df049f4d7fccb794db45c932e5188296907dbc8 (diff) | |
download | scummvm-rg350-89f9c5a9c35834856bb3692fb30a9eb42606ec91.tar.gz scummvm-rg350-89f9c5a9c35834856bb3692fb30a9eb42606ec91.tar.bz2 scummvm-rg350-89f9c5a9c35834856bb3692fb30a9eb42606ec91.zip |
SCI: Moved the engine hunk pointer processing code inside the GfxPorts class
This allows us make _windowList private again
Diffstat (limited to 'engines/sci/engine/gc.cpp')
-rw-r--r-- | engines/sci/engine/gc.cpp | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index d205763051..e395eeab94 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); } |