mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
Merge branch 'improved_breakdowns-sx' into jgrpp
# Conflicts: # src/saveload/extended_ver_sl.cpp
This commit is contained in:
commit
5b7eb46fe4
@ -2937,6 +2937,21 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!SlXvIsFeaturePresent(XSLFI_IMPROVED_BREAKDOWNS, 4)) {
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
switch(v->type) {
|
||||
case VEH_AIRCRAFT:
|
||||
if (v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED && v->breakdown_severity == 0) {
|
||||
v->breakdown_severity = max(1, min(v->vcache.cached_max_speed >> 4, 255));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The road owner of standard road stops was not properly accounted for. */
|
||||
if (IsSavegameVersionBefore(172)) {
|
||||
|
@ -55,7 +55,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_TIMETABLES_START_TICKS, XSCF_NULL, 2, 2, "timetable_start_ticks", NULL, NULL, NULL },
|
||||
{ XSLFI_TOWN_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 1, 1, "town_cargo_adj", NULL, NULL, NULL },
|
||||
{ XSLFI_SIG_TUNNEL_BRIDGE, XSCF_NULL, 2, 2, "signal_tunnel_bridge", NULL, NULL, NULL },
|
||||
{ XSLFI_IMPROVED_BREAKDOWNS, XSCF_NULL, 3, 3, "improved_breakdowns", NULL, NULL, NULL },
|
||||
{ XSLFI_IMPROVED_BREAKDOWNS, XSCF_NULL, 4, 4, "improved_breakdowns", NULL, NULL, NULL },
|
||||
{ XSLFI_TT_WAIT_IN_DEPOT, XSCF_NULL, 1, 1, "tt_wait_in_depot", NULL, NULL, NULL },
|
||||
{ XSLFI_AUTO_TIMETABLE, XSCF_NULL, 4, 4, "auto_timetables", NULL, NULL, NULL },
|
||||
{ XSLFI_VEHICLE_REPAIR_COST, XSCF_NULL, 1, 1, "vehicle_repair_cost", NULL, NULL, NULL },
|
||||
|
@ -1386,8 +1386,8 @@ void DetermineBreakdownType(Vehicle *v, uint32 r) {
|
||||
if (rand <= breakdown_type_chance[BREAKDOWN_AIRCRAFT_SPEED]) {
|
||||
v->breakdown_type = BREAKDOWN_AIRCRAFT_SPEED;
|
||||
/* all speed values here are 1/8th of the real max speed in km/h */
|
||||
byte max_speed = min(AircraftVehInfo( v->engine_type )->max_speed >> 3, 255);
|
||||
byte min_speed = min(15 + (max_speed >> 2), AircraftVehInfo(v->engine_type)->max_speed >> 4);
|
||||
byte max_speed = max(1, min(v->vcache.cached_max_speed >> 3, 255));
|
||||
byte min_speed = max(1, min(15 + (max_speed >> 2), v->vcache.cached_max_speed >> 4));
|
||||
v->breakdown_severity = min_speed + (((v->reliability + GB(r, 16, 16)) * (max_speed - min_speed)) >> 17);
|
||||
} else if (rand <= breakdown_type_chance[BREAKDOWN_AIRCRAFT_DEPOT]) {
|
||||
v->breakdown_type = BREAKDOWN_AIRCRAFT_DEPOT;
|
||||
|
Loading…
Reference in New Issue
Block a user