Merge branch 'improved_breakdowns-sx' into jgrpp

Conflicts:
	src/saveload/extended_ver_sl.cpp
	src/saveload/extended_ver_sl.h
	src/settings_type.h
This commit is contained in:
Jonathan G Rennison
2015-08-02 23:43:19 +01:00
24 changed files with 790 additions and 104 deletions

View File

@@ -2818,6 +2818,42 @@ bool AfterLoadGame()
}
}
/* Set some breakdown-related variables to the correct values. */
if (SlXvIsFeatureMissing(XLSFI_IMPROVED_BREAKDOWNS)) {
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);
}
}
/* FALL THROUGH */
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++) {