Commit Graph

103 Commits

Author SHA1 Message Date
Peter Nelson 3ad143c43a
Codechange: Use `x = y` instead of `x{y}` for value-type member initialisation. (#12501)
This is easier to read and less likely to look like an array definition.
2024-04-15 23:07:36 +01:00
Patric Stout df400ef84a
Fix: only count distance traveled in vehicles for cargo payment (#11283)
No longer you can utilize the free (and instant) labour of station
workers, transporting your cargo from one part of the station to
the other. No more!

Based on patch by dP.
2023-09-19 22:16:31 +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
Patric Stout d1a0ca67be
Codechange: simplify splitting of CargoPacket (#11286) 2023-09-13 09:40:01 -04:00
Patric Stout 1243c331b6 Fix: don't compare next_station when trying to merge CargoPackets
For vehicle packets they shouldn't be compared, and for station
packets they are already in a bucket per next_station.
2023-09-11 00:25:47 +02:00
Patric Stout 9f8c1ea552 Codechange: rename next_station to next_hop to avoid confusing with another next_station 2023-09-11 00:25:47 +02:00
Patric Stout a0f6983be4 Codechange: remove parameter from VehicleCargoList::Reassign that is always INVALID_STATION 2023-09-11 00:25:47 +02:00
Patric Stout e6c02ebee6
Fix b0e73277: cargodist information got lost when splitting of cargo (#11280)
During b0e73277 we removed loaded_at_xy, but I kinda forgot that
it was a union with next_station. Now next_station wasn't copied
anymore, or checked in AreMergable.
2023-09-10 15:20:58 +02:00
Patric Stout 30172fc037
Codechange: cleanup CargoPacket in terms of variable/function names (#11278)
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
2023-09-09 23:21:21 +02:00
Patric Stout b0e73277d6
Codechange: remove loaded_at_xy from CargoPacket as it was unused (#11276) 2023-09-09 20:24:46 +01:00
PeterN bd150df914
Codechange: Reorder some high-use structs to reduce their size. (#11201)
This reduces GoodsEntry from 144 to 136 bytes (thereby reducing Station from 9704 bytes to 9192 bytes), and CargoPacket from 40 bytes to 32 bytes.
2023-09-02 20:56:36 +00:00
Patric Stout c9c9cfa4fd
Codechange: simplify the type of loaded_at_xy / next_station (#11182)
It was TileOrStationID, most likely to make sure both types in
the union are identical. But as TileIndex is a StrongTypeDef
that becomes a bit weird. So instead, still make sure they are
of equal size, but define their individual types better.
2023-08-11 12:55:55 +00: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
rubidium42 9f6fec01cd
Codechange: rename cargo aging days to periods, as they are not really days (#11112) 2023-07-12 13:20:02 -04:00
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Jonathan G Rennison 37392935dd
Fix #10707: Incorrect type of days_in_transit in CargoPacket constructor (#10715) 2023-04-24 18:55:16 +00:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
dP e2f1cd44dc
Change: Increase max cargo age and let min cargo payment approach zero. (#10596)
Co-authored-by: Michael Lutz <michi@icosahedron.de>
2023-04-10 12:34:28 +02:00
Patric Stout 0bdca02bdf Codechange: use SLE_STRUCT(LIST) for Station chunks 2021-06-14 21:58:05 +02: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
TechGeekNZ fe1925931d Cleanup: Correct typographic errors in code comments. 2020-06-07 01:04:41 +01:00
TechGeekNZ 937b366546 Cleanup: StationCargoList::AreMergable doxygen comment references Vehicle instead of Station. 2020-06-05 14:27:09 +01:00
glx 5fce5fa300 Codechange: Replace FOR_ALL_CARGOPACKETS 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
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Charles Pigott 2e1936da64 Codechange: Remove SourceTypeByte 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
fonsinchen 7096d42bb3 (svn r26660) -Fix: CargoPacket::SourceStation() returns a StationID. 2014-06-21 19:52:52 +00:00
fonsinchen 88787412b6 (svn r26327) -Fix [FS#5901]: Take care of next_station when reassigning from MTA_DELIVER to MTA_TRANSFER. 2014-02-09 21:10:25 +00:00
fonsinchen bd230f34f4 (svn r25900) -Change [FS#5677]: Allow restricted flows to be picked for kept cargo. 2013-10-22 16:15:59 +00:00
fonsinchen 54db96be43 (svn r25891) -Feature: Use smallstack to allow for multiple next hops when loading and unloading. 2013-10-20 13:47:58 +00:00
fonsinchen 3dd811e179 (svn r25434) -Fix: reroute cargo staged for unloading if a link breaks 2013-06-23 08:28:53 +00:00
fonsinchen 741c431caa (svn r25362) -Feature: consider cargo waiting at other stations for rating at the origin station 2013-06-09 13:04:32 +00:00
fonsinchen 04e3eb6fab (svn r25361) -Feature: distribute cargo according to plan given by linkgraph 2013-06-09 13:03:48 +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
rubidium 4367224b35 (svn r25013) -Feature: show the amount of cargo that has already been reserved by full loading vehicles in the station (fonsinchen) 2013-02-17 14:59:27 +00:00
rubidium cdb0a76958 (svn r25012) -Codechange: persistently keep 'reserved' cargo (for full-load improved loading) instead of calculating if for every cycle 2013-02-17 14:54:50 +00:00
rubidium d6e2a8aa56 (svn r25010) -Codechange: Add general framework for cargo actions, i.e. loading, transfering, delivering and such, to contain this logic in a single place instead of spread around (fonsinchen) 2013-02-17 14:36:40 +00:00
rubidium 71bbc130fc (svn r25009) -Codechange: refactor bits of cargo packet (lists) to reduce duplicated code (fonsinchen) 2013-02-17 14:17:06 +00:00
rubidium 2795ed5b09 (svn r25008) -Codechange: Make CargoList::Truncate behave similarly to CargoList::MoveTo, i.e. pass the amount to truncate (fonsinchen) 2013-02-17 14:10:15 +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
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
frosch 474b4799e8 (svn r22482) -Codechange: Add some contants for the number of ticks between certain cyclical tasks. 2011-05-21 11:26:37 +00:00
smatz 756cc6cf65 (svn r22116) -Codechange: use PoolBase::Clean() at more places 2011-02-19 23:05:47 +00:00
rubidium 68bc93f950 (svn r22111) -Codechange/fix-ish: upon cleaning a pool a destructor should not delete items from other pools 2011-02-19 18:02:17 +00:00
rubidium 2707186f6a (svn r21849) -Codechange: move merging/splitting of cargopackets into a helper function (fonsinchen) 2011-01-19 16:25:00 +00:00
rubidium 07e14525b8 (svn r21848) -Codechange: unification of comment style for cargopacket.* 2011-01-19 16:20:26 +00:00
rubidium 6c9078fd30 (svn r21844) -Codechange: move documentation towards the code to make it more likely to be updates [a-c]. 2011-01-18 22:17:15 +00:00
rubidium 1fa98e1695 (svn r20574) -Codechange: a little over 1 million vehicles should be enough for the forseeable future 2010-08-19 20:58:30 +00:00