Commit Graph

234 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
Loïc Guilloux 243c6bead3
Fix #12415, 9c49a61, df400ef: Aircraft::tile is valid only for front vehicle (#12416) 2024-04-03 23:16:36 +02:00
Jonathan G Rennison 433484cda3
Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389) 2024-03-27 21:20:27 +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
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Tyler Trahan 32b0fb9f6e
Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142) 2024-03-09 09:38:52 -05:00
Tyler Trahan ab315d0dc9
Fix #12118: When adding an unbunching order, properly check for unsafe conditions (#12136) 2024-03-09 08:28:05 -05:00
Peter Nelson 56cf89d189
Change: Use bitmap for free unit ID generation. (#12165)
This improves performance of finding the next free unit number for a vehicle.

Based loosely on pool's used slot bitmap.
2024-02-25 12:36:13 +00:00
Tyler Trahan f6dd5053a3
Feature: Order flag to unbunch vehicles at depot (#11945) 2024-02-03 08:04:24 -05:00
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Tyler Trahan 3902acb13d Codechange: Define a TickCounter variable type for TimerGameTick::counter 2023-11-25 11:50:46 -05:00
Peter Nelson 7d4a91ef9e
Cleanup: Remove some unused functions. (#11429)
These were picked up with cppcheck.
2023-11-03 21:21:00 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +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
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>
2023-08-06 12:57:10 -04: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
Jonathan G Rennison cdb3a6288b Codechange: Remove unused CapacitiesMap typedef from struct Vehicle 2023-06-01 22:48:47 +02: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 c38df2d589 Codechange: Use std::map instead of custom SmallMap. 2023-05-18 12:18:30 +01:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Peter Nelson 7ccdefa1c1 Change: Increase vehicle random data from 8 to 16 bits. 2023-05-04 21:42:28 +01:00
Tyler Trahan 930f0a16d8 Codechange: Define Date/Year/Month/Day within TimerGameCalendar class 2023-04-26 07:14:03 -04:00
Patric Stout 31ad990831
Codechange: move tick-counter into TimerGameTick (#10712) 2023-04-24 16:55:40 +00:00
Rubidium b7a5d8e296 Codechange: add annotation to selectively force inlining in debug build 2023-01-28 20:32:45 +01:00
Rubidium 375a5b8e3f Codechange: refactor FindClosestDepot to not use pointers, but return a struct 2023-01-04 22:30:48 +01: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
Nicolas Chappe f8a7b76675 Fix #9665: [Linkgraph] Fix travel times of non-direct journeys 2022-10-29 18:39:03 +02:00
Andy 1cfdbb4dea
Change: increase vehicle sprite stack from 4 layers to 8 (#9863) 2022-04-26 19:07:44 +02:00
Niels Martin Hansen e68bf58989 Codechange: Use anonymous union for vehicle orders/old orders list 2022-02-15 20:01:10 +01:00
dP 54951e39a1
Fix #8797: Use logical rail length when placing signals (#9652) 2021-11-19 00:07:22 +00:00
nchappe 2cb6351af5
Fix: Update last servicing dates when using the date cheat (#9694) 2021-11-19 00:04:22 +00:00
Patric Stout 4e4720f217 Codechange: remove the special station/vehicle code from SaveLoad
With the new SLEG_STRUCT it is much easier to embed a struct
in a struct, where the sub-struct has limitations on when it is
being used.
This makes both the code easier to read (less magic) and avoids
the SaveLoad needing to know all these things about Stations
and Vehicles.
2021-06-14 21:58:05 +02:00
Patric Stout 9fff00ba20
Codechange: C++-ify lists for SaveLoad (#9323)
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant

As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
2021-05-31 22:26:44 +02:00
Matt Kimber 40d5fe1631
Fix eeb88e8: Trains reversed while paused do not correctly update sprite bounds (#8540) 2021-01-17 19:57:16 +01:00
Matt Kimber 5728f9c7d0 Codechange: consider vehicle co-ordinates when identifying viewport candidate as using only the hash generates false positives 2021-01-05 11:42:25 +01:00
Matt Kimber 9b28b15e67 Codechange: create MutableSpriteCache to remove the need to cast Vehicle to a mutable type in render methods 2021-01-05 11:42:25 +01:00
Matt Kimber eeb88e87d8 Codechange: improve performance for complex vehicle chains by resolving sprites less often 2021-01-05 11:42:25 +01:00
glx22 d8605ad18d Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops 2020-12-27 10:28:46 +00: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 5b34c8019f Codechange: Remove Company/OwnerByte types 2019-04-29 17:40:22 +01:00
Charles Pigott 96097b34a5 Codechange: Remove Direction*Byte types 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
Peter Nelson 81330b8d6e Change: Add path cache for ships. 2019-01-19 23:11:17 +00:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01: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 19d56a33e8 (svn r27822) -Feature: Vehicle Group Info: Add profits and occupancy display to group vehicle list (mtm, JGR) 2017-03-24 07:33:31 +00:00
frosch 117e73751c (svn r27668) -Feature: [NewGRF] Allow composing vehicles from multiple sprites. 2016-10-16 14:59:44 +00:00