src/sortlist_type.h
author skidd13
Tue, 27 May 2008 10:27:30 +0000
changeset 9379 2c6c6a0e2233
parent 9376 afdc4beedc99
child 9386 f3fd0650f9d5
permissions -rw-r--r--
(svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
9274
42b67e65f1c2 (svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents: 9273
diff changeset
     3
/** @file sortlist_type.h Base types for having sorted lists in GUIs. */
9273
35e0224ea8f1 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 9272
diff changeset
     4
9274
42b67e65f1c2 (svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents: 9273
diff changeset
     5
#ifndef SORTLIST_TYPE_H
42b67e65f1c2 (svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents: 9273
diff changeset
     6
#define SORTLIST_TYPE_H
9267
22095cc802dd (svn r13133) -Codechange: Add a base class (descending from Window) for all new windows that are going to require a ResetObjectToPlace to be performed on closing.
belugas
parents: 9264
diff changeset
     7
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9274
diff changeset
     8
#include "misc/smallvec.h"
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
     9
#include "date_type.h"
9365
95e9cbc0257e (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents: 9274
diff changeset
    10
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    11
enum SortListFlags {
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    12
	VL_NONE       = 0,      ///< no sort
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    13
	VL_DESC       = 1 << 0, ///< sort descending or ascending
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    14
	VL_RESORT     = 1 << 1, ///< instruct the code to resort the list in the next loop
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    15
	VL_REBUILD    = 1 << 2, ///< rebuild the sort list
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    16
	VL_FIRST_SORT = 1 << 3, ///< sort with qsort first
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    17
	VL_END        = 1 << 4,
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    18
};
5587
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
    19
DECLARE_ENUM_AS_BIT_SET(SortListFlags);
167d9a91ef02 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5475
diff changeset
    20
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    21
struct Listing {
6117
6507b2a7e71d (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 6024
diff changeset
    22
	bool order;    ///< Ascending/descending
6507b2a7e71d (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 6024
diff changeset
    23
	byte criteria; ///< Sorting criteria
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
    24
};
588
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
    25
9182
412cb6c0caf1 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 9178
diff changeset
    26
template <typename T>
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    27
class GUIList : public SmallVector<T, 32> {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    28
public:
9376
afdc4beedc99 (svn r13280) -Fix (r13276): MSVC compilation was broken
smatz
parents: 9375
diff changeset
    29
	typedef int CDECL SortFunction(const T*, const T*);
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    30
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    31
public: // Temporary: public for conversion only
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    32
	SortFunction* const *func_list; ///< The sort criteria functions
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    33
	SortListFlags flags;            ///< used to control sorting/resorting/etc.
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    34
	uint8 sort_type;                ///< what criteria to sort on
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    35
	uint16 resort_timer;            ///< resort list after a given amount of ticks if set
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    36
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    37
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    38
	 * Check if the list is sortable
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    39
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    40
	 * @return true if we can sort the list
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    41
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    42
	bool IsSortable() const
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    43
	{
9371
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
    44
		return (this->data != NULL && this->items >= 2);
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    45
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    46
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    47
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    48
	 * Reset the resort timer
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    49
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    50
	void ResetResortTimer()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    51
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    52
		/* Resort every 10 days */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    53
		this->resort_timer = DAY_TICKS * 10;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    54
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    55
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    56
	/**
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    57
	 * Reverse the list
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    58
	 */
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    59
	void Reverse()
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    60
	{
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    61
		assert(this->IsSortable());
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    62
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    63
		T *a = this->data;
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    64
		T *b = a + (this->items - 1);
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    65
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    66
		do {
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    67
			Swap(*a, *b);
9375
bed4e8a213d9 (svn r13279) -Codechange: simplify condition for terminating loop when reversing list order
smatz
parents: 9372
diff changeset
    68
		} while (++a < --b);
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    69
	}
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    70
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    71
public:
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    72
	GUIList() :
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    73
		func_list(NULL),
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    74
		flags(VL_FIRST_SORT),
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    75
		sort_type(0),
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    76
		resort_timer(1)
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    77
	{};
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    78
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    79
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    80
	 * Get the sorttype of the list
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    81
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    82
	 * @return The current sorttype
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    83
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    84
	uint8 SortType() const
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    85
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    86
		return this->sort_type;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    87
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    88
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    89
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    90
	 * Set the sorttype of the list
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    91
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    92
	 * @param n_type the new sort type
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    93
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    94
	void SetSortType(uint8 n_type)
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    95
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    96
		if (this->sort_type != n_type) {
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
    97
			SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT);
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    98
			this->sort_type = n_type;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
    99
		}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   100
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   101
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   102
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   103
	 * Export current sort conditions
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   104
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   105
	 * @return the current sort conditions
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   106
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   107
	Listing GetListing() const
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   108
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   109
		Listing l;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   110
		l.order = HASBITS(this->flags, VL_DESC);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   111
		l.criteria = this->sort_type;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   112
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   113
		return l;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   114
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   115
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   116
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   117
	 * Import sort conditions
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   118
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   119
	 * @param l The sport conditions we want to use
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   120
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   121
	void SetListing(Listing l)
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   122
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   123
		if (l.order) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   124
			SETBITS(this->flags, VL_DESC);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   125
		} else {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   126
			CLRBITS(this->flags, VL_DESC);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   127
		}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   128
		this->sort_type = l.criteria;
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   129
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   130
		SETBITS(this->flags, VL_FIRST_SORT);
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   131
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   132
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   133
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   134
	 * Check if a resort is needed next loop
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   135
	 *  If used the resort timer will decrease every call
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   136
	 *  till 0. If 0 reached the resort bit will be set and
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   137
	 *  the timer will be reset.
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   138
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   139
	 * @return true if resort bit is set for next loop
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   140
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   141
	bool NeedResort()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   142
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   143
		if (--this->resort_timer == 0) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   144
			SETBITS(this->flags, VL_RESORT);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   145
			this->ResetResortTimer();
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   146
			return true;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   147
		}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   148
		return false;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   149
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   150
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   151
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   152
	 * Force a resort next Sort call
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   153
	 *  Reset the resort timer if used too.
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   154
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   155
	void ForceResort()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   156
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   157
		SETBITS(this->flags, VL_RESORT);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   158
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   159
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   160
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   161
	 * Check if the sort order is descending
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   162
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   163
	 * @return true if the sort order is descending
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   164
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   165
	bool IsDescSortOrder() const
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   166
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   167
		return HASBITS(this->flags, VL_DESC);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   168
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   169
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   170
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   171
	 * Toogle the sort order
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   172
	 *  Since that is the worst condition for the sort function
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   173
	 *  reverse the list here.
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   174
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   175
	FORCEINLINE void ToggleSortOrder()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   176
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   177
		this->flags ^= VL_DESC;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   178
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   179
		if (this->IsSortable()) this->Reverse();
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   180
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   181
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   182
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   183
	 * GnomeSort algorithm
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   184
	 *  This sorting uses a slightly modifyied Gnome search.
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   185
	 *  The basic Gnome search trys to sort already sorted
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   186
	 *  list parts. The modification skips these. For the first
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   187
	 *  sorting we use qsort since it is faster for irregular
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   188
	 *  sorted data.
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   189
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   190
	 * @param compare The function to compare two list items
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   191
	 * @return true if the list sequence has been altered
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   192
	 * */
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   193
	FORCEINLINE bool Sort(SortFunction *compare)
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   194
	{
9371
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   195
		/* Do not sort if the resort bit is not set */
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   196
		if (!HASBITS(this->flags, VL_RESORT)) return false;
9371
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   197
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   198
		CLRBITS(this->flags, VL_RESORT);
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   199
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   200
		this->ResetResortTimer();
da6ac5609943 (svn r13275) -Fix: sort lists with 2 items, too
smatz
parents: 9366
diff changeset
   201
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   202
		/* Do not sort when the list is not sortable */
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   203
		if (!this->IsSortable()) return false;
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   204
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   205
		const bool desc = HASBITS(this->flags, VL_DESC);
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   206
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   207
		if (HASBITS(this->flags, VL_FIRST_SORT)) {
9376
afdc4beedc99 (svn r13280) -Fix (r13276): MSVC compilation was broken
smatz
parents: 9375
diff changeset
   208
			qsort(this->data, this->items, sizeof(T), (int (CDECL *)(const void *, const void *))compare);
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   209
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   210
			if (desc) this->Reverse();
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   211
			return true;
9372
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   212
		}
2ee65824ee6d (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138)
smatz
parents: 9371
diff changeset
   213
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   214
		T *a = this->data;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   215
		T *b = a + 1;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   216
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   217
		uint length = this->items;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   218
		uint offset = 0; // Jump variable
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   219
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   220
		while (length > 1) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   221
			const int diff = compare(a, b);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   222
			if ((!desc && diff <= 0) || (desc && diff >= 0)) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   223
				if (offset != 0) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   224
					/* Jump back to the last direction switch point */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   225
					a += offset;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   226
					b += offset;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   227
					offset = 0;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   228
					continue;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   229
				}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   230
				a++;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   231
				b++;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   232
				length--;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   233
			} else {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   234
				Swap(*a, *b);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   235
				if (a != this->data) {
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   236
					offset++;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   237
					a--;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   238
					b--;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   239
				}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   240
			}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   241
		}
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   242
		return true;
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   243
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   244
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   245
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   246
	 * Hand the array of sort function pointers to the sort list
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   247
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   248
	 * @param n_funcs The pointer to the first sort func
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   249
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   250
	void SetSortFuncs(SortFunction* const* n_funcs)
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   251
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   252
		this->func_list = n_funcs;
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   253
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   254
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   255
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   256
	 * Overload of Sort()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   257
	 * Overloaded to reduce external code
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   258
	 *
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   259
	 * @return true if the list sequence has been altered
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   260
	 */
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   261
	bool Sort()
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   262
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   263
		assert(this->func_list != NULL);
9379
2c6c6a0e2233 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered
skidd13
parents: 9376
diff changeset
   264
		return this->Sort(this->func_list[this->sort_type]);
9366
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   265
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   266
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   267
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   268
	 * Check if a rebuild is needed
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   269
	 * @return true if a rebuild is needed
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   270
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   271
	bool NeedRebuild() const
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   272
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   273
		return HASBITS(this->flags, VL_REBUILD);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   274
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   275
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   276
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   277
	 * Force that a rebuild is needed
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   278
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   279
	void ForceRebuild()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   280
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   281
		SETBITS(this->flags, VL_REBUILD);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   282
	}
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   283
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   284
	/**
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   285
	 * Notify the sortlist that the rebuild is done
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   286
	 *
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   287
	 * @note This forces a resort
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   288
	 */
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   289
	void RebuildDone()
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   290
	{
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   291
		CLRBITS(this->flags, VL_REBUILD);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   292
		SETBITS(this->flags, VL_RESORT);
2d029154291f (svn r13267) -Codechange: extend GUIList with a GnomeSort
skidd13
parents: 9365
diff changeset
   293
	}
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   294
};
6643
f81bee57bc09 (svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents: 6638
diff changeset
   295
9274
42b67e65f1c2 (svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium
parents: 9273
diff changeset
   296
#endif /* SORTLIST_TYPE_H */