Peter Nelson
0841978304
Codechange: Use vector and iterators to store old/new vehicles during autoreplace. ( #11851 )
...
This avoids malloc/free of 3 arrays along index counting, and the data for each part is kept together.
8 months ago
Peter Nelson
400ae65ff2
Codechange: Redefine some cargo-related values in terms of CargoID instead of CargoType.
...
Values used as special filter types are now defined as offsets from NUM_CARGO instead of confusingly reusing CARGO_NO_REFIT/CARGO_AUTO_REFIT types.
9 months ago
Peter Nelson
952d111b94
Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
...
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
9 months ago
Jonathan G Rennison
9822fa6584
Fix: Trivial autoreplace of mixed cargo articulated engines ( #11253 )
...
Do not fail autoreplace/autorenew of mixed cargo articulated engines
due to an inability to refit to mixed cargoes, when no refit is
required because the target engine already has a suitable set of cargoes.
Notably, this allows autorenew (autoreplace to same engine type)
to succeed.
11 months 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
PeterN
2a2443dd01
Feature: Create group of vehicles from manage vehicle list button. ( #10890 )
1 year ago
Peter Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Tyler Trahan
44848f4edf
Add: CommandCost supports an optional second error string
2 years ago
Niels Martin Hansen
2fee8ecdda
Add #7525 : Allow autoreplace with same model vehicle
2 years ago
rubidium42
6ba55e663e
Codechange: do not hide variables with other variables
2 years ago
SamuXarick
b2a5ebcfc4
Fix 3c047b1: AIGroup.GetProfitLastYear could get values different than those displayed in GUI ( #10227 )
...
* Change: Store "all time" and "since minimum age" last year profits on groups
* Fix: Update last year profit for groups when copying vehicle statistics on autoreplace
* Codechange: Refactor profit last year
* Change: Rename some group related items for clarity
* Change: Reorder the fields in GroupStatistics
That way less memory gets wasted.
2 years ago
Jonathan G Rennison
10e76b2788
Fix #10032 : Capacities of articulated vehicles in build window
...
See also: #9954
2 years ago
Patric Stout
77a85e9b4c
Fix: CmdSetAutoReplace didn't validate group type and engine type match ( #9950 )
...
Basically, you could setup an auto-replace in a group for trains
to replace a ship with another ship.
Most of the code is surprisingly okay with this, it is only the
group statistics that doesn't like this.
2 years ago
Patric Stout
9957675a66
Fix: autoreplace command did not validate the vehicle argument properly ( #9946 )
...
It first checked if the vehicle was in the depot, which for some types
is only a valid action for the primary vehicle. Afterwards, it checked
if the vehicle was a primary vehicle.
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
57b82e2e99
Codechange: Don't use globals for story/goal/sign/group command proc return values.
3 years ago
Michael Lutz
e08b3abe7f
Codechange: Un-bitstuff group and autoreplace commands.
3 years ago
Michael Lutz
21675ec7e2
Codechange: Un-bitstuff vehicle/engine commands.
3 years ago
Michael Lutz
211c630cbe
Codechange: Un-bitstuff order commands.
3 years ago
Michael Lutz
4f3ea3907e
Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID).
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
a38bbefe1b
Codechange: Untangle command code, flags and error string for DoCommand*.
3 years ago
Michael Lutz
b6933a2ebd
Codechange: Move command arguments to the back of the DoCommand function call.
3 years ago
Jonathan G Rennison
8a33e98834
Fix #8169 : nullptr dereference when autoreplacing vehicle with no orders ( #9387 )
3 years ago
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.
3 years ago
rubidium42
2e136285e1
Codechange: move from C-string to std::string for DoCommand
3 years ago
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.
3 years ago
peter1138
a05bc04b63
Feature: Per-group wagon removal flag.
3 years ago
Patric Stout
fece1c57ca
Codechange: Suppress warnings when asserts are disabled ( #8917 )
4 years ago
Jonathan G Rennison
e059a88533
Fix: Autorenew failure advice due to bad refit being shown to all companies ( #8681 )
4 years ago
Chris Stevens
a6aec252b1
Fix #8153 : Report incompatible cargo/order when autoreplace fails ( #8169 )
4 years ago
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
4 years ago
glx22
d8605ad18d
Codechange: Replace FOR_VEHICLE_ORDERS with range-based for loops
4 years ago
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
5 years ago
glx
12e43c697d
Add: [Script] ScriptEventVehicleAutoReplaced.
5 years ago
JMcKiern
04f659e768
Fix: Some typos found using codespell
5 years ago
peter1138
c02ef3e456
Feature: Add NotRoadTypes (NRT)
5 years ago
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
6 years ago
peter1138
d54b6ac09b
Feature: When filtering purchase list by cargo type, make buy button perform a refit if required.
6 years ago
Joan Josep
823c5bfa3b
Fix #5978 : Ensure group GUI stats and lists are invalidated properly (3298, Juanjo) ( #7046 )
6 years ago
Charles Pigott
f5b1115039
Doc: Lots and lots of doxymentation fixes
6 years ago
PeterN
4cebebcf68
Change: Add CargoTypes type for cargo masks. ( #6790 )
6 years ago
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
11 years ago
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.
11 years ago
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)
12 years ago
rubidium
cdb0a76958
(svn r25012) -Codechange: persistently keep 'reserved' cargo (for full-load improved loading) instead of calculating if for every cycle
12 years ago
rubidium
2795ed5b09
(svn r25008) -Codechange: Make CargoList::Truncate behave similarly to CargoList::MoveTo, i.e. pass the amount to truncate (fonsinchen)
12 years ago