Commit Graph

45 Commits

Author SHA1 Message Date
Peter Nelson f44d8fa2e4
Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter Nelson 5bc9854be2
Codechange: Make sort list function lists safer. (#12574)
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.

Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter Nelson dcf730f1f6 Codechange: Optionally allow passing state to GUIList sorter function.
GUIList sorter functions can currently only use global state, which makes per-window-instance sorting difficult.
2023-12-04 08:24:39 +00:00
Tyler Trahan 701a61c9af Codechange: Delete date_type.h 2023-09-10 08:40:25 -04:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
PeterN 8a2d550904
Codechange: Use std::reverse instead of custom implementation. (#10918) 2023-06-03 23:25:01 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
glx22 7222bc5814 Cleanup 2db88953e7: Remove VL_FIRST_SORT as it's useless 2021-01-01 01:04:27 +01:00
Jonathan G Rennison 084b073e57 Codechange: Use template type for GUIList::Sort comparator 2020-06-18 12:38:43 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx ebd4f32d15 Cleanup: remove core/sort_func.hpp as it's not used anymore 2019-04-18 21:49:34 +02:00
glx 2db88953e7 Codechange: use std::sort() in GUIList 2019-04-13 12:49:18 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson ca2f33c6d0 Codechange: Replaced SmallVector::Erase() with std::vector::erase() 2019-03-26 20:15:57 +00:00
Henry Wilson 4b349c0f90 Codechange: [core] Implement SmallVector using std::vector
The public and protected interface to SmallVector are unchanged
SmallVector now requires that items be default constructible
This isn't an issue since some contained items were previously created
uninitialized.

Temporary default constructors are added to the following structs
- SmallPair
- SmallStackItem
- GRFPresence

Where vector<bool> is required, transition immediately to std::vector
to avoid returning proxy object references.
2019-03-26 20:15:57 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 2011-01-22 14:52:20 +00:00
frosch 4bd32799f1 (svn r20286) -Codechange: Unify end of doxygen comments. 2010-08-01 19:44:49 +00:00
smatz 53aaabe6e9 (svn r19507) -Codechange: remove semicolon after DECLARE_POSTFIX_INCREMENT and DECLARE_ENUM_AS_BIT_SET 2010-03-23 22:25:43 +00:00
rubidium 17313b6e3f (svn r17530) -Codechange: use QSortT instead of qsort for sorting EngineIDs 2009-09-13 17:47:07 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
alberth f5d9760824 (svn r16730) -Doc: Added some missing docs (most notably the class/struct docs) to GUIList template. 2009-07-03 19:34:28 +00:00
frosch 0d782b0f96 (svn r16498) -Codechange: Remove hardly used HASBITS. 2009-06-01 15:01:54 +00:00
rubidium 841050ec83 (svn r15377) -Fix [FS#2607]: filter did resort when unneeded and didn't deselect properly in some cases (Roujin) 2009-02-06 18:00:05 +00:00
rubidium 2ab6fffccc (svn r15369) -Codechange: generalise the GUIList a bit so peter can write filters for cargo type, speed and mass ;) 2009-02-06 10:38:57 +00:00
rubidium 6252c74584 (svn r15368) -Fix: some typos in comments 2009-02-06 10:31:05 +00:00
rubidium cfc80a17d8 (svn r15367) -Add: framework for filtering GUILists (Roujin) 2009-02-06 00:51:11 +00:00
rubidium 11da45ee55 (svn r14949) -Cleanup: pointer coding style 2009-01-10 00:31:47 +00:00
skidd13 2f65d35ead (svn r13575) -Codechange: Move small vector to core since it fits better in there
-Codechange: convert smallvector from struct to class
2008-06-19 10:19:02 +00:00
skidd13 f1cecb1795 (svn r13535) -Codechange: Protect GUIList internals
-Fix: VL_FIST_SORT should be set after list rebuild too
2008-06-16 17:10:55 +00:00
skidd13 96fc91baf3 (svn r13516) -Codechange: Move MemCpyT to a fitting core header
-Codechange: Split the sorting code from the sortlist to an appropriate header
2008-06-14 16:23:08 +00:00
rubidium e81386476f (svn r13342) -Fix: smallvec.h/sortlist_type.h didn't include everything they needed. 2008-05-30 09:32:24 +00:00
smatz ee9a9503ce (svn r13296) -Fix (r13276): VL_FIRST_SORT was never reset 2008-05-27 19:58:32 +00:00
skidd13 6d46851b61 (svn r13286) -Codechange: GUIList Sort returns now if the list sequence has been altered 2008-05-27 10:27:30 +00:00
smatz e424367938 (svn r13280) -Fix (r13276): MSVC compilation was broken 2008-05-27 00:13:51 +00:00
smatz a7761332f6 (svn r13279) -Codechange: simplify condition for terminating loop when reversing list order 2008-05-26 21:45:57 +00:00
smatz a0b14f02c8 (svn r13276) -Codechange: use qsort() for initial sorting of a list for better performance (credits go to skidd13 and peter1138) 2008-05-26 21:27:06 +00:00
smatz a509746288 (svn r13275) -Fix: sort lists with 2 items, too
-Fix: reset VL_RESORT and resort timer even when no sort was needed
2008-05-26 21:08:03 +00:00
skidd13 18acb21d65 (svn r13267) -Codechange: extend GUIList with a GnomeSort 2008-05-26 16:44:48 +00:00
peter1138 02b5ffa13f (svn r13266) -Codechange: Use SmallVector in GUIList 2008-05-26 16:23:23 +00:00
rubidium 87015f5b63 (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. 2008-05-17 13:01:30 +00:00