Commit Graph

542 Commits

Author SHA1 Message Date
Michael Lutz 46bd2f1ced Codechange: Un-bitstuff remaining transport infrastructure commands. 2021-12-16 22:28:32 +01:00
Michael Lutz e740c24eb7 Codechange: Template DoCommand 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
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
2021-12-16 22:28:32 +01:00
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
Patric Stout 2c05412d72
Fix #9407: desync when founding a town nearby a station (#9526)
"stations_near" wasn't updated when founding a town near
a station. As this variable is not saved, any client joining
after the town is founded has a different value for
"stations_near", potentially causing desyncs.

As the intention of this if() statement was to skip an expensive
calculation when there are clearly no stations, better to move
that check inside the function, so other places also enjoy
the speedup.
2021-08-31 14:31:37 +02:00
rubidium42 9a7750f14e Codechange: use the constructor for CompanyNewsItem to fill the data instead of a separate function 2021-07-01 19:04:38 +02:00
rubidium42 aa9818db90 Codechange: create a type for the "free_data" of NewsItems and (de)allocate it with new and delete 2021-07-01 19:04:38 +02:00
Patric Stout 28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
2021-06-03 17:30:00 +02:00
rubidium42 4613ababd3 Fix #9316, 64eddaeb: at about 250.000 inhabitants the bridge length limit check overflows 2021-05-30 15:09:18 +02:00
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
rubidium42 661728558e Codechange: let IsUnique.* functions accept std::string 2021-05-29 19:02:18 +02:00
rubidium42 b791ffc6de Fix: do not hide parameter by local variable with the same name 2021-05-27 18:30:56 +02:00
Rubidium 296194ad36 Fix: memory leak due to assigning result of strdup to a std::string 2021-05-10 16:03:31 +02:00
William Davis 881e1da51d
Change: Use gender-neutral pronouns in console command messages (and comments) (#9203) 2021-05-08 11:02:30 +01:00
glx22 9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 2021-04-29 21:08:24 +02:00
Charles Pigott dd798d688b
Fix #8919: Release builds with asserts enabled (#8925) 2021-04-01 23:57:49 +01:00
Patric Stout fece1c57ca
Codechange: Suppress warnings when asserts are disabled (#8917) 2021-04-01 11:16:19 +02:00
frosch 4ce941bbc2 Codechange: turn a constant variable into a real constant. 2021-02-14 23:14:07 +01:00
SamuXarick a4035af337
Codechange: Apply coding style (#8640)
* Fix: Missing or needed spaces

* Codechange: Remove space

* Codechange: Remove space

* Codechange: More missing spaces

* Codechange: Missing spaces

* Codechange: Remove space

* Codechange: Remove space
2021-02-05 11:00:36 +01:00
Tyler Trahan 1dda7d6486
Fix: don't walk out of the map when trying to build tunnels (#8600) 2021-01-31 10:04:22 +01:00
SamuXarick 8da5cff210
Fix #8462: Don't check whether to grow a town road on water (#8471) 2021-01-09 12:18:31 +01:00
Patric Stout 8e6574dcdb
Revert 78f92130: "Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535)" (#8541)
As per https://github.com/OpenTTD/OpenTTD/pull/8535#issuecomment-757122918,
jumped the gun here.
2021-01-09 12:14:23 +01:00
Tyler Trahan b0456669c9
Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535) 2021-01-09 10:06:31 +01:00
Tyler Trahan b08c66a796
Fix 7bdfb38: Drive-thru road stations can be connected at either end (#8528) 2021-01-08 18:56:39 +01:00
Tyler Trahan 9c0da686da
Add: Towns can build tunnels (#8473) 2021-01-08 18:32:44 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Patric Stout c7609e767f
Fix #7604: prevent houses to wander too far from town center when rebuilding (#8507)
When a multi-tile house is rebuild, it always used the most northern
tile to build the new house. This can very easily lead to houses
wandering off in the north-ish direction (either NW or NE).

To prevent this, pick the tile closest to town center when rebuilding
on a multi-tile house. This still means a house can be build away
from a road, but it is no longer wandering around finding another
town to call home.
2021-01-07 08:01:23 +01:00
Patric Stout a4e34e824c Change: towns can now bridge 4 rails (up from 3)
Having 4 rails is a pretty common design, and towns now couldn't
bridge out of this common design.
2021-01-06 21:39:34 +01:00
Didac Perez Parera 64eddaeb49 Feature: Make maximum length of town bridges depend on population. 2021-01-06 21:39:34 +01:00
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 2020-12-27 10:55:42 +00:00
Tyler Trahan 7bdfb382a8
Change: Towns don't build dead-end road bridges (#8401) 2020-12-25 00:37:13 +01:00
dP 7045186594 Change #8159: Remove now unused town cargo caches without bumping the savegame version 2020-06-28 18:23:59 +02:00
Yexo a82572d0f5 Codechange: remove has_newhouses global 2020-06-01 22:46:06 +02:00
Michael Lutz 63ccb36ef3 Codechange: Use std::string for most of the user-settable custom names. 2020-05-21 20:02:34 +02:00
dP 93d1d8773f Fix: Desync after house replacement 2020-05-18 09:05:39 +01:00
dP f2a9a1e2a5 Fix #8137: New clients can't join (desync) after funding an industry 2020-05-13 08:43:01 +01:00
dP 7bd52970a1 Codechange: Refactor FindStationsAroundTiles to avoid code duplication 2020-05-13 08:43:01 +01:00
Jonathan G Rennison c3223903ed Codechange: Cache resolved town, station and industry name strings 2020-01-12 19:37:43 +00:00
Jonathan G Rennison 22ba048c89 Change: Only resort town directory window on population change if necessary 2020-01-12 19:37:43 +00:00
glx 39e6247bec Fix #7899, 196d5868: don't trigger filter changes more than expected 2020-01-05 22:51:27 +00:00
Niels Martin Hansen f401622149 Feature: Script API to change town rating of companies 2020-01-04 19:07:13 +01:00
glx ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 2019-12-21 20:13:03 +01:00
glx 514565fad6 Codechange: Replace FOR_ALL_OBJECTS with range-based for loops 2019-12-21 20:13:03 +01:00
glx 00c2a98cf3 Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops 2019-12-21 20:13:03 +01:00
glx fa9769f81a Codechange: Replace FOR_ALL_DEPOTS with range-based for loops 2019-12-21 20:13:03 +01:00
glx ddabfed1cd Codechange: Replace station related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
glx 3a14cea068 Codechange: Replace FOR_ALL_COMPANIES with range-based for loops 2019-12-21 20:13:03 +01:00
Niels Martin Hansen 9900af38f5
Fix #7847: Use ViewportSign coordinates for sign Kdtree coordinates (#7849)
Ensure the same coordinates are used for station/town/player signs regardless of how the landscape changes below it after the coordinates were first determined.

By keeping track of whether each ViewportSign is valid for Kdtree use (and only ever registering the viewport sign when the object is valid) a lot of code can be simplified and become more robust at the same time.
2019-12-01 23:17:33 +01:00