(svn r23112) -Codechange: Check if vehicle chain lengths stays constant when auto-refitting.

This commit is contained in:
michi_cc
2011-11-04 15:04:29 +00:00
parent 2b64009657
commit 1497efbd5d
6 changed files with 30 additions and 22 deletions

View File

@@ -52,6 +52,7 @@
#include "bridge_map.h"
#include "tunnel_map.h"
#include "depot_map.h"
#include "gamelog.h"
#include "table/strings.h"
@@ -233,6 +234,22 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF
DEBUG(grf, 0, "%s", buffer + 3);
}
/**
* 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.