Commit Graph

178 Commits

Author SHA1 Message Date
Michael Lutz e08b3abe7f Codechange: Un-bitstuff group and autoreplace commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 211c630cbe Codechange: Un-bitstuff order commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 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 a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 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
Jonathan G Rennison 8a33e98834
Fix #8169: nullptr dereference when autoreplacing vehicle with no orders (#9387) 2021-06-19 23:31:23 +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 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
frosch 5bd8144853
Fix #9256, 12e43c697d2: invalid read after free. (#9258)
This also changes ScriptEventVehicleAutoReplaced when replacing wagons:
The event is now only spawned, if the head engine changes, so only if the VehicleID of the consist changes.
Previously replacing wagons spawned an event with OldVehicleID==NewVehicleID.
2021-05-12 23:40:03 +02:00
peter1138 a05bc04b63 Feature: Per-group wagon removal flag. 2021-04-22 22:57:00 +02:00
Patric Stout fece1c57ca
Codechange: Suppress warnings when asserts are disabled (#8917) 2021-04-01 11:16:19 +02:00
Jonathan G Rennison e059a88533
Fix: Autorenew failure advice due to bad refit being shown to all companies (#8681) 2021-02-18 10:50:33 +01:00
Chris Stevens a6aec252b1
Fix #8153: Report incompatible cargo/order when autoreplace fails (#8169) 2021-01-08 16:05:49 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
glx22 d8605ad18d Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops 2020-12-27 10:28:46 +00:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx 12e43c697d Add: [Script] ScriptEventVehicleAutoReplaced. 2019-10-22 11:55:40 +02:00
JMcKiern 04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 2019-05-01 21:36:27 +02:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
peter1138 d54b6ac09b Feature: When filtering purchase list by cargo type, make buy button perform a refit if required. 2019-03-24 15:28:48 +00:00
Joan Josep 823c5bfa3b Fix #5978: Ensure group GUI stats and lists are invalidated properly (3298, Juanjo) (#7046) 2019-01-13 22:29:17 +00:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 2018-05-21 22:08:39 +01:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +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
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 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
peter1138 13e8656804 (svn r24939) -Fix: Redraw autoreplace window properly in network games. 2013-01-23 20:00:00 +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
frosch 48e0d9901f (svn r24443) -Codechange: Move Vehicle::name to BaseConsist. 2012-07-29 16:45:11 +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
frosch 22632d5e9a (svn r24382) -Fix: Call Vehicle::IsStoppedInDepot only for the first vehicle in a chain (i.e. primary vehicle or free wagon). 2012-07-07 15:35:28 +00:00
frosch a9165d3f32 (svn r24201) -Fix [FS#5170]: Mark group list dirty when setting/clearing autoreplace for an engine type. 2012-05-05 19:26:11 +00:00
michi_cc 6a70abbd99 (svn r24136) -Feature [FS#4465]: Autoreplace vehicles only when they get old. (Vikthor) 2012-04-17 19:44:02 +00:00
frosch 5167f2be29 (svn r23965) -Fix [FS#5070]: Refittability should never depend on the current capacity of a vehicle. 2012-02-19 18:34:24 +00:00
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 2012-01-03 21:32:51 +00:00
rubidium 8d125a60ce (svn r23683) -Fix [FS#4912]-ish: when fitting another engine the cargo capacity of wagons could become lower, causing them to contain more than they should. This caused the cargo transfer from the replaced parts to put even more stuff in the already full wagon. Prevent this from happening by reducing the amount of cargo in the vehicle to the capacity when moving vehicles/wagons around, or when autoreplacing 2011-12-28 19:48:04 +00:00
rubidium 3d88c74389 (svn r23526) -Codechange: unify cargos vs cargoes 2011-12-15 21:56:00 +00:00
frosch 2fe8e89a45 (svn r23487) -Change/Fix: Make autoreplace, autorenew, cloning and autorefit check all articulated parts of a vehicle to find a shared cargo subtype. 2011-12-10 21:09:21 +00:00
michi_cc f200ffa90c (svn r23087) -Feature: Auto-refitting of vehicles during loading at a station when the vehicle allows it. 2011-11-04 00:38:51 +00:00
frosch d071eefc54 (svn r22985) -Feature: Display autoreplace status in group GUI. 2011-10-03 17:26:37 +00:00
frosch b2bc7797bf (svn r22876) -Fix [FS#4712]: Report an error in the news if autoreplace/renew fails due to the engine type being no longer available. 2011-09-02 22:21:07 +00:00
rubidium 4836a6e50e (svn r22845) -Fix [FS#4745]: perform stricter checks on some commands (monoid) 2011-08-26 16:39:02 +00:00
rubidium 95b6aeaabd (svn r22078) -Fix [FS#4499]: maximum train length interfered with wagon replacement when wagon removal was turned on 2011-02-14 19:18:12 +00:00