From 1c5110e725e8d5bd2682727b5cbbc9d7b959b95f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 11 Apr 2009 00:29:52 +0000 Subject: SAGA: Got rid of some more SortedList methods svn-id: r39922 --- engines/saga/events.cpp | 2 +- engines/saga/font.h | 4 ++++ engines/saga/list.h | 25 +++---------------------- 3 files changed, 8 insertions(+), 23 deletions(-) (limited to 'engines/saga') diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 99eb200f0f..5570665606 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -290,7 +290,7 @@ int Events::handleOneShot(Event *event) { ((TextListEntry *)event->data)->display = true; break; case kEventRemove: - _vm->_scene->_textList.remove((TextListEntry *)event->data); + _vm->_scene->_textList.remove(*((TextListEntry *)event->data)); break; default: break; diff --git a/engines/saga/font.h b/engines/saga/font.h index 84a1ec70ba..248cee6d4f 100644 --- a/engines/saga/font.h +++ b/engines/saga/font.h @@ -88,6 +88,10 @@ struct TextListEntry { TextListEntry() { memset(this, 0, sizeof(*this)); } + + bool operator==(const TextListEntry &e) const { + return 0 == memcmp(this, &e, sizeof(*this)); + } }; class TextList: public SortedList { diff --git a/engines/saga/list.h b/engines/saga/list.h index f7d7eee8fc..15ec088b03 100644 --- a/engines/saga/list.h +++ b/engines/saga/list.h @@ -43,10 +43,6 @@ public: public: - iterator pushFront(const T& element) { - return insert(Common::List::begin(), element); - } - iterator pushBack(const T& element) { return insert(Common_List::end(), element); } @@ -57,11 +53,8 @@ public: } iterator pushFront() { - return insert(Common_List::begin()); - } - - iterator pushBack() { - return insert(Common_List::end()); + T tmp; + return insert(Common_List::begin(), tmp); } iterator insert(iterator pos) { @@ -69,10 +62,6 @@ public: return insert(pos, init); } - iterator pushFront(const T& element, CompareFunction compareFunction) { - return insert(Common::List::begin(), element, compareFunction); - } - iterator pushBack(const T& element, CompareFunction compareFunction) { return insert(Common_List::end(), element, compareFunction); } @@ -81,21 +70,13 @@ public: int res; for (iterator i = Common_List::begin(); i != Common_List::end(); ++i) { - res = compareFunction(element, i.operator*()); + res = compareFunction(element, *i); if (res < 0) { return insert(i, element); } } return pushBack(element); } - - void remove(const T* val) { - for (iterator i = Common_List::begin(); i != Common_List::end(); ++i) - if (val == i.operator->()) { - erase(i); - return; - } - } }; } // End of namespace Saga -- cgit v1.2.3