aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/defs.h
diff options
context:
space:
mode:
authorNicola Mettifogo2007-04-07 17:18:16 +0000
committerNicola Mettifogo2007-04-07 17:18:16 +0000
commitedd226d1b646470780a785d32c06876697f75e7e (patch)
tree11545dfe20ffbecc5de86c5ca004dca5992b6970 /engines/parallaction/defs.h
parent5a8b8ca92dc95ced8df2a7f6a46412c04ebfe757 (diff)
downloadscummvm-rg350-edd226d1b646470780a785d32c06876697f75e7e.tar.gz
scummvm-rg350-edd226d1b646470780a785d32c06876697f75e7e.tar.bz2
scummvm-rg350-edd226d1b646470780a785d32c06876697f75e7e.zip
Added new ManagedList class to handle Instruction and Command lists. The same class will be used to hold Zone, Animation and WalkNode lists.
svn-id: r26410
Diffstat (limited to 'engines/parallaction/defs.h')
-rw-r--r--engines/parallaction/defs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/engines/parallaction/defs.h b/engines/parallaction/defs.h
index cab8f14be0..09628f6685 100644
--- a/engines/parallaction/defs.h
+++ b/engines/parallaction/defs.h
@@ -23,6 +23,9 @@
#ifndef PARALLACTION_DEFS_H
#define PARALLACTION_DEFS_H
+#include "common/stdafx.h"
+#include "common/list.h"
+
namespace Parallaction {
// TODO (LIST): this struct won't be used anymore as soon as List<> is enforced throughout the code.
@@ -40,6 +43,33 @@ struct Node {
}
};
+template <class T>
+class ManagedList : public Common::List<T> {
+
+public:
+
+ typedef typename Common::List<T> Common_List;
+ typedef typename Common::List<T>::iterator iterator;
+
+ ~ManagedList() {
+ clear();
+ }
+
+ void clear() {
+ erase(Common_List::begin(), Common_List::end());
+ }
+
+ iterator erase(iterator pos) {
+ return erase(pos, pos);
+ }
+
+ iterator erase(iterator first, iterator last) {
+ for (iterator it = first; it != last; it++)
+ delete *it;
+ return Common_List::erase(first, last);
+ }
+
+};
} // namespace Parallaction