Merge branch 'improved_breakdowns-sx' into jgrpp
Conflicts: src/saveload/extended_ver_sl.cpp src/saveload/vehicle_sl.cpp src/settings_type.h
This commit is contained in:
@@ -192,6 +192,12 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes)
|
||||
u->tcache.user_def_data = GetVehicleProperty(u, PROP_TRAIN_USER_DATA, u->tcache.user_def_data);
|
||||
this->InvalidateNewGRFCache();
|
||||
u->InvalidateNewGRFCache();
|
||||
|
||||
if (!u->IsArticulatedPart()) {
|
||||
if (u->IsEngine() || u->IsMultiheaded()) {
|
||||
this->tcache.cached_num_engines++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Train *u = this; u != NULL; u = u->Next()) {
|
||||
@@ -234,13 +240,13 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes)
|
||||
/* max speed is the minimum of the speed limits of all vehicles in the consist */
|
||||
if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings_game.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) {
|
||||
uint16 speed = GetVehicleProperty(u, PROP_TRAIN_SPEED, rvi_u->max_speed);
|
||||
if (HasBit(u->flags, VRF_NEED_REPAIR)) speed = u->vcache.cached_max_speed;
|
||||
if (HasBit(u->flags, VRF_NEED_REPAIR) && this->IsFrontEngine()) {
|
||||
for (uint i = 0; i < u->critical_breakdown_count; i++) {
|
||||
speed = min(speed - (speed / (this->tcache.cached_num_engines + 2)) + 1, speed);
|
||||
}
|
||||
}
|
||||
if (speed != 0) max_speed = min(speed, max_speed);
|
||||
}
|
||||
|
||||
if (u->IsEngine() || u-> IsMultiheaded()) {
|
||||
this->tcache.cached_num_engines++;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 new_cap = e_u->DetermineCapacity(u);
|
||||
|
Reference in New Issue
Block a user