Peter Nelson
71aaed860b
Codechange: Missing some conversions to WidgetID. ( #11773 )
9 months ago
Jonathan G Rennison
1101b04371
Fix: Build button text when train purchase window using "Engines" filter
9 months ago
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.
9 months ago
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.
9 months ago
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.
9 months ago
Peter Nelson
33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. ( #11637 )
9 months ago
Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
10 months ago
Peter Nelson
1aedea8eda
Feature: Place cargo icon on cargo filter dropdowns.
...
Reveal the pixel art.
10 months ago
Peter Nelson
47eabe0cd9
Fix 7cfcf65: Check if last-remembered build vehicle cargo filter is valid. ( #11486 )
...
This can be invalid when switching between games with different cargoes loaded.
10 months ago
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(...)`.
10 months ago
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.
11 months ago
Peter Nelson
ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. ( #11445 )
...
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
11 months ago
Peter Nelson
18fb8e153f
Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
...
This is to allow unit-tests to produce more useful output.
11 months ago
Peter Nelson
bb6fa9bf3b
Change: Display cargo lists in sorted cargo order. ( #11383 )
12 months ago
merni-ns
c794676928
Fix #10763 , Fix #11168 : Display variant groups that consist only of unavailable sub-groups ( #11342 )
1 year ago
Peter Nelson
5869f790d8
Fix: Check for engine variant loops during NewGRF initialization. ( #11343 )
...
Invalid NewGRFs could set up an engine variant loop that never ends. This
was checked for in some places that evaluated variants, but not all. In
most cases this would result in the engines not appearing, but could
potentially cause an infinite loop and crash.
Instead, during NewGRF initialization detect loops and remove invalid
variants before setting display flags.
1 year ago
PeterN
48dc4219ea
Codechange: Don't pass GUI cargo filter constants to command system. ( #11320 )
...
CMD_BUILD_VEHICLE expects CT_INVALID to indicate a new vehicle should not
be refitted on build, but the code passed CF_NONE instead. CF_NONE has the
same numeric value at CT_INVALID, so the test passed, but...
1 year ago
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
1 year ago
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
1 year ago
Daniel Robinson
71c2878799
Fix #10600 : 'Replace Vehicles' didn't show numbers >999 ( #10680 )
1 year ago
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
1 year ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
1 year ago
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.
1 year ago
Patric Stout
07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype ( #11190 )
...
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
1 year ago
Tyler Trahan
6190f48df0
Codechange: Add a DateToYear function instead of dividing each time ( #11173 )
1 year ago
Tyler Trahan
93069066f9
Codechange: Use auto type when sorting dates ( #11175 )
1 year ago
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
1 year ago
merni-ns
b3669a8795
Fix #11026 : Use real engine name instead of default name for filtering ( #11033 )
1 year ago
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.
1 year ago
Rubidium
f29606fd14
Codechange: use std::string to cache engine/group/vehicle names
1 year ago
Peter Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
1 year ago
PeterN
64930c343a
Codechange: Pass reference instead of pointer to GUI*Lists. ( #10822 )
...
Pointer-avoidance.
1 year ago
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.
1 year ago
Tyler Trahan
61d1b330d1
Change: Add padding to build vehicle text filter ( #10792 )
1 year ago
Peter Nelson
d2034d9c38
Codechange: Scrollbar methods now accept size_t.
...
This clears up a lot of casts from size_t to int.
1 year ago
Rubidium
19ec4e8beb
Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>
1 year ago
Peter Nelson
0880616851
Codechange: Remove various STRING strings.
1 year ago
Peter Nelson
e18f688db5
Codechange: Remove various COMMA strings.
1 year ago
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
1 year ago
Tyler Trahan
aa8830f57a
Feature: Filter engine build menu by name and NewGRF extra text ( #10519 )
1 year ago
Rubidium
c829930440
Codechange: replace strnatcmp with C++ string capable version
1 year ago
Peter Nelson
1a24016964
Fix: Set TC_NO_SHADE only for shaded engine in purchase list.
...
Additionally use TC_FORCE to prevent additional colours in the shaded text.
1 year ago
PeterN
1697dff744
Change: Hide all variants from UI when (display) parent is hidden. ( #10708 )
1 year ago
Patric Stout
1c76e0904d
Codechange: revive STR_TINY_BLACK_COMMA from its coma ( #10714 )
1 year ago
Jonathan G Rennison
a967cc4de2
Fix: Violation of strict weak ordering in engine value/running cost sorter
1 year ago
Andy
15c3bc456f
Change: extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' ( #10666 )
1 year ago
PeterN
f1144de509
Feature: Separate rail/road and sea/air velocity units, and add knots. ( #10594 )
...
This is achieved by packing vehicle type along with the velocity so that
the string system can decode and pick the appropriate unit.
2 years ago
Michael Lutz
05ed9f56fd
Feature: [NewGRF] Engine name callback.
2 years ago
PeterN
4dfd6a096f
Fix #10220 : Don't select unselectable engine as default. ( #10404 )
2 years ago
Rubidium
8aeef665c7
Fix #10377 , Fix 94167df: bad sorting of rail vehicles when primary variant is missing
2 years ago