Tyler Trahan
735abfe111
Codechange: Split dates and timers into Economy and Calendar time ( #10700 )
8 months ago
Rubidium
aa5ba5bd7f
Codechange: allow certain enumeration to be added
...
Otherwise C++20 doesn't like it.
9 months ago
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.
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
12bb750128
Codechange: Cargo filters no longer take an index. ( #11582 )
...
Update naming of functions to reflect that parameter is now a cargoid.
10 months ago
Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
10 months ago
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.
10 months ago
Peter Nelson
1aedea8eda
Feature: Place cargo icon on cargo filter dropdowns.
...
Reveal the pixel art.
10 months ago
Peter Nelson
3f853d8003
Codechange: Use range-for to simplify getting first non-zero value.
...
This reduces indexed array access.
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(...)`.
11 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
18fb8e153f
Codechange: Add __FILE__/__LINE__ of WindowDesc to WindowDesc.
...
This is to allow unit-tests to produce more useful output.
11 months ago
Rubidium
37f84b7372
Codechange: replace x.size() != 0 with !x.empty()
12 months ago
Rubidium
f16399f4c9
Codechange: replace x.size() > 0 with !x.empty()
12 months ago
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
12 months ago
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.
12 months ago
Peter Nelson
90351578a6
Codechange: Use std::map instead of fixed array to store refit options.
...
This simplifies handling of available refit options.
12 months ago
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.
12 months ago
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.
1 year ago
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.
1 year ago
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
1 year ago
Rubidium
09a7902d36
Fix 8ab0936: missed WIDGET_LIST_END removals
1 year ago
PeterN
6580ff1adb
Fix #11230 : Widget layout also failed for group-less vehicle list window. ( #11310 )
1 year ago
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
1 year ago
Patric Stout
39ef4b503f
Fix: also apply cargo filters on shared groups in vehicle listing ( #11294 )
1 year ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
1 year ago
Tyler Trahan
fca2b37726
Codechange: Move Ticks into their own class
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
0238a2b567
Codechange: use std::variant instead of using bitflags in the value ( #11191 )
1 year ago
Patric Stout
b7acf9e50e
Codechange: use TimerGameCalendar::Year and friends when working with years ( #11188 )
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
PeterN
2a2443dd01
Feature: Create group of vehicles from manage vehicle list button. ( #10890 )
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
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.
1 year ago
Rubidium
f29606fd14
Codechange: use std::string to cache engine/group/vehicle names
1 year ago
Peter Nelson
f177ce7c9a
Codechange: Base CargoArray off std::array.
...
This avoids needing to define array accessors and allows use of
default value initialization.
1 year ago
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
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
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.
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
glx22
045a99dd23
Codechange: Remove STR_TINY_RIGHT_ARROW
1 year ago
glx22
222e37d319
Codechange: Remove TINY_BLACK_STATION
1 year ago
glx22
b2a36ff3cc
Codechange: Remove STR_TINY_GROUP and STR_TINY_BLACK_VEHICLE
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