Peter Nelson
ddd609ce9b
Feature: Randomize direction of rail vehicle on build based on probability callback. ( #11489 )
...
This allows NewGRF authors to indicate that the game should randomly flip rail vehicles on build, without needing to use random bits nor duplicate sprites to handle it themselves.
To use this functionality, test for callback 162 (CBID_VEHICLE_BUILD_PROBABILITY) and var10 = 0 (values other than 0 are reserved for future use), and return a value between 0 and 100 inclusive.
The return value is a percentage chance of reversing the vehicle. A value of 0 will always build a forward facing vehicle, and 100 will always build a reverse facing vehicle.
10 months ago
Peter Nelson
e6d132d24b
Fix #10926 : New free wagons no longer split by type. ( #11507 )
...
NormalizeTrainVehInDepot() should only be called if an engine was built, not for wagons.
10 months ago
Peter Nelson
43aa91a7f5
Fix #11437 : Flipped shorter rail vehicles disappear in windows. ( #11446 )
...
Mixed signed/unsigned strikes again, causing an incorrect sprite offset for shortened vehicles.
11 months ago
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
12 months ago
Jonathan G Rennison
3afb732c37
Fix #11307 : Incorrect GroupStatistics after selling leading wagon
...
When this results in a countable consist
1 year ago
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
1 year ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
1 year ago
Tyler Trahan
fca2b37726
Codechange: Move Ticks into their own class
1 year ago
Tyler Trahan
9a602ff304
Fix #10334 : Store separate newgrf-safe version of date_of_last_service. ( #11124 )
...
This value is not changed when the date cheat is used, which caused issues with changing properties based on service date.
Co-authored-by: Peter Nelson <peter1138@openttd.org>
1 year ago
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
1 year ago
merni-ns
1be668c2e4
Fix #10975 : Clear a non-head engine's name ( #10976 )
1 year ago
PeterN
ee2d0745e9
Fix #10502 : Refit engine before attaching free wagons. ( #10926 )
...
Caused by incorrect order of operations when buying a train engine with refit and attaching free wagons.
1 year ago
Jonathan G Rennison
a2c0e6aa18
Fix #10831 : Level crossing parts left barred after crossing tile removal ( #10874 )
1 year ago
Michael Lutz
7e906c7c59
Change: Preserve orders and related settings where possible when moving engines around in a train.
1 year ago
Michael Lutz
07449be876
Codechange: A vehicle that is not a front engine can't be removed from a vehicle group, so just remove a pointless function call.
1 year ago
Jonathan G Rennison
8d501f2db1
Fix #10741 : Rail platforms left partially reserved after train crash ( #10751 )
1 year ago
Peter Nelson
4a5e413a6c
Cleanup: Remove unnecessary VehicleRandomBits()
...
Simple Random() assignment to byte does the same.
1 year ago
Rubidium
f74e26ca7e
Codechange: replace error/usererror printf variant with fmt variant and rename
1 year ago
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
1 year ago
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.
2 years ago
SamuXarick
b52b29b1a4
Change: Avoid crashing to the side of a train
...
When a road vehicle is already running on a multi level crossing, and a train shows up ahead, don't make the road vehicle crash on the side of the train.
2 years ago
rubidium42
6ba55e663e
Codechange: do not hide variables with other variables
2 years ago
Rubidium
fe2bcd2a58
Codechange: migrate size related functions to Map structure
2 years ago
Rubidium
375a5b8e3f
Codechange: refactor FindClosestDepot to not use pointers, but return a struct
2 years ago
PeterN
7b5edba76c
Change: Support flipping shorter engines without NewGRF support. ( #10262 )
...
* Change: Support flipping shorter engines without NewGRF support.
* Cleanup: Remove write-only prop27_set temporary flag.
2 years ago
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.
2 years ago
Peter Nelson
f5f035a22b
Codechange: Make use of Rect Width/Height helpers.
2 years ago
Artin Alavi
fd4f148c62
Feature: Hotkey to honk a vehicle's horn ( #10110 )
2 years ago
Henry Wilson
59dbcdb5ba
Feature: Display power-to-weight ratio in ground vehicle details GUI
2 years ago
Tyler Trahan
c19abebf8d
Feature: Multi-track level crossings ( #9931 )
2 years ago
Nicolas Chappe
721d98a7d0
Feature: Constantly update destination of 'any depot' orders
2 years ago
Nicolas Chappe
a4052ca348
Codechange: Add VehicleOrderSaver::Restore()
2 years ago
Nicolas Chappe
7e7d943526
Codechange: [YAPF] Allow to retrieve the final tile of the calculated path
2 years ago
Nicolas Chappe
a9a21e784d
Codechange: Always set the ODATFB_NEAREST_DEPOT flag for 'any depot' orders
2 years ago
Bouke Haarsma
bda602f4b0
Fix: reduce framerate overhead on train ticks
...
Tick() is a noop for all but front-engine / crashed vehicles. Starting a framerate is rather cheap, but not free, and introduces a lot of overhead for such close loops.
2 years ago
Patric Stout
979704271b
Fix: reverse train direction command did not validate the given vehicle properly ( #9947 )
...
You could give a wagon in the chain to reverse (which makes no
functional sense ofc). In result, only parts of the vehicle were
reversing, leading to weird crashes.
2 years ago
Niels Martin Hansen
e68bf58989
Codechange: Use anonymous union for vehicle orders/old orders list
3 years ago
Michael Lutz
41fa16f325
Codechange: Don't use globals for return values from vehicle command procs.
3 years ago
Michael Lutz
13528bfcd0
Codechange: Un-bitstuff all remaining commands.
3 years ago
Michael Lutz
21675ec7e2
Codechange: Un-bitstuff vehicle/engine commands.
3 years ago
Michael Lutz
4f3ea3907e
Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID).
3 years ago
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.
3 years ago
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.
3 years ago
Michael Lutz
7048e1522f
Codechange: Move flags in CommandProc in front of the command arguments.
3 years ago
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.
3 years ago
Michael Lutz
549caca39c
Codechange: Move command arguments to the back of the networked command function calls.
3 years ago
Michael Lutz
b6933a2ebd
Codechange: Move command arguments to the back of the DoCommand function call.
3 years ago
Patric Stout
7acdaaaf2f
Fix: Prevent train reversing when wholly inside a train depot ( #9557 )
...
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
3 years ago
Michael Lutz
ee333a9549
Fix 2183fd4d: [NewGRF] Use divide instead of right shift for signed numbers. ( #9480 )
...
"For negative a, the value of a >> b is implementation-defined (in most implementations, this performs arithmetic right shift, so that the result remains negative)."
3 years ago
Vít Šefl
2183fd4dab
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles ( #9346 )
3 years ago