From 271f8b58b594aee76dcee625251a6ca9f517fcd8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Apr 2009 09:04:50 +0000 Subject: Removed move SortedList methods svn-id: r39924 --- engines/saga/list.h | 26 ++++++-------------------- engines/saga/sthread.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/saga/list.h b/engines/saga/list.h index 15ec088b03..454b81dce4 100644 --- a/engines/saga/list.h +++ b/engines/saga/list.h @@ -39,40 +39,26 @@ public: typedef typename Common::List::iterator iterator; typedef typename Common::List::const_iterator const_iterator; - typedef typename Common::List Common_List; public: iterator pushBack(const T& element) { - return insert(Common_List::end(), element); - } - - iterator insert(iterator pos, const T& element) { - Common_List::insert(pos, element); - return --pos; - } - - iterator pushFront() { - T tmp; - return insert(Common_List::begin(), tmp); - } - - iterator insert(iterator pos) { - T init; - return insert(pos, init); + Common::List::insert(Common::List::end(), element); + return --Common::List::end(); } iterator pushBack(const T& element, CompareFunction compareFunction) { - return insert(Common_List::end(), element, compareFunction); + return insert(Common::List::end(), element, compareFunction); } iterator insert(iterator pos, const T& element, CompareFunction compareFunction) { int res; - for (iterator i = Common_List::begin(); i != Common_List::end(); ++i) { + for (iterator i = Common::List::begin(); i != Common::List::end(); ++i) { res = compareFunction(element, *i); if (res < 0) { - return insert(i, element); + Common::List::insert(i, element); + return --i; } } return pushBack(element); diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp index 70a73038a9..177cabb729 100644 --- a/engines/saga/sthread.cpp +++ b/engines/saga/sthread.cpp @@ -38,14 +38,13 @@ namespace Saga { ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntryPointNumber) { - ScriptThread *newThread; + ScriptThread *newThread = new ScriptThread(); loadModule(scriptModuleNumber); if (_modules[scriptModuleNumber].entryPointsCount <= scriptEntryPointNumber) { error("Script::createThread wrong scriptEntryPointNumber"); } - newThread = &(*_threadList.pushFront()); newThread->_flags = kTFlagNone; newThread->_stackSize = DEFAULT_THREAD_STACK_SIZE; newThread->_stackBuf = (uint16 *)malloc(newThread->_stackSize * sizeof(uint16)); @@ -55,7 +54,6 @@ ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntry newThread->_staticBase = _commonBuffer + _modules[scriptModuleNumber].staticOffset; newThread->_moduleBase = _modules[scriptModuleNumber].moduleBase; newThread->_moduleBaseSize = _modules[scriptModuleNumber].moduleBaseSize; - newThread->_strings = &_modules[scriptModuleNumber].strings; if (_vm->getGameId() == GID_IHNM) @@ -63,7 +61,9 @@ ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntry else newThread->_voiceLUT = &_modules[scriptModuleNumber].voiceLUT; - return newThread; + _threadList.push_front(*newThread); + + return &*_threadList.begin(); } void Script::wakeUpActorThread(int waitType, void *threadObj) { -- cgit v1.2.3