Import Improved Breakdowns patch

Fix trailing whitespace

http://www.tt-forums.net/viewtopic.php?p=1146419#p1146419
This commit is contained in:
patch-import
2015-08-02 22:58:41 +01:00
committed by Jonathan G Rennison
parent c8a727d3fc
commit 9f5164b403
24 changed files with 761 additions and 84 deletions

View File

@@ -2817,6 +2817,38 @@ bool AfterLoadGame()
}
}
/* Set some breakdown-related variables to the correct values. */
if (IsSavegameVersionBefore(SL_IB)) {
Vehicle *v;
FOR_ALL_VEHICLES(v) {
switch(v->type) {
case VEH_TRAIN: {
if (Train::From(v)->IsFrontEngine()) {
if (v->breakdown_ctr == 1) SetBit(Train::From(v)->flags, VRF_BREAKDOWN_STOPPED);
} else if (Train::From(v)->IsEngine() || Train::From(v)->IsMultiheaded()) {
/** Non-front engines could have a reliability of 0.
* Set it to the reliability of the front engine or the maximum, whichever is lower. */
const Engine *e = Engine::Get(v->engine_type);
v->reliability_spd_dec = e->reliability_spd_dec;
v->reliability = min(v->First()->reliability, e->reliability);
}
}
case VEH_ROAD:
v->breakdown_chance = 128;
break;
case VEH_SHIP:
v->breakdown_chance = 64;
break;
case VEH_AIRCRAFT:
v->breakdown_chance = Clamp(64 + (AircraftVehInfo(v->engine_type)->max_speed >> 3), 0, 255);
v->breakdown_severity = 40;
break;
default: break;
}
}
}
/* The road owner of standard road stops was not properly accounted for. */
if (IsSavegameVersionBefore(172)) {
for (TileIndex t = 0; t < map_size; t++) {