Commit Graph

157 Commits

Author SHA1 Message Date
Peter Nelson 3b75d8bbf8 Fix: Use modern comparisons instead of memcmp in cache check.
This uses C++20 default operator<=> to provide comparisons of some objects.

This works properly with caches that containers.
2024-04-18 22:13:55 +01:00
Peter Nelson 322ca6ef54 Codechange: Shuffle members of Vehicle to reduce size.
This reduces space wasted due to member alignment.
2024-03-17 16:22:38 +00:00
Peter Nelson 3fc7b3b9a0 Codechange: Cache train curve speed limit can be stored in 16 bits.
Cache curve speed modifier and max curve speed are both 16 bit values so can be stored in 16 bit types instead of 32 bit types.
2024-03-17 16:22:38 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05: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
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.
2023-06-04 15:57:36 +01:00
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.
2023-02-22 20:09:02 +01:00
Rubidium 375a5b8e3f Codechange: refactor FindClosestDepot to not use pointers, but return a struct 2023-01-04 22:30:48 +01:00
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.
2022-12-23 21:02:14 +00:00
Artin Alavi fd4f148c62
Feature: Hotkey to honk a vehicle's horn (#10110) 2022-11-10 21:36:18 +01:00
Henry Wilson 59dbcdb5ba Feature: Display power-to-weight ratio in ground vehicle details GUI 2022-11-08 21:02:08 +01:00
Henry Wilson b304c06a4a Codechange: Use override specifier for Train and RoadVehicle structs 2022-11-08 21:02:08 +01:00
Henry Wilson 89cf0d5da8 Codechange: Factor cargotype weight conversion magic numbers 2022-11-08 21:02:08 +01:00
Tyler Trahan f4ca94d3f6 Codechange: Revenue is not the same as Income
Income is revenue minus costs. Let's name things correctly (without breaking the script API).
2022-04-25 21:51:51 +02:00
Vít Šefl 2183fd4dab
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346) 2021-08-15 11:17:05 +02:00
glx d8a1be48cd Codechange: Replace vehicle related FOR_ALL with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott 9f3928658b Codechange: Remove Track{dir,}{Bits,}Byte types 2019-04-29 17:40:22 +01:00
Charles Pigott 931d32f414 Codechange: Remove RailTypeByte type 2019-04-29 17:40:22 +01:00
Charles Pigott 0a57db01af Codechange: Remove TrainForceProceedingByte type 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
PeterN a07394a63a
Change: Remove direction parameter from Vehicle::UpdateDeltaXY. (#6792)
The value is either unused or always the same as this->direction.
2018-05-22 18:43:34 +01:00
peter1138 5951d2406e (svn r27811) -Change: Remove unused parameters in FreeTrainTrackReservation
FreeTrainTrackReservation is always called with INVALID_TILE
and INVALID_TRACKDIR as second and third arguments, so remove
them and just use those constants instead. (cirdan)
2017-03-20 17:49:44 +00:00
frosch d2393b4f6c (svn r27666) -Codechange: Pass vehicle sprites around using a struct VehicleSpriteSeq. 2016-10-16 14:57:56 +00:00
frosch 41b7a04a68 (svn r26317) -Fix [FS#5897]: Check whether NewGRF change vehicle capacity when they are not supposed to, and truncate cargo appropiately if they are allowed to. 2014-02-07 23:48:56 +00:00
frosch 5eddbb338b (svn r25185) -Fix [FS#5508]: Remove ambivalent functions CargoList::Empty() and Count(), and replace them with VehicleCargoList::StoredCount(), TotalCount(), StationCargoList::AvailableCount() and TotalCount(). (fonsinchen) 2013-04-13 13:42:08 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
michi_cc 245e32a10e (svn r24839) -Feature [FS#5271]: [NewGRF] Support oversized purchase list sprites. (Based on patch by Eddi) 2012-12-23 01:00:25 +00:00
frosch 08a8c3a773 (svn r24384) -Fix [FS#5188-ish]: Make IsInDepot() functions behave consistent across vehicle types and add IsChainInDepot instead, if that is what shall be checked. 2012-07-07 15:39:46 +00:00
michi_cc 9232a2ef0c (svn r23773) -Change: [NewGRF] Update all cached train properties if a train vehicle enters a new railtype. 2012-01-08 12:47:54 +00:00
truebrain 1c9bec1999 (svn r23640) -Fix: stop using FORCEINLINE (1/3rd of the instances were, the others were still regular inline), but make sure inline is always a 'forced' inline (I am looking at you MSVC) 2011-12-20 17:57:56 +00:00
smatz 33d283fdb1 (svn r23588) -Codechange: use the 'final' keyword so compiler can optimise out some indirect calls 2011-12-18 17:17:18 +00:00
michi_cc 4d2a9e384c (svn r23290) -Fix [FS#2379,FS#3569]: Change the centre of train vehicles to depend on the vehicle length instead of being fixed at 4/8th of the original vehicle length to make sure shortened vehicles don't block tiles they shouldn't block. 2011-11-21 20:51:43 +00:00
rubidium 7757a2ed40 (svn r23091) -Codechange: rename some Get*Z functions to Get*PixelZ functions if they return the Z in pixels (like TilePixelHeight) 2011-11-04 10:18:13 +00:00
frosch bbc3409942 (svn r23080) -Feature: [NewGRF] Use variable 10 to enable vehicle GRFs to draw different sprites on the map and in various GUIs. 2011-11-01 16:51:47 +00:00
alberth b992a93996 (svn r21976) -Doc: Document several crash handling functions. 2011-02-05 16:20:55 +00:00
alberth da0b09557c (svn r21930) -Codechange: Remove unused vehicle GetTypeString() functions. 2011-01-30 21:32:21 +00:00
alberth eea2f90da7 (svn r21925) -Doc: Doxygen additions and markup corrections to vehicle-related functions. 2011-01-29 21:37:11 +00:00
terkhen 50b0e10026 (svn r21923) -Codechange: Unify articulated vehicle iteration functions. 2011-01-29 17:27:32 +00:00
rubidium b11f1bd4ed (svn r21911) -Codechange: move tcache.last_speed to gcache.last_speed and make SetLastSpeed a function of GroundVehicle 2011-01-26 17:31:07 +00:00
smatz 8b9f0d5ade (svn r21883) -Codechange: make UpdateZPosition() faster by not calling GetSlopeZ() when not needed 2011-01-21 17:35:17 +00:00
smatz 6dc24cf643 (svn r21876) -Codechange: typedef SpecializedVehicleBase and GroundVehicleBase to reduce typing 2011-01-21 14:43:38 +00:00
terkhen d426906a01 (svn r21862) -Codechange: Unify subtype handling between road vehicles and trains. 2011-01-19 20:04:09 +00:00
terkhen 613743538d (svn r21859) -Codechange: Move train subtype flags to GroundVehicle. 2011-01-19 18:42:54 +00:00
terkhen cfbbcf1597 (svn r21858) -Codechange: Give more similar names to ArticulatedPart functions. 2011-01-19 18:41:53 +00:00
michi_cc 868d035b45 (svn r21712) -Change: Tune 'realistic' acceleration even more to make more trains reach their top speed. 2011-01-04 18:12:28 +00:00
terkhen 48b7916458 (svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains. 2010-12-14 21:33:53 +00:00
rubidium 49a77e89c4 (svn r21504) -Codechange: move the "lost" bit from the train's flags to vehicle flags 2010-12-13 21:52:39 +00:00