Commit Graph
239 Commits
Author SHA1 Message Date
Rubidiumandrubidium42 4fb749886a Codefix: typos in variable/constant/function names 2025-08-31 10:30:37 +02:00
Peter NelsonandGitHub 2e78c24ba3 Codefix: Use bitset .None() or .Any() instead of comparing against an empty bitset. (#14327) 2025-06-04 07:31:44 +01:00
Peter NelsonandPeter Nelson b06273f716 Codechange: Use FlatSet when searching tiles around stations. 2025-05-05 14:00:38 +01:00
froschandfrosch b956af631e Codechange: Replace CircularTileSearch with SpiralTileSequence. 2025-04-20 12:50:45 +02:00
Peter NelsonandGitHub b96b26ef15 Codechange: Rename short CargoType parameters cargo. (#13848)
Rename CargoType variables and parameters using short or meaningless names.
2025-03-24 18:18:21 +00:00
Rubidiumandrubidium42 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Peter NelsonandPeter Nelson 75387b9e2b Codechange: Use EnumBitSet for StationFacility. 2025-02-13 18:03:13 +00:00
Rubidiumandrubidium42 5a78bb8fac Codechange: ToWindowNumber describes better what is the intent than Pack 2025-02-02 15:57:18 +01:00
Rubidiumandrubidium42 e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Peter NelsonandGitHub 5f0e4cd646 Codechange: Make RoadStopType an enum class. (#13340) 2025-01-19 21:43:17 +00:00
Peter NelsonandGitHub 4397aa3909 Codechange: Make StationType an enum class. (#13339) 2025-01-19 20:53:08 +00:00
Peter NelsonandGitHub 810e442203 Codechange: Split GoodsEntry cargo and flows data to unique_ptr. (#13058)
This allows cargo packets and cargo flow data to be empty if not in use, which is the case for the majority of station goods entries, and data is allocated when needed.

This reduces the initial size of a Station from 9192 bytes to 2024 bytes (on 64 bit platforms), although an allocation of 120 bytes is made for each active cargo type at a station.

Based on similar changes in JGRPP.
2025-01-02 20:48:23 +00:00
Peter NelsonandGitHub 1e77fd0b61 Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
2024-12-08 18:02:30 +00:00
Peter NelsonandPeter Nelson 059a4b22f7 Codechange: Use projection-based std::range::find where possible.
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter NelsonandGitHub 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
SamuXarickandGitHub d5a13fb9f4 Codechange: Use TileOffsByAxis(...) in more places (#13026) 2024-10-24 15:58:15 -04:00
Peter NelsonandGitHub 2fda7d8297 Codechange: Simplify Station::train_station iteration when marking tiles dirty. (#13003) 2024-10-17 23:01:04 +01:00
Peter NelsonandPeter Nelson 1ff35cb6f9 Codechange: Don't mark animated tiles dirty if frame is not changed.
If animation is continued but the animation frame has not changed then there is no need to mark the tile for refresh.

Loosely backport from JGRPP.
2024-08-13 20:04:44 +01:00
Jonathan G Rennisonandrubidium42 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidiumandrubidium42 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Peter NelsonandGitHub 2d48829999 Codechange: Scan station catchment tiles when removing station from nearby towns/industries. (#12129)
Avoid iterating all towns and industries when updating station catchment, and scan a limited portion of the map instead.

This provides a modest performance benefit when many towns/industries exist.
2024-03-05 18:33:58 +00:00
Joan JosepandGitHub 1b33b4058e Fix: Redraw orders when a station feature is added/removed. (#12061) 2024-02-11 12:47:49 -05:00
Tyler TrahanandGitHub 735abfe111 Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Tyler Trahan 1f41e773d6 Codechange: Use consistent name for bay road stops
As of #10494, this is how we describe original dead-end road stops.
2023-11-28 14:24:33 -05:00
Peter NelsonandPeter Nelson d4008850e3 Codechange: Ensure function opening { is on new line. 2023-11-09 20:15:38 +00:00
Rubidiumandrubidium42 c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Peter NelsonandPeter Nelson 9602de474d Codechange: Use iterators and/or range-for on cargo related loops. 2023-10-19 17:03:25 +01:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
Peter NelsonandPeterN 09408e8e46 Codechange: Add IsCargoAccepted/Produced() helpers. 2023-05-24 17:34:11 +01:00
Peter NelsonandPeterN 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Patric StoutandGitHub 7aa2b9ab0a Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Jonathan G Rennisonandrubidium42 0e4b716815 Fix: O(N^2) cost of Station::RecomputeCatchmentForAll
Station::RemoveFromAllNearbyLists does not need to be called when
all station nearby lists have been cleared and are being regenerated.
2023-03-01 16:54:57 +01:00
Michael Lutz aab580e0ac Codechange: [Linkgraph] Drop node/edge wrappers from LinkGraph. 2023-02-26 21:41:24 +01:00
Michael Lutz 7352f812e6 Codechange: [Linkgraph] Only store present link graph edges and not all possible edges. 2023-02-26 21:41:24 +01:00
Jonathan G Rennisonandrubidium42 4c1406a4b5 Add: NewGRF road stops 2023-02-26 21:28:30 +01:00
Rubidiumandrubidium42 fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
Peter NelsonandPeterN f5f035a22b Codechange: Make use of Rect Width/Height helpers. 2022-11-12 18:28:39 +00:00
Peter NelsonandMichael Lutz 22803f997b Codechange: Use std::vector for station speclist
This removes manual memory allocation, although we still manage the list
size in roughly the same way.
2022-11-06 16:50:42 +01:00
dPandGitHub 36bee83864 Change: Deliver cargo to the closest industry first (#9536) 2022-02-19 19:08:23 +01:00
glx22andLoïc Guilloux 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
glx22andLoïc Guilloux 38c97e1492 Codechange: Replace TILE_AREA_LOOP with range-based for loops 2021-05-13 00:13:54 +02:00
Charles PigottandGitHub 9b800a96ed Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 2020-05-21 20:02:34 +02:00
dPandCharles Pigott 7bd52970a1 Codechange: Refactor FindStationsAroundTiles to avoid code duplication 2020-05-13 08:43:01 +01:00
glxandNiels Martin Hansen ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 2019-12-21 20:13:03 +01:00
glxandNiels Martin Hansen d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glxandNiels Martin Hansen 00c2a98cf3 Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops 2019-12-21 20:13:03 +01:00
glxandNiels Martin Hansen ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00