Tyler Trahan
735abfe111
Codechange: Split dates and timers into Economy and Calendar time ( #10700 )
2024-01-22 09:04:34 -05:00
Rubidium
aa5ba5bd7f
Codechange: allow certain enumeration to be added
...
Otherwise C++20 doesn't like it.
2024-01-16 23:30:23 +01:00
Peter Nelson
7737aa6640
Codechange: Make all NWidgetPart arrays constexpr.
...
This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
2024-01-16 21:57:05 +00: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
a0dfb76e34
Codechange: Replace mishmash of types for widget index with WidgetID.
...
Indices were stored as int, but often passed around as uint/uint8_t and casts.
Now they should all use WidgetID.
2023-12-30 00:23:57 +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
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
2023-12-05 21:12:35 +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
1aedea8eda
Feature: Place cargo icon on cargo filter dropdowns.
...
Reveal the pixel art.
2023-12-02 15:23:05 +00:00
Peter Nelson
3f853d8003
Codechange: Use range-for to simplify getting first non-zero value.
...
This reduces indexed array access.
2023-11-28 22:30:48 +00:00
Peter Nelson
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. ( #11481 )
...
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +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
Peter Nelson
18fb8e153f
Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
...
This is to allow unit-tests to produce more useful output.
2023-11-02 22:25:01 +00:00
Rubidium
37f84b7372
Codechange: replace x.size() != 0 with !x.empty()
2023-10-20 23:05:43 +02:00
Rubidium
f16399f4c9
Codechange: replace x.size() > 0 with !x.empty()
2023-10-20 23:05:43 +02:00
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +02:00
Peter Nelson
fd6f1e844a
Codechange: Avoid emplace_back(new()) into a unique_ptr. ( #11384 )
...
This could theoretically leave an unmanaged pointer in certain circumstances, and directly using
make_unique shows intent.
2023-10-20 18:40:48 +01:00
Peter Nelson
90351578a6
Codechange: Use std::map instead of fixed array to store refit options.
...
This simplifies handling of available refit options.
2023-10-20 18:39:32 +01:00
Peter Nelson
f379b31e28
Add: data parameter in Window::Close method.
...
This allows passing data when closing a window, e.g. to indicate how it was closed.
2023-10-13 20:47:28 +01:00
PeterN
6d675c8acf
Fix : #11329 : Don't assert vehicle list length is non-zero when only asked to set string parameter. ( #11330 )
...
Since #11321 , the vehicle list is not yet initialized when SetStringParameters is called, so a test that the vehicle list size is zero is triggered. However, doing this check in the SetStringParameters function is a bit out of its remit, so just remove it.
2023-09-21 13:24:53 +01:00
PeterN
a0c6259e33
Codechange: Don't access cargo filter before it is initialized. ( #11321 )
...
The cargo filter list is initialized during window OnInit, but the first
build of the filtered list occurred before this.
2023-09-20 08:58:08 +01:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Rubidium
09a7902d36
Fix 8ab0936: missed WIDGET_LIST_END removals
2023-09-17 19:44:20 +02:00
PeterN
6580ff1adb
Fix #11230 : Widget layout also failed for group-less vehicle list window. ( #11310 )
2023-09-17 10:03:24 +00:00
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
2023-09-16 23:09:53 +02:00
Patric Stout
39ef4b503f
Fix: also apply cargo filters on shared groups in vehicle listing ( #11294 )
2023-09-15 21:22:58 +02:00
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
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
Peter Nelson
e8015e497d
Codechange: Use begin/end of nwidget parts of begin/length.
...
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.
And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Patric Stout
0238a2b567
Codechange: use std::variant instead of using bitflags in the value ( #11191 )
2023-08-12 16:05:00 +00:00
Patric Stout
b7acf9e50e
Codechange: use TimerGameCalendar::Year and friends when working with years ( #11188 )
2023-08-12 16:02:31 +02:00
Tyler Trahan
6190f48df0
Codechange: Add a DateToYear function instead of dividing each time ( #11173 )
2023-08-11 08:19:54 -04:00
Tyler Trahan
93069066f9
Codechange: Use auto type when sorting dates ( #11175 )
2023-08-11 08:18:32 -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
2a2443dd01
Feature: Create group of vehicles from manage vehicle list button. ( #10890 )
2023-06-18 20:48:04 +01:00
PeterN
f814c86389
Codechange: Reorganise hotkey initialisation. ( #10951 )
...
Hotkeys are now initialized inline, and use std::vector instead of
separate static C-arrays and std::string instead of char *. The list end
marker is no longer required.
2023-06-05 18:12:30 +01:00
Peter Nelson
2511649938
Codechange: Use window parent association for dropdowns.
...
This replaces the separate window class and number properties, and
allows the window system to close dropdowns automatically.
2023-06-03 14:17:05 +01:00
Rubidium
f29606fd14
Codechange: use std::string to cache engine/group/vehicle names
2023-05-31 19:31:09 +02:00
Peter Nelson
f177ce7c9a
Codechange: Base CargoArray off std::array.
...
This avoids needing to define array accessors and allows use of
default value initialization.
2023-05-23 19:07:36 +01:00
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
2023-05-20 16:53:10 +02:00
Peter Nelson
941dbadf9e
Codechange: Add and use GetScrolledItemFromWidget to get a list item.
...
This function returns an iterator, either to the selected item or the
container's end.
This makes handling the result more robust as indices are not used.
2023-05-12 21:45:32 +01:00
Peter Nelson
bf9caa425b
Change: Units-system can convert from N to kN, don't preconvert.
...
This allows force to passed as is and avoid premature rounding.
The AI function "GetMaxTractiveEffort" still needs to return kN to avoid breaking the API.
2023-05-09 23:02:51 +02:00
Peter Nelson
d2034d9c38
Codechange: Scrollbar methods now accept size_t.
...
This clears up a lot of casts from size_t to int.
2023-05-07 20:25:44 +01:00
Rubidium
19ec4e8beb
Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>
2023-05-06 21:26:13 +02:00
glx22
045a99dd23
Codechange: Remove STR_TINY_RIGHT_ARROW
2023-05-05 07:07:54 +01:00
glx22
222e37d319
Codechange: Remove TINY_BLACK_STATION
2023-05-05 07:07:54 +01:00
glx22
b2a36ff3cc
Codechange: Remove STR_TINY_GROUP and STR_TINY_BLACK_VEHICLE
2023-05-05 07:07:54 +01:00
Peter Nelson
0880616851
Codechange: Remove various STRING strings.
2023-05-05 07:07:54 +01:00
Peter Nelson
e18f688db5
Codechange: Remove various COMMA strings.
2023-05-05 07:07:54 +01:00