Peter Nelson
8275bbfb87
Codechange: Pass Viewport by reference.
...
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
frosch
25005cff16
Codefix: std::string_view::data() is not necessarily null terminated. ( #13891 )
2025-03-25 20:32:19 +01:00
Peter Nelson
79ef4e98fe
Codechange: Use std::swap() instead of Swap() ( #13883 )
2025-03-24 23:47:34 +00:00
Rubidium
ec647975ad
Cleanup: remove ancient FIXME comments
2025-03-16 05:42:29 +01:00
Rubidium
c13226cdf8
Codefix: do not leave pointers to stack allocations in globals
2025-03-15 21:46:43 +01:00
Rubidium
ac2087a3eb
Codefix: remove some logically dead code
2025-03-14 16:26:21 +01:00
Peter Nelson
274b7a0195
Fix #13645 : "Follow vehicle" button not raised when following stopped. ( #13746 )
2025-03-06 00:00:57 +00:00
Jonathan G Rennison
8566030c53
Cleanup: Adjustments to comments to match code changes ( #13636 )
2025-02-22 13:28:35 +00:00
Rubidium
fd4adc55e3
Codechange: replace INVALID_X with XID::Invalid() for PoolIDs
2025-02-16 20:23:00 +01:00
Peter Nelson
20e57a02a2
Codechange: Use GetString() with argument parameters in simple cases. ( #13551 )
...
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Rubidium
c3d5e6d2a0
Codechange: Use EnumBitSet for DoCommandFlags
2025-02-14 00:28:57 +01:00
Peter Nelson
75387b9e2b
Codechange: Use EnumBitSet for StationFacility.
2025-02-13 18:03:13 +00:00
Jonathan G Rennison
d06b371254
Cleanup: Fix various spelling errors
2025-02-12 22:44:51 +01:00
Peter Nelson
2cb9f55183
Codechange: Store EncodedString for tooltip text.
...
This replaces capturing and storing string parameters.
2025-02-10 22:49:14 +00:00
Rubidium
ec492cb267
Codechange: make CompanyMask a BaseBitSet implementation
2025-02-09 19:24:51 +01:00
Rubidium
42d6a12874
Codechange: replace union with std::variant for ViewportSignKdtreeItem::id
2025-02-09 18:05:01 +01:00
Peter Nelson
8c48f9fc49
Codechange: Pass preformatted string when updating sign positions. ( #13480 )
...
This forces the strings to be formatted in advance and avoids using global string parameters.
2025-02-07 13:19:00 +00:00
Peter Nelson
56b1e9df1f
Codechange: Use EnumBitSet for FrameFlags.
2025-01-30 08:40:42 +00:00
Peter Nelson
4b573b2703
Codechange: Use EnumBitSet for ViewportStringFlags.
2025-01-29 21:46:39 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Peter Nelson
b70438b76a
Fix #13392 : Signs of removed stations are no longer visible. ( #13395 )
...
Add "Ghost" option for station sign visibility.
2025-01-28 19:10:32 +00:00
Peter Nelson
4c8f1b0f81
Add: Ability to toggle visibility of station signs by facility. ( #13207 )
2025-01-14 21:23:35 +00:00
Peter Nelson
810dc23215
Codechange: Replace viewport StringID specialisation with flags. ( #13237 )
...
When drawing viewport strings, the StringID is used to determine how to draw the sign. Instead, allow the behaviour to be set by the caller with flags. This means that some of the viewport-specific strings are no longer necessary.
ViewportAddString() now returns a pointer to a string as it may not actually add the string, in which case preparing the string parameters in advance is a waste of time.
2025-01-02 20:47:12 +00:00
Peter Nelson
fc8685d618
Codechange: Use functor for Kdtree's XYFunc. ( #13074 )
...
Kdtree uses a function pointer and incorrectly calls it a functor. The function pointer needs to be passed on instantiaton.
Instead, use an actual functor. This simplifies instantiation.
2024-11-19 20:29:56 +00:00
Peter Nelson
1191efa581
Fix #12914 : Fix use of invalidated pointer in viewport drawer. ( #12918 )
...
Use index of last child instead of pointer to update next_child element.
In case there is no child sprite yet, the most recent parent sprite's first_child is updated instead.
2024-10-26 15:24:41 +01:00
Rubidium
826deaee57
Codechange: refactor CalcHeightdiff to remove some magic numbers
2024-04-28 16:05:21 +02:00
Peter Nelson
40fa45a76a
Codechange: Emplace std::pair into vectors.
...
This creates the pair in the vector, instead of creating it then copying it in.
2024-04-20 10:25:20 +01:00
Rubidium
4f2412a272
Codechange: range based for loops instead of C-style for loops
2024-04-11 07:05:04 +02:00
Peter Nelson
b905209421
Fix: Viewport signs assume small font is smaller than normal font. ( #12422 )
...
If the small font is set to a larger size than the normal font for some reason, viewport signs would be drawn incorrect as the area marked dirty only considered the normal size font.
2024-04-06 19:29:41 +01:00
Peter Nelson
7572cfd103
Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
...
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson
9854553e10
Codechange: ZOOM_LVL_SHIFT/BASE are not actually ZOOM_LVLs.
...
Rename to ZOOM_BASE_SHIFT and ZOOM_BASE respectively, and derive from ZOOM_LVL instead of numeric value.
2024-04-04 22:27:03 +01:00
Peter Nelson
3c94e81665
Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
...
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Rubidium
27eadc13ec
Codechange: rename TILE_ADD(XY) to TileAdd(XY)
2024-03-10 15:50:24 +01:00
Michael Lutz
8dda387f82
Codechange: Use std::tuple for slope functions with two return values
2024-03-08 18:08:55 +01:00
Peter Nelson
912d7bd80e
Codechange: Give ColourShade values names instead of numbers.
2024-02-25 12:38:07 +00:00
Peter Nelson
ae3390fe48
Codechange: Add ColourShade enum.
2024-02-25 12:38:07 +00:00
Peter Nelson
0463d4c198
Codechange: Remove direct access to _colour_gradient.
...
Access is now through GetColourGradient, which ensures parameters are in range.
2024-02-25 12:38:07 +00:00
frosch
b1718478c8
Codechange: Replace old non-standard attributes with C++17/20 standard attributes.
2024-02-02 22:29:28 +01:00
Patric Stout
05b253b33b
Fix ea8c1d85: improve smoothness of smooth-scrolling for 60+Hz screens ( #11884 )
2024-01-28 09:56:21 +00:00
Patric Stout
ea8c1d8597
Change: make for smooth-scrolling based on actual time
...
This means if rendering takes a bit longer, scrolling goes a bit
quicker, making travel time always about the same time for the
same distance.
2024-01-25 10:29:48 +01:00
Patric Stout
1985e7415b
Fix: smooth-scrolling large distances didn't got smoothly in one direction ( #11861 )
2024-01-21 20:52:44 +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
6c5aeae01b
Fix #11577 : Extra viewport opened in wrong location. ( #11578 )
...
ExtraViewportWindow calls IninitializeViewport() with focus as 0, which is ambiguous as focus should be either a TileIndex or a VehicleID.
Instead, pass the tile and let InitializeViewport() handle setting all the coordinates.
2023-12-13 02:19:16 +00:00
rubidium42
cb8612ba79
Remove: ZOOM_LVL_COUNT
...
This is the only enumeration with a COUNT and END. The logic of the COUNT
implied that BEGIN could be non-zero, but all but two uses of zoom level
assume that BEGIN is zero, making the separate count only confusing.
2023-11-29 21:12:28 -04: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
Rubidium
c6411168d8
Cleanup: missing spaces before continuation * in some comments
2023-11-01 22:56:11 +01:00
Rubidium
37f84b7372
Codechange: replace x.size() != 0 with !x.empty()
2023-10-20 23:05:43 +02:00
Patric Stout
0238a2b567
Codechange: use std::variant instead of using bitflags in the value ( #11191 )
2023-08-12 16:05:00 +00: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