diff options
author | michi_cc <michi_cc@openttd.org> | 2011-11-04 15:04:29 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-11-04 15:04:29 +0000 |
commit | a3e6e113fe1f5a00d2d62ddac207a3bc12dec97c (patch) | |
tree | 20f5ed8eebb1b2d7108ad823c611db923832449a /src/vehicle.cpp | |
parent | ad2fdd8d6fefe8cde63aa4147ae5cd77ebae49d5 (diff) | |
download | openttd-a3e6e113fe1f5a00d2d62ddac207a3bc12dec97c.tar.xz |
(svn r23112) -Codechange: Check if vehicle chain lengths stays constant when auto-refitting.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index e15638f69..d990d3d55 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -52,6 +52,7 @@ #include "bridge_map.h" #include "tunnel_map.h" #include "depot_map.h" +#include "gamelog.h" #include "table/strings.h" @@ -234,6 +235,22 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF } /** + * Logs a bug in GRF and shows a warning message if this + * is for the first time this happened. + * @param u first vehicle of chain + */ +void VehicleLengthChanged(const Vehicle *u) +{ + /* show a warning once for each engine in whole game and once for each GRF after each game load */ + const Engine *engine = u->GetEngine(); + uint32 grfid = engine->grf_prop.grffile->grfid; + GRFConfig *grfconfig = GetGRFConfig(grfid); + if (GamelogGRFBugReverse(grfid, engine->grf_prop.local_id) || !HasBit(grfconfig->grf_bugs, GBUG_VEH_LENGTH)) { + ShowNewGrfVehicleError(u->engine_type, STR_NEWGRF_BROKEN, STR_NEWGRF_BROKEN_VEHICLE_LENGTH, GBUG_VEH_LENGTH, true); + } +} + +/** * Vehicle constructor. * @param type Type of the new vehicle. */ |