Commit Graph

49 Commits

Author SHA1 Message Date
Rubidium 546a996d95 Codechange: pass options to ShowDropDownMenu using a span 2024-04-28 18:47:31 +02: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
Peter Nelson d683ec0183
Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Tyler Trahan 32b0fb9f6e
Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142) 2024-03-09 09:38:52 -05:00
frosch 69f47caf3f Codechange: Remove TKM from vehicle list sorting dropdowns. 2024-01-28 14:44:24 +01:00
Peter Nelson 400ae65ff2 Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
2024-01-09 18:56:05 +00:00
Peter Nelson 952d111b94 Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00
Peter Nelson 12bb750128
Codechange: Cargo filters no longer take an index. (#11582)
Update naming of functions to reflect that parameter is now a cargoid.
2023-12-14 01:48:45 +00: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
Peter Nelson 7ba89b946e
Change: Hide unused cargos from vehicle cargo filter. (#11533)
The list of used cargo types is updated when the list is invalidated.
2023-12-03 18:11:08 +00:00
Peter Nelson 46098449b6
Fix 7cfcf65: cargo_filter_criteria is now a CargoID instead of a index. (#11497) 2023-11-26 19:30:22 +00:00
Peter Nelson 7cfcf65f95 Codechange: Simplify cargo filter lists, building only when required.
Some cargo filter lists were built in advance, and used as lookups to test which cargo type to filter.

Instead, use the Cargo ID directly as the filter parameter, and build the lists only when the drop down list is used.
2023-11-13 21:30:46 +00:00
PeterN 2a2443dd01
Feature: Create group of vehicles from manage vehicle list button. (#10890) 2023-06-18 20:48:04 +01:00
PeterN d086f288cd
Codechange: Remove duplicated includes. (#10888)
These are now included by stdafx.h so don't need to be included again.
2023-05-29 14:29:00 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
stormcone 0d303d6c3f
Feature: Add cargo filter support to vehicle list. (#8308) 2022-11-08 21:11:16 +01:00
PeterN f158957a4e
Fix: Use width of tiny arrow string instead of scaled pixels in ship/aircraft list. (#9102) 2021-04-25 17:51:03 +01:00
Charles Pigott 6b8f9b50b9 Fix: Vehicle list windows did not update when this year's profit changed
Remove caching from vehicle group object. and recalculate it whenever
required instead.
2021-02-28 11:24:09 +00:00
Bernard Teo e59c400ca6 Feature: Option to group vehicle lists by shared orders
This applies to all kinds of vehicle lists, as well as the "vehicle groups" window.
2020-12-21 23:15:53 +01:00
Bernard Teo 584df548f1 Codechange: Make vehicle lists internally support grouping of vehicles
This is in preparation for the new UI feature that allows grouping by shared orders.
2020-12-21 23:15:53 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Michael Lutz c7b9987d08 Codechange: Switch DropDownList to directly use std::vector, thus making AutoDeleteSmallVector obsolete.
DropDownListItem are strongly managed using std::unique_ptr to ensure leak-free handling. Appropriate use
of move-semantics make intent a lot clearer than parameter comments and allows the compiler to generate
copy-free code for most situations.
2019-04-09 22:45:15 +02:00
frosch 476b2b0e8c (svn r27677) -Codechange: Remove implicit VehicleListIdentifier from uint32 constructor, to make conversions more explicit. 2016-11-05 19:16:59 +00:00
frosch 56e4a8c4d6 (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. 2013-05-26 19:23:42 +00:00
rubidium 7f8b490a21 (svn r20777) -Codechange: make VehicleListIdentifier a variable of BaseVehicleList and use that instead of "dereferencing" the window number and storing some information twice 2010-09-09 14:40:39 +00:00
rubidium 881c6c679f (svn r20771) -Add: concept of vehicle list identifiers to identify a vehicle list instead of a string of parameters 2010-09-08 21:28:50 +00:00
frosch 71ca58c2bb (svn r20453) -Codechange: Remove direct accesses to Window::hscroll, vscroll and vscroll2.
Note: All windows get individual members with the same names, which are initialised via Window::GetScrollbar(). This caching is not required at all, but simplifies conversion.
2010-08-12 08:37:01 +00:00
frosch f06560ad45 (svn r20172) -Codechange: Use BaseVehicleListWindow::BuildActionDropdownList() also for the normal vehicle list. 2010-07-17 14:58:35 +00:00
frosch 240e8df052 (svn r20171) -Fix: Make the group list action dropdown also use vehicletype-specific texts like the normal vehicle list. 2010-07-17 14:53:46 +00:00
frosch ce480fb4b5 (svn r20170) -Codechange: Add BaseVehicleListWindow::GetActionDropdownSize(). 2010-07-17 14:47:54 +00:00
frosch c79d4f46a3 (svn r20169) -Codechange: Replace ShowGroupActionDropdown() with BaseVehicleListWindow::BuildActionDropdownList(). 2010-07-17 14:36:36 +00:00
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 2010-01-15 16:41:15 +00:00
rubidium 1ea8cb4fc4 (svn r18576) -Codechange: use the function to determine the width of digits for determining the width of the unitnumber in vehicle lists. 2009-12-20 16:44:41 +00:00
rubidium 9bfcf2b615 (svn r18136) -Codechange: support RTL in the vehicle lists 2009-11-17 11:36:36 +00:00
rubidium bdb118aa69 (svn r18134) -Codechange: scale the offset of the text/vehicle in the vehicle lists based on the font and the unit numbers in the list 2009-11-17 09:09:20 +00:00
rubidium e438fc6a80 (svn r18130) -Codechange: initial steps into making the vehicle/group lists big font and RTL aware 2009-11-16 21:28:12 +00:00
alberth 4d84dbb26b (svn r18068) -Cleanup: Remove obsolete BaseVehicleListWindow(const WindowDesc *desc, WindowNumber window_number) constructor. 2009-11-14 08:49:58 +00:00
alberth fb0158c8ce (svn r18067) -Codechange: Eliminate a constant representing a widget top edge in vehicle windows. 2009-11-14 08:44:12 +00:00
alberth bd05f2eca6 (svn r17867) -Codechange: Prepare BaseVehicleListWindow for nested widgets. 2009-10-25 14:52:46 +00:00
alberth 413f6b880f (svn r17865) -Codechange: Remove references to specific widgets and step-heights from BaseVehicleListWindow::DrawVehicleListItems(). 2009-10-25 13:33:56 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
frosch 2ad4bf74a1 (svn r17185) -Codechange: Tweak depot gui and vehicle lists, so text overlaps less with vehicle images. 2009-08-15 11:47:11 +00:00
smatz 8585aa71ed (svn r15726) -Codechange: unify coding style for const pointers 2009-03-15 16:04:39 +00:00
rubidium 3b798599b6 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with. 2008-09-30 20:39:50 +00:00
rubidium 1ce4e5721b (svn r14329) -Fix (r14306): selections in the group GUI weren't shown anymore. 2008-09-15 10:02:39 +00:00
rubidium fc62d736f7 (svn r14306) -Codechange: unify the code to draw the vehicle list.
-Fix [FS#2292]: inconsistency between drawn vehicle lists in the vehicle list and group windows.
2008-09-13 10:04:36 +00:00