Peter Nelson
2c78146da5
Change: Limit cargo types in station cargo filter, with "More..." option to show all.
2024-02-07 17:13:37 +00:00
Peter Nelson
e517e55620
Change: Include count of stations per cargo type in station cargo filter.
...
Cargo types with no stations are shaded to make the list clearer.
2024-02-07 17:13:37 +00:00
Peter Nelson
46da56b191
Change: Replace long list of cargo filter buttons with a multi-select dropdown list.
...
As before, hold ctrl while clicking on an item to toggle selections.
2024-02-07 17:13:37 +00:00
frosch
68c64d2511
Codechange: Remove TKM string codes by duplicating strings.
2024-01-28 14:44:24 +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
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
7124b4eef1
Codechange: Use std::unique_ptr for all NWidgets.
2023-12-31 15:33:56 +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
b86182ab84
Codechange: Use std::map to provide indexed widget access.
...
This removes the need to determine the biggest widget index and replaces C-style memory handling.
2023-12-29 18:45:43 +00:00
Peter Nelson
58c252b81a
Cleanup: Remove unnecessary pressed button offset code.
2023-12-05 21:12:35 +00:00
Peter Nelson
e749bbefe5
Change: Show rating in station list even with no cargo waiting. ( #11540 )
...
e745bd9
(r21144) changed the filter from cargo waiting to rating, which makes the station list display appear inconsistent with the cargo filter selection.
2023-12-04 18:16:09 +00:00
Peter Nelson
07a8bd21e4
Fix: Make station list filters use per-window state instead of global state.
...
Changing filters with multiple windows open would have unexpected effects leading to inconsistent state.
Now state is loaded and saved when the window is opened and closed, so state is still persistent.
2023-12-04 08:24:39 +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
9122b4eb47
Codechange: SetMinimalTextLines(1, 0) is implied for widgets with text. ( #11536 )
2023-12-03 22:42:50 +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
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
Peter Nelson
9602de474d
Codechange: Use iterators and/or range-for on cargo related loops.
2023-10-19 17:03:25 +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
Peter Nelson
69ee38bd43
Codechange: Use GetAcceptanceMask() instead of duplicating it.
2023-09-21 18:29:02 +01:00
frosch
b5885295f0
Codechange: Use parameters, which should be used.
2023-09-19 22:49:59 +02:00
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
2023-09-19 22:49:59 +02:00
Patric Stout
30172fc037
Codechange: cleanup CargoPacket in terms of variable/function names ( #11278 )
...
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
2023-09-09 23:21:21 +02:00
Jonathan G Rennison
0316940fe8
Fix: Inaccurate waiting cargo total in station window when using cargodist ( #11213 )
...
For stations with many flows and/or small cargo packets,
due to accumulated inaccuracies in DivideApprox.
The displayed total should match GoodsEntry::TotalCount().
2023-09-06 21:36:26 +02: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
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
Jonathan G Rennison
d7bf6b2c07
Feature: Highlight waypoint tiles when adjacent or distant joining
2023-06-04 16:54:48 +01:00
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
2023-05-17 10:14:41 +01:00
Peter Nelson
a92755de81
Codechange: Use iterator erase pattern.
2023-05-13 19:18:01 +01:00
Peter Nelson
4a64064c57
Codechange: Make NEW_STATION an actual item in join station list.
...
Add NEW_STATION to the nearby station list to indicate that a new
station should be built. This removes special-casing for a non-existant
list item and keeps the list count and scrollbar count the same.
2023-05-13 19:18:01 +01: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
e6740046ee
Codechange: Use range-for iteration.
2023-05-11 07:58:55 +01: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
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
4a5a9f57c4
Fix: conversion to smaller type warnings
2023-05-06 21:26:13 +02:00
Peter Nelson
0acc57583b
Fix: Force cargo abbreviation to small font in station list.
2023-04-30 11:47:53 +01:00
Rubidium
c829930440
Codechange: replace strnatcmp with C++ string capable version
2023-04-29 12:07:45 +02:00
PeterN
e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. ( #10663 )
...
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Michael Lutz
aab580e0ac
Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph.
2023-02-26 21:41:24 +01:00
Rubidium
fe2bcd2a58
Codechange: migrate size related functions to Map structure
2023-01-21 17:11:40 +01:00
Peter Nelson
920e588334
Change: Use standard dimensions instead of custom widths.
2022-11-12 18:28:39 +00:00
Peter Nelson
9666e46739
Feature: Variable GUI scale.
...
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2022-11-12 18:28:39 +00:00
Peter Nelson
ed60c88b0a
Change: Use power-of-2 scaling for some dimensions in GUI.
...
These are related to drawing sprites that are normally drawn on the
landscape, and should therefore still follow power-of-2 scaling to fit
correctly.
2022-11-12 18:28:39 +00:00
Peter Nelson
890b2666d3
Change: Use scaled WidgetDimensions.
2022-11-12 18:28:39 +00:00
Peter Nelson
b6ed595176
Codechange: Prefer suggested widget padding.
2022-11-12 18:28:39 +00:00
Peter Nelson
6f95e04005
Change: Use Rect helpers for widget drawing.
...
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Peter Nelson
eb4ba1991b
Change: Use CenterBounds function in more places.
...
CenterBounds may have a 1 pixel difference so the result is not exactly
the same.
2022-11-12 18:28:39 +00:00
Peter Nelson
dc1b84aa1e
Cleanup: Text widgets are capable of drawing text without assistance.
...
Remove custom text drawing of some widgets in favour of standard text
widgets.
2022-10-16 14:24:51 +02:00
Peter Nelson
0e3400894f
Cleanup: Remove redundant WWT_PANEL SetDataTips.
...
WWT_PANEL defaults to 0x0 data and no tooltip, so no need to declare
the same in the widget tree.
2022-10-16 14:24:51 +02:00
Michael Lutz
6fe445e6c0
Codechange: Un-bitstuff station/depot/waypoint commands.
2021-12-16 22:28:32 +01:00
Michael Lutz
0f64ee5ce1
Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
...
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00