diff options
author | rubidium <rubidium@openttd.org> | 2009-02-06 10:38:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-06 10:38:57 +0000 |
commit | 2ab6fffcccd6bd02a67f78769c7ccf4718f66d2b (patch) | |
tree | ea68c9bdd0746ba55ea0c7b807a83418075ed0e3 | |
parent | 6252c745841848f7aa7a5c94c5a6edbf1afb36cf (diff) | |
download | openttd-2ab6fffcccd6bd02a67f78769c7ccf4718f66d2b.tar.xz |
(svn r15369) -Codechange: generalise the GUIList a bit so peter can write filters for cargo type, speed and mass ;)
-rw-r--r-- | src/sortlist_type.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sortlist_type.h b/src/sortlist_type.h index 8bcfd7aad..ba9f8a8d2 100644 --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -32,11 +32,11 @@ struct Filtering { byte criteria; ///< Filtering criteria }; -template <typename T, typename F = char> +template <typename T, typename F = const char*> class GUIList : public SmallVector<T, 32> { public: typedef int CDECL SortFunction(const T*, const T*); - typedef bool CDECL FilterFunction(const T*, const F*); + typedef bool CDECL FilterFunction(const T*, F); protected: SortFunction * const *sort_func_list; ///< the sort criteria functions @@ -316,7 +316,7 @@ public: * @param filter_data Additional data passed to the filter function * @return true if the list has been altered by filtering */ - bool Filter(FilterFunction *decide, const F *filter_data) + bool Filter(FilterFunction *decide, F filter_data) { /* Do not filter if the filter bit is not set */ if (!HASBITS(this->flags, VL_FILTER)) return false; @@ -349,7 +349,7 @@ public: * @param filter_data Additional data passed to the filter function. * @return true if the list has been altered by filtering */ - bool Filter(const F *filter_data) + bool Filter(F filter_data) { if (this->filter_func_list == NULL) return false; return this->Filter(this->filter_func_list[this->filter_type], filter_data); |