(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.

This commit is contained in:
frosch
2014-02-07 23:48:56 +00:00
parent 50c6b2486b
commit 41b7a04a68
13 changed files with 54 additions and 27 deletions

View File

@@ -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();