From 02ca56eec864c6e4e74b614a9d4be6c331e99eef Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 11 Apr 2009 09:23:40 +0000 Subject: Removed all but one of the functions of the SortedList, apart from the custom insert() operation. It's only used in one place now (in _drawOrderList) svn-id: r39925 --- engines/saga/actor.cpp | 4 ++-- engines/saga/events.cpp | 3 ++- engines/saga/events.h | 2 +- engines/saga/font.h | 5 +++-- engines/saga/list.h | 21 ++++----------------- engines/saga/script.h | 2 +- 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp index d52aac8b92..17834aec35 100644 --- a/engines/saga/actor.cpp +++ b/engines/saga/actor.cpp @@ -985,7 +985,7 @@ void Actor::createDrawOrderList() { continue; if (calcScreenPosition(actor)) { - _drawOrderList.pushBack(actor, compareFunction); + _drawOrderList.insert(actor, compareFunction); } } @@ -1005,7 +1005,7 @@ void Actor::createDrawOrderList() { continue; if (calcScreenPosition(obj)) { - _drawOrderList.pushBack(obj, compareFunction); + _drawOrderList.insert(obj, compareFunction); } } } diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 5570665606..2e0cb9f09a 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -580,7 +580,8 @@ int Events::handleInterval(Event *event) { Event *Events::queue(Event *event) { Event *queuedEvent; - queuedEvent = &*_eventList.pushBack(*event); + _eventList.push_back(*event); + queuedEvent = &*--_eventList.end(); initializeEvent(queuedEvent); return queuedEvent; diff --git a/engines/saga/events.h b/engines/saga/events.h index c2082994bc..299e707195 100644 --- a/engines/saga/events.h +++ b/engines/saga/events.h @@ -148,7 +148,7 @@ struct Event { } }; -typedef SortedList EventList; +typedef Common::List EventList; #define EVENT_WARNINGCOUNT 1000 #define EVENT_MASK 0x00FF diff --git a/engines/saga/font.h b/engines/saga/font.h index 248cee6d4f..37ff56ea2d 100644 --- a/engines/saga/font.h +++ b/engines/saga/font.h @@ -94,11 +94,12 @@ struct TextListEntry { } }; -class TextList: public SortedList { +class TextList: public Common::List { public: TextListEntry *addEntry(const TextListEntry &entry) { - return &*pushBack(entry); + Common::List::push_back(entry); + return &*--Common::List::end(); } }; diff --git a/engines/saga/list.h b/engines/saga/list.h index 454b81dce4..c6789fec0c 100644 --- a/engines/saga/list.h +++ b/engines/saga/list.h @@ -37,31 +37,18 @@ class SortedList : public Common::List { public: typedef int (*CompareFunction) (const T& a, const T& b); - typedef typename Common::List::iterator iterator; - typedef typename Common::List::const_iterator const_iterator; - -public: - - iterator pushBack(const T& element) { - 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); - } - - iterator insert(iterator pos, const T& element, CompareFunction compareFunction) { + iterator insert(const T& element, CompareFunction compareFunction) { int res; - for (iterator i = Common::List::begin(); i != Common::List::end(); ++i) { + for (Common::List::iterator i = Common::List::begin(); i != Common::List::end(); ++i) { res = compareFunction(element, *i); if (res < 0) { Common::List::insert(i, element); return --i; } } - return pushBack(element); + Common::List::push_back(element); + return --Common::List::end(); } }; diff --git a/engines/saga/script.h b/engines/saga/script.h index 3061a31bb3..423e4d0ee7 100644 --- a/engines/saga/script.h +++ b/engines/saga/script.h @@ -268,7 +268,7 @@ public: } }; -typedef SortedList ScriptThreadList; +typedef Common::List ScriptThreadList; #define SCRIPTOP_PARAMS ScriptThread *thread, MemoryReadStream *scriptS, bool &stopParsing, bool &breakOut #define SCRIPTFUNC_PARAMS ScriptThread *thread, int nArgs, bool &disContinue -- cgit v1.2.3