diff options
author | frosch <frosch@openttd.org> | 2014-02-07 23:48:56 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2014-02-07 23:48:56 +0000 |
commit | 41b7a04a680196dc7d579ca9a88fbe9c8c28f60a (patch) | |
tree | b92a640bf819583d3ac072f8d79e76f48c593040 /src/train.h | |
parent | 50c6b2486b41e1849feb2c24a2c93342d0a170fe (diff) | |
download | openttd-41b7a04a680196dc7d579ca9a88fbe9c8c28f60a.tar.xz |
(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.
Diffstat (limited to 'src/train.h')
-rw-r--r-- | src/train.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/train.h b/src/train.h index 8f4bc2a9b..280d59ebd 100644 --- a/src/train.h +++ b/src/train.h @@ -12,6 +12,8 @@ #ifndef TRAIN_H #define TRAIN_H +#include "core/enum_type.hpp" + #include "newgrf_engine.h" #include "cargotype.h" #include "rail.h" @@ -41,6 +43,20 @@ enum TrainForceProceeding { }; typedef SimpleTinyEnumT<TrainForceProceeding, byte> TrainForceProceedingByte; +/** Flags for Train::ConsistChanged */ +enum ConsistChangeFlags { + CCF_LENGTH = 0x01, ///< Allow vehicles to change length. + CCF_CAPACITY = 0x02, ///< Allow vehicles to change capacity. + + CCF_TRACK = 0, ///< Valid changes while vehicle is driving, and possibly changing tracks. + CCF_LOADUNLOAD = 0, ///< Valid changes while vehicle is loading/unloading. + CCF_AUTOREFIT = CCF_CAPACITY, ///< Valid changes for autorefitting in stations. + CCF_REFIT = CCF_LENGTH | CCF_CAPACITY, ///< Valid changes for refitting in a depot. + CCF_ARRANGE = CCF_LENGTH | CCF_CAPACITY, ///< Valid changes for arranging the consist in a depot. + CCF_SAVELOAD = CCF_LENGTH, ///< Valid changes when loading a savegame. (Everything that is not stored in the save.) +}; +DECLARE_ENUM_AS_BIT_SET(ConsistChangeFlags) + byte FreightWagonMult(CargoID cargo); void CheckTrainsLengths(); @@ -115,7 +131,7 @@ struct Train FINAL : public GroundVehicle<Train, VEH_TRAIN> { int GetCurveSpeedLimit() const; - void ConsistChanged(bool same_length); + void ConsistChanged(ConsistChangeFlags allowed_changes); int UpdateSpeed(); |