aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2009-04-11 09:04:50 +0000
committerFilippos Karapetis2009-04-11 09:04:50 +0000
commit271f8b58b594aee76dcee625251a6ca9f517fcd8 (patch)
tree74d1bb4fcad1af42d7f2dcd4864cc8d96b3c0ae8 /engines/saga
parent64fc4253e8df69f7539809f8eabba20e1ca029db (diff)
downloadscummvm-rg350-271f8b58b594aee76dcee625251a6ca9f517fcd8.tar.gz
scummvm-rg350-271f8b58b594aee76dcee625251a6ca9f517fcd8.tar.bz2
scummvm-rg350-271f8b58b594aee76dcee625251a6ca9f517fcd8.zip
Removed move SortedList methods
svn-id: r39924
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/list.h26
-rw-r--r--engines/saga/sthread.cpp8
2 files changed, 10 insertions, 24 deletions
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<T>::iterator iterator;
typedef typename Common::List<T>::const_iterator const_iterator;
- typedef typename Common::List<T> 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<T>::insert(Common::List<T>::end(), element);
+ return --Common::List<T>::end();
}
iterator pushBack(const T& element, CompareFunction compareFunction) {
- return insert(Common_List::end(), element, compareFunction);
+ return insert(Common::List<T>::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<T>::begin(); i != Common::List<T>::end(); ++i) {
res = compareFunction(element, *i);
if (res < 0) {
- return insert(i, element);
+ Common::List<T>::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) {