diff options
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. */ |