Commit Graph

863 Commits

Author SHA1 Message Date
Tyler Trahan 2dd2910ab3
Feature: Cheat to fix station ratings at 100% (#11346) 2023-10-21 08:35:52 -04:00
Peter Nelson f06b3e9846
Change: Use CARGO_LIST to show station cargo acceptance changes. (#11379)
This simplifies construction of the news message and allows for more than
two changes to be show in one line.
2023-10-20 20:14:46 +01: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 b5dc9328f2
Change: Store station blocked/wires/pylons flags in map. (#11337)
This stores three flags in unused map bits, and avoids having to look up
station graphics and custom station specs to determine blocked/wires/pylons
status.

This potentially affects rail pathfinding performance.

Savegame version is not bumped, as the flags can just be updated every
time.
2023-09-30 12:30:25 +01:00
Peter Nelson 398c7e5f9d Codechange: Use new function to get a bitmask of empty cargo types. 2023-09-21 18:29:02 +01:00
Peter Nelson 69ee38bd43 Codechange: Use GetAcceptanceMask() instead of duplicating it. 2023-09-21 18:29:02 +01:00
Peter Nelson 122bfa2afd Codechange: Use less locals for station free names bitmask. 2023-09-20 21:57:51 +01:00
Peter Nelson aeaa552385 Codechange: Use std::bitset instead of bool array.
This avoids use of C-style pointers and memset.
2023-09-20 21:57:51 +01:00
Peter Nelson 2eacf36d0a Codechange: List fallback station names by ID instead of magic number.
This improves readability and intention of the station name generator.
2023-09-20 21:57:51 +01:00
frosch baf7cc858b Codechange: Rename ship docking tile related functions. 2023-09-19 22:49:59 +02:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 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 9c49a61249
Fix: base cargo payment on load/unload tile, instead of station sign location (#11281) 2023-09-13 14:41:09 +00:00
PeterN acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 2023-09-11 08:55:12 +00:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Jonathan G Rennison 8df4aa7979
Fix: Road stops should not draw a ground sprite of 0 (#11214) 2023-08-20 15:46:19 -04:00
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.
2023-08-15 18:12:05 +02:00
Patric Stout a9ed590ca7
Codechange: use TimerGameCalendar::Date for variables in linkgraph that are dates (#11187) 2023-08-12 16:02:38 +02: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
Rubidium 3e8f8c55c2 Codechange: make creating temporary StringParameters easier 2023-06-20 17:37:24 +02:00
Rubidium 1d902a97ce Codechange: move StringParameters to strings_internal.h 2023-06-17 12:14:11 +02:00
Rubidium 0a5e58451b Codechange: pass string parameters by reference 2023-06-14 06:14:08 +02:00
Rubidium 36aaa9d683 Codechange: let GetStringWithArgs use StringBuilder 2023-06-04 18:00:23 +02:00
PeterN 584faaf064
Change: Reorganise industry accept/produce arrays. (#10853)
Use a array of struct for each cargo instead of an array for each statistic.
This makes iterating for acceptance and production much simpler.
pct_transported is now calculated when needed.
2023-05-25 21:25:46 +01:00
Peter Nelson f177ce7c9a Codechange: Base CargoArray off std::array.
This avoids needing to define array accessors and allows use of
default value initialization.
2023-05-23 19:07:36 +01:00
Peter Nelson 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Peter Nelson e6740046ee Codechange: Use range-for iteration. 2023-05-11 07:58:55 +01:00
PeterN 882f06bf14
Fix: Support more than 256 stations/waypoints/roadstops per class. (#10793)
It was already possible to define more than 256 per class, but not possible
to use them as the index used in GUI and passed through commands was limited
to a byte.
2023-05-08 18:09:33 +00:00
Rubidium fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Patric Stout 31ad990831
Codechange: move tick-counter into TimerGameTick (#10712) 2023-04-24 16:55:40 +00:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Tyler Trahan bc44158f9a
Change: Allow overbuilding station and waypoint tiles (#10618) 2023-04-16 09:05:04 +02:00
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
Rubidium e8af8daa68 Codechange: pass "ground vehicle" to GetTileSlopeZ since for tunnel/bridges there are two states
Previously it checked the position in non-driving direction to "guess" whether
a ground vehicle was using the function, so on tunnels/bridges it could either
return the Z of the (virtual) ground compared to the Z of the path the vehicle
would take.
2023-04-09 19:00:26 +02:00
Jonathan G Rennison c74dfe393f
Fix #10556: Duplication of road infrastructure count updates (#10557)
When building a road stop
2023-03-08 18:38:19 +00:00
Rubidium 580d0a6343 Codechange: make use of Tile in for all direct map accesses 2023-02-28 07:11:48 +01:00
Chenshu Yu eabb9db0bb
Fix #9810: 'Rebuilding' a through road stop costs money (#9852) 2023-02-27 08:59:42 +00: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 Rennison 4c1406a4b5 Add: NewGRF road stops 2023-02-26 21:28:30 +01:00
Rubidium 8cbf1be9d6 Codechange: split large function into smaller functions with self-explanatory names 2023-02-25 23:57:36 +01:00
Jonathan G Rennison 9c915f05ec Fix: Water infrastructure accounting when building docks 2023-01-29 23:15:53 +01:00
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
Patric Stout 1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" (#10306)
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
Peter Nelson 138198e971 Change: Separate ground sprite from foundation sprite offsets. 2022-12-23 15:43:11 +00:00