Improved breakdowns patch: fix various issues
* Whitespace/formatting * Fix setting lang string * Fix spelling of VRF_TO_HEAVY
This commit is contained in:
@@ -1216,8 +1216,8 @@ static void HandleAircraftSmoke(Aircraft *v, bool mode)
|
|||||||
if (!(v->vehstatus & VS_AIRCRAFT_BROKEN)) return;
|
if (!(v->vehstatus & VS_AIRCRAFT_BROKEN)) return;
|
||||||
|
|
||||||
/* breakdown-related speed limits are lifted when we are on the ground */
|
/* breakdown-related speed limits are lifted when we are on the ground */
|
||||||
if(v->state != FLYING && v->state != LANDING && v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED) {
|
|
||||||
/* Stop smoking when landed */
|
/* Stop smoking when landed */
|
||||||
|
if (v->state != FLYING && v->state != LANDING && v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED) {
|
||||||
v->vehstatus &= ~VS_AIRCRAFT_BROKEN;
|
v->vehstatus &= ~VS_AIRCRAFT_BROKEN;
|
||||||
v->breakdown_ctr = 0;
|
v->breakdown_ctr = 0;
|
||||||
return;
|
return;
|
||||||
|
@@ -251,7 +251,7 @@ int GroundVehicle<T, Type>::GetAcceleration()
|
|||||||
!(this->current_order.IsType(OT_LOADING)) &&
|
!(this->current_order.IsType(OT_LOADING)) &&
|
||||||
!(Train::From(this)->flags & (VRF_IS_BROKEN | (1 << VRF_TRAIN_STUCK))) &&
|
!(Train::From(this)->flags & (VRF_IS_BROKEN | (1 << VRF_TRAIN_STUCK))) &&
|
||||||
this->cur_speed < 3 && accel < 5) {
|
this->cur_speed < 3 && accel < 5) {
|
||||||
SetBit(Train::From(this)->flags, VRF_TO_HEAVY);
|
SetBit(Train::From(this)->flags, VRF_TOO_HEAVY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1223,7 +1223,7 @@ STR_CONFIG_SETTING_STOP_LOCATION :New train order
|
|||||||
STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :Place where a train will stop at the platform by default. The 'near end' means close to the entry point, 'middle' means in the middle of the platform, and 'far end' means far away from the entry point. Note, that this setting only defines a default value for new orders. Individual orders can be set explicitly to either behaviour nevertheless
|
STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :Place where a train will stop at the platform by default. The 'near end' means close to the entry point, 'middle' means in the middle of the platform, and 'far end' means far away from the entry point. Note, that this setting only defines a default value for new orders. Individual orders can be set explicitly to either behaviour nevertheless
|
||||||
STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END :near end
|
STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END :near end
|
||||||
STR_CONFIG_SETTING_STOP_LOCATION_MIDDLE :middle
|
STR_CONFIG_SETTING_STOP_LOCATION_MIDDLE :middle
|
||||||
STR_CONFIG_SETTING_IMPROVED_BREAKDOWNS :{LTBLUE}Enable improved breakdowns: {ORANGE}{STRING}
|
STR_CONFIG_SETTING_IMPROVED_BREAKDOWNS :Enable improved breakdowns: {STRING2}
|
||||||
STR_CONFIG_SETTING_STOP_LOCATION_FAR_END :far end
|
STR_CONFIG_SETTING_STOP_LOCATION_FAR_END :far end
|
||||||
STR_CONFIG_SETTING_AUTOSCROLL :Pan window when mouse is at the edge: {STRING2}
|
STR_CONFIG_SETTING_AUTOSCROLL :Pan window when mouse is at the edge: {STRING2}
|
||||||
STR_CONFIG_SETTING_AUTOSCROLL_HELPTEXT :When enabled, viewports will start to scroll when the mouse is near the edge of the window
|
STR_CONFIG_SETTING_AUTOSCROLL_HELPTEXT :When enabled, viewports will start to scroll when the mouse is near the edge of the window
|
||||||
|
@@ -163,8 +163,11 @@ protected: // These functions should not be called outside acceleration code.
|
|||||||
if (!this->IsArticulatedPart()) {
|
if (!this->IsArticulatedPart()) {
|
||||||
/* Road vehicle weight is in units of 1/4 t. */
|
/* Road vehicle weight is in units of 1/4 t. */
|
||||||
weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
|
weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
|
||||||
//DIRTY HACK
|
|
||||||
if ( !weight ) weight = 1; //at least 1 for realistic accelerate
|
/*
|
||||||
|
* TODO: DIRTY HACK: at least 1 for realistic accelerate
|
||||||
|
*/
|
||||||
|
if (weight == 0) weight = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return weight;
|
return weight;
|
||||||
|
@@ -37,10 +37,10 @@ enum VehicleRailFlags {
|
|||||||
VRF_BREAKDOWN_POWER = 11,///< used to mark a train in which the power of one (or more) of the engines is reduced because of a breakdown
|
VRF_BREAKDOWN_POWER = 11,///< used to mark a train in which the power of one (or more) of the engines is reduced because of a breakdown
|
||||||
VRF_BREAKDOWN_SPEED = 12,///< used to mark a train that has a reduced maximum speed because of a breakdown
|
VRF_BREAKDOWN_SPEED = 12,///< used to mark a train that has a reduced maximum speed because of a breakdown
|
||||||
VRF_BREAKDOWN_STOPPED = 13,///< used to mark a train that is stopped because of a breakdown
|
VRF_BREAKDOWN_STOPPED = 13,///< used to mark a train that is stopped because of a breakdown
|
||||||
/* Bitmask of all flags that indicate a broken train (braking is not included) */
|
|
||||||
VRF_IS_BROKEN = (1 << VRF_BREAKDOWN_POWER) | (1 << VRF_BREAKDOWN_SPEED) | (1 << VRF_BREAKDOWN_STOPPED),
|
|
||||||
VRF_NEED_REPAIR = 14,///< used to mark a train that has a reduced maximum speed because of a critical breakdown
|
VRF_NEED_REPAIR = 14,///< used to mark a train that has a reduced maximum speed because of a critical breakdown
|
||||||
VRF_TO_HEAVY = 15,
|
VRF_TOO_HEAVY = 15,
|
||||||
|
|
||||||
|
VRF_IS_BROKEN = (1 << VRF_BREAKDOWN_POWER) | (1 << VRF_BREAKDOWN_SPEED) | (1 << VRF_BREAKDOWN_STOPPED), ///< Bitmask of all flags that indicate a broken train (braking is not included)
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Modes for ignoring signals. */
|
/** Modes for ignoring signals. */
|
||||||
|
@@ -227,8 +227,9 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
|
|||||||
if (show_speed && (speed = GetVehicleProperty(v, PROP_TRAIN_SPEED, rvi->max_speed))) {
|
if (show_speed && (speed = GetVehicleProperty(v, PROP_TRAIN_SPEED, rvi->max_speed))) {
|
||||||
SetDParam(2, speed); // StringID++
|
SetDParam(2, speed); // StringID++
|
||||||
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE_AND_SPEED);
|
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE_AND_SPEED);
|
||||||
} else
|
} else {
|
||||||
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE);
|
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (line_number) {
|
switch (line_number) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -239,9 +240,9 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
|
|||||||
if (show_speed && (speed = GetVehicleProperty(v, PROP_TRAIN_SPEED, rvi->max_speed))) {
|
if (show_speed && (speed = GetVehicleProperty(v, PROP_TRAIN_SPEED, rvi->max_speed))) {
|
||||||
SetDParam(3, speed); // StringID++
|
SetDParam(3, speed); // StringID++
|
||||||
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_ENGINE_BUILT_AND_VALUE_AND_SPEED, TC_FROMSTRING, SA_LEFT);
|
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_ENGINE_BUILT_AND_VALUE_AND_SPEED, TC_FROMSTRING, SA_LEFT);
|
||||||
} else
|
} else {
|
||||||
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_ENGINE_BUILT_AND_VALUE);
|
DrawString(left, right, y, STR_VEHICLE_DETAILS_TRAIN_ENGINE_BUILT_AND_VALUE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@@ -260,18 +261,22 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
|
|||||||
} else if (v->breakdown_type == BREAKDOWN_LOW_POWER) {
|
} else if (v->breakdown_type == BREAKDOWN_LOW_POWER) {
|
||||||
SetDParam(2, v->breakdown_severity * 100 / 256 );
|
SetDParam(2, v->breakdown_severity * 100 / 256 );
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
SetDParam( 0, STR_VEHICLE_STATUS_BROKEN_DOWN );
|
SetDParam( 0, STR_VEHICLE_STATUS_BROKEN_DOWN );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (HasBit(v->flags, VRF_NEED_REPAIR)) {
|
if (HasBit(v->flags, VRF_NEED_REPAIR)) {
|
||||||
SetDParam(0, STR_NEED_REPAIR);
|
SetDParam(0, STR_NEED_REPAIR);
|
||||||
SetDParam(1, v->vcache.cached_max_speed);
|
SetDParam(1, v->vcache.cached_max_speed);
|
||||||
} else
|
} else {
|
||||||
SetDParam(0, STR_RUNNING);
|
SetDParam(0, STR_RUNNING);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DrawString(left, right, y, STR_CURRENT_STATUS);
|
DrawString(left, right, y, STR_CURRENT_STATUS);
|
||||||
break;
|
break;
|
||||||
default: NOT_REACHED();
|
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,8 +488,9 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
|
|||||||
if (det_tab != 1 || line_number >= (Train::From(v)->IsWagon() ? 0 : 2)) {
|
if (det_tab != 1 || line_number >= (Train::From(v)->IsWagon() ? 0 : 2)) {
|
||||||
line_number = 0;
|
line_number = 0;
|
||||||
i++;
|
i++;
|
||||||
} else
|
} else {
|
||||||
line_number++;
|
line_number++;
|
||||||
|
}
|
||||||
vscroll_pos--;
|
vscroll_pos--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -917,13 +917,13 @@ void CallVehicleTicks()
|
|||||||
default: break;
|
default: break;
|
||||||
|
|
||||||
case VEH_TRAIN:
|
case VEH_TRAIN:
|
||||||
if (HasBit(Train::From(v)->flags, VRF_TO_HEAVY)) {
|
if (HasBit(Train::From(v)->flags, VRF_TOO_HEAVY)) {
|
||||||
_current_company = v->owner;
|
_current_company = v->owner;
|
||||||
if (IsLocalCompany()) {
|
if (IsLocalCompany()) {
|
||||||
SetDParam(0, v->index);
|
SetDParam(0, v->index);
|
||||||
SetDParam(1, STR_ERROR_TRAIN_TOO_HEAVY);
|
SetDParam(1, STR_ERROR_TRAIN_TOO_HEAVY);
|
||||||
AddVehicleNewsItem(STR_ERROR_TRAIN_TOO_HEAVY, NT_ADVICE, v->index);
|
AddVehicleNewsItem(STR_ERROR_TRAIN_TOO_HEAVY, NT_ADVICE, v->index);
|
||||||
ClrBit(Train::From(v)->flags,VRF_TO_HEAVY);
|
ClrBit(Train::From(v)->flags, VRF_TOO_HEAVY);
|
||||||
}
|
}
|
||||||
_current_company = OWNER_NONE;
|
_current_company = OWNER_NONE;
|
||||||
}
|
}
|
||||||
|
@@ -2614,8 +2614,9 @@ public:
|
|||||||
if (_settings_game.vehicle.improved_breakdowns) {
|
if (_settings_game.vehicle.improved_breakdowns) {
|
||||||
str = STR_VEHICLE_STATUS_BROKEN_DOWN_VEL;
|
str = STR_VEHICLE_STATUS_BROKEN_DOWN_VEL;
|
||||||
SetDParam(2, v->GetDisplaySpeed());
|
SetDParam(2, v->GetDisplaySpeed());
|
||||||
} else
|
} else {
|
||||||
str = STR_VEHICLE_STATUS_BROKEN_DOWN;
|
str = STR_VEHICLE_STATUS_BROKEN_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
if (v->type == VEH_AIRCRAFT) {
|
if (v->type == VEH_AIRCRAFT) {
|
||||||
SetDParam(0, _aircraft_breakdown_strings[v->breakdown_type]);
|
SetDParam(0, _aircraft_breakdown_strings[v->breakdown_type]);
|
||||||
@@ -2629,7 +2630,7 @@ public:
|
|||||||
SetDParam(0, STR_BREAKDOWN_TYPE_CRITICAL + w->breakdown_type);
|
SetDParam(0, STR_BREAKDOWN_TYPE_CRITICAL + w->breakdown_type);
|
||||||
|
|
||||||
if (w->breakdown_type == BREAKDOWN_LOW_SPEED) {
|
if (w->breakdown_type == BREAKDOWN_LOW_SPEED) {
|
||||||
SetDParam( 1, min( w->First()->GetDisplayMaxSpeed( ), w->breakdown_severity >> ( v->type == VEH_TRAIN ? 0 : 1 ) ) );
|
SetDParam(1, min( w->First()->GetDisplayMaxSpeed(), w->breakdown_severity >> ((v->type == VEH_TRAIN) ? 0 : 1)));
|
||||||
} else if (w->breakdown_type == BREAKDOWN_LOW_POWER) {
|
} else if (w->breakdown_type == BREAKDOWN_LOW_POWER) {
|
||||||
SetDParam(1, w->breakdown_severity * 100 / 256);
|
SetDParam(1, w->breakdown_severity * 100 / 256);
|
||||||
}
|
}
|
||||||
|
@@ -77,13 +77,17 @@ static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32; ///< The maximum length of
|
|||||||
/** The length of a vehicle in tile units. */
|
/** The length of a vehicle in tile units. */
|
||||||
static const uint VEHICLE_LENGTH = 8;
|
static const uint VEHICLE_LENGTH = 8;
|
||||||
|
|
||||||
/* The different types of breakdowns */
|
/**
|
||||||
|
* The different types of breakdowns
|
||||||
|
*
|
||||||
|
* Aircraft have totally different breakdowns, so we use aliases to make things clearer
|
||||||
|
*/
|
||||||
enum BreakdownType {
|
enum BreakdownType {
|
||||||
BREAKDOWN_CRITICAL = 0, ///< Old style breakdown (black smoke)
|
BREAKDOWN_CRITICAL = 0, ///< Old style breakdown (black smoke)
|
||||||
BREAKDOWN_EM_STOP = 1, ///< Emergency stop
|
BREAKDOWN_EM_STOP = 1, ///< Emergency stop
|
||||||
BREAKDOWN_LOW_SPEED = 2, ///< Lower max speed
|
BREAKDOWN_LOW_SPEED = 2, ///< Lower max speed
|
||||||
BREAKDOWN_LOW_POWER = 3, ///< Power reduction
|
BREAKDOWN_LOW_POWER = 3, ///< Power reduction
|
||||||
/* Aircraft have totally different breakdowns, so we use aliases to make things clearer */
|
|
||||||
BREAKDOWN_AIRCRAFT_SPEED = BREAKDOWN_CRITICAL, ///< Lower speed until the next airport
|
BREAKDOWN_AIRCRAFT_SPEED = BREAKDOWN_CRITICAL, ///< Lower speed until the next airport
|
||||||
BREAKDOWN_AIRCRAFT_DEPOT = BREAKDOWN_EM_STOP, ///< We have to visit a depot at the next airport
|
BREAKDOWN_AIRCRAFT_DEPOT = BREAKDOWN_EM_STOP, ///< We have to visit a depot at the next airport
|
||||||
BREAKDOWN_AIRCRAFT_EM_LANDING = BREAKDOWN_LOW_SPEED, ///< Emergency landing at the closest airport (with hangar!) we can find
|
BREAKDOWN_AIRCRAFT_EM_LANDING = BREAKDOWN_LOW_SPEED, ///< Emergency landing at the closest airport (with hangar!) we can find
|
||||||
|
Reference in New Issue
Block a user