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
|
||||||
@@ -3625,7 +3625,7 @@ STR_VEHICLE_STATUS_LEAVING :{LTBLUE}Leaving
|
|||||||
STR_VEHICLE_STATUS_CRASHED :{RED}Crashed!
|
STR_VEHICLE_STATUS_CRASHED :{RED}Crashed!
|
||||||
STR_VEHICLE_STATUS_BROKEN_DOWN :{RED}Broken down
|
STR_VEHICLE_STATUS_BROKEN_DOWN :{RED}Broken down
|
||||||
STR_VEHICLE_STATUS_STOPPED :{RED}Stopped
|
STR_VEHICLE_STATUS_STOPPED :{RED}Stopped
|
||||||
STR_VEHICLE_STATUS_BROKEN_DOWN_VEL :{RED}Broken down - {STRING1}, {LTBLUE} {VELOCITY}
|
STR_VEHICLE_STATUS_BROKEN_DOWN_VEL :{RED}Broken down - {STRING1}, {LTBLUE} {VELOCITY}
|
||||||
STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL :{RED}Stopping, {VELOCITY}
|
STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL :{RED}Stopping, {VELOCITY}
|
||||||
STR_VEHICLE_STATUS_TRAIN_NO_POWER :{RED}No power
|
STR_VEHICLE_STATUS_TRAIN_NO_POWER :{RED}No power
|
||||||
STR_VEHICLE_STATUS_TRAIN_STUCK :{ORANGE}Waiting for free path
|
STR_VEHICLE_STATUS_TRAIN_STUCK :{ORANGE}Waiting for free path
|
||||||
@@ -3662,9 +3662,9 @@ STR_VEHICLE_DETAILS_AIRCRAFT_RENAME :{BLACK}Name air
|
|||||||
|
|
||||||
STR_VEHICLE_INFO_AGE_RUNNING_COST_YR :{BLACK}Age: {LTBLUE}{STRING2}{BLACK} Running Cost: {LTBLUE}{CURRENCY_LONG}/yr
|
STR_VEHICLE_INFO_AGE_RUNNING_COST_YR :{BLACK}Age: {LTBLUE}{STRING2}{BLACK} Running Cost: {LTBLUE}{CURRENCY_LONG}/yr
|
||||||
|
|
||||||
STR_RUNNING :{LTBLUE}Running
|
STR_RUNNING :{LTBLUE}Running
|
||||||
STR_NEED_REPAIR :{ORANGE}Train needs repair - max speed reduced to {VELOCITY}
|
STR_NEED_REPAIR :{ORANGE}Train needs repair - max speed reduced to {VELOCITY}
|
||||||
STR_CURRENT_STATUS :{BLACK}Current status: {STRING2}
|
STR_CURRENT_STATUS :{BLACK}Current status: {STRING2}
|
||||||
|
|
||||||
# The next two need to stay in this order
|
# The next two need to stay in this order
|
||||||
STR_VEHICLE_INFO_AGE :{COMMA} year{P "" s} ({COMMA})
|
STR_VEHICLE_INFO_AGE :{COMMA} year{P "" s} ({COMMA})
|
||||||
|
@@ -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;
|
||||||
|
@@ -671,8 +671,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||||||
SLE_VAR(Vehicle, breakdown_delay, SLE_UINT8),
|
SLE_VAR(Vehicle, breakdown_delay, SLE_UINT8),
|
||||||
SLE_VAR(Vehicle, breakdowns_since_last_service, SLE_UINT8),
|
SLE_VAR(Vehicle, breakdowns_since_last_service, SLE_UINT8),
|
||||||
SLE_VAR(Vehicle, breakdown_chance, SLE_UINT8),
|
SLE_VAR(Vehicle, breakdown_chance, SLE_UINT8),
|
||||||
SLE_CONDVAR(Vehicle, breakdown_type, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, breakdown_type, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, breakdown_severity, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, breakdown_severity, SLE_UINT8, SL_IB, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 30),
|
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 30),
|
||||||
SLE_CONDVAR(Vehicle, build_year, SLE_INT32, 31, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, build_year, SLE_INT32, 31, SL_MAX_VERSION),
|
||||||
|
|
||||||
|
@@ -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. */
|
||||||
|
@@ -237,9 +237,9 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes)
|
|||||||
if (speed != 0) max_speed = min(speed, max_speed);
|
if (speed != 0) max_speed = min(speed, max_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(u->IsEngine() || u-> IsMultiheaded()) {
|
if (u->IsEngine() || u-> IsMultiheaded()) {
|
||||||
this->tcache.cached_num_engines++;
|
this->tcache.cached_num_engines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 new_cap = e_u->DetermineCapacity(u);
|
uint16 new_cap = e_u->DetermineCapacity(u);
|
||||||
@@ -467,7 +467,7 @@ int Train::GetCurrentMaxSpeed() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
max_speed = min(max_speed, this->current_order.GetMaxSpeed());
|
max_speed = min(max_speed, this->current_order.GetMaxSpeed());
|
||||||
if ( HasBit(this->flags, VRF_BREAKDOWN_SPEED) ) {
|
if (HasBit(this->flags, VRF_BREAKDOWN_SPEED)) {
|
||||||
max_speed = min(max_speed, this->GetBreakdownSpeed());
|
max_speed = min(max_speed, this->GetBreakdownSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2870,7 +2870,7 @@ static bool HandlePossibleBreakdowns(Train *v)
|
|||||||
for (Train *u = v; u != NULL; u = u->Next()) {
|
for (Train *u = v; u != NULL; u = u->Next()) {
|
||||||
if (u->breakdown_ctr != 0 && (u->IsEngine() || u->IsMultiheaded())) {
|
if (u->breakdown_ctr != 0 && (u->IsEngine() || u->IsMultiheaded())) {
|
||||||
if (u->breakdown_ctr <= 2) {
|
if (u->breakdown_ctr <= 2) {
|
||||||
if ( u->HandleBreakdown() ) return true;
|
if (u->HandleBreakdown()) return true;
|
||||||
/* We check the order of v (the first vehicle) instead of u here! */
|
/* We check the order of v (the first vehicle) instead of u here! */
|
||||||
} else if (!v->current_order.IsType(OT_LOADING)) {
|
} else if (!v->current_order.IsType(OT_LOADING)) {
|
||||||
u->breakdown_ctr--;
|
u->breakdown_ctr--;
|
||||||
@@ -3755,7 +3755,7 @@ static bool TrainCheckIfLineEnds(Train *v, bool reverse)
|
|||||||
{
|
{
|
||||||
/* First, handle broken down train */
|
/* First, handle broken down train */
|
||||||
|
|
||||||
if(HasBit(v->flags, VRF_BREAKDOWN_BRAKING)) {
|
if (HasBit(v->flags, VRF_BREAKDOWN_BRAKING)) {
|
||||||
v->vehstatus |= VS_TRAIN_SLOWING;
|
v->vehstatus |= VS_TRAIN_SLOWING;
|
||||||
} else {
|
} else {
|
||||||
v->vehstatus &= ~VS_TRAIN_SLOWING;
|
v->vehstatus &= ~VS_TRAIN_SLOWING;
|
||||||
@@ -3811,7 +3811,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* train is broken down? */
|
/* train is broken down? */
|
||||||
if ( HandlePossibleBreakdowns(v) ) return true;
|
if (HandlePossibleBreakdowns(v)) return true;
|
||||||
|
|
||||||
if (HasBit(v->flags, VRF_REVERSING) && v->cur_speed == 0) {
|
if (HasBit(v->flags, VRF_REVERSING) && v->cur_speed == 0) {
|
||||||
ReverseTrainDirection(v);
|
ReverseTrainDirection(v);
|
||||||
|
@@ -224,24 +224,25 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
|
|||||||
SetDParam(0, v->engine_type);
|
SetDParam(0, v->engine_type);
|
||||||
SetDParam(1, v->value);
|
SetDParam(1, v->value);
|
||||||
|
|
||||||
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:
|
||||||
SetDParam(0, v->engine_type);
|
SetDParam(0, v->engine_type);
|
||||||
SetDParam(1, v->build_year);
|
SetDParam(1, v->build_year);
|
||||||
SetDParam(2, v->value);
|
SetDParam(2, v->value);
|
||||||
|
|
||||||
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:
|
||||||
@@ -251,27 +252,31 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if ( v->breakdown_ctr == 1 ) {
|
if (v->breakdown_ctr == 1) {
|
||||||
if ( _settings_game.vehicle.improved_breakdowns ) {
|
if (_settings_game.vehicle.improved_breakdowns) {
|
||||||
SetDParam( 0, STR_VEHICLE_STATUS_BROKEN_DOWN_VEL );
|
SetDParam(0, STR_VEHICLE_STATUS_BROKEN_DOWN_VEL);
|
||||||
SetDParam( 1, STR_BREAKDOWN_TYPE_CRITICAL + v->breakdown_type );
|
SetDParam(1, STR_BREAKDOWN_TYPE_CRITICAL + v->breakdown_type);
|
||||||
if ( v->breakdown_type == BREAKDOWN_LOW_SPEED ) {
|
if (v->breakdown_type == BREAKDOWN_LOW_SPEED) {
|
||||||
SetDParam( 2, min( v->First( )->GetCurrentMaxSpeed( ), v->breakdown_severity ) );
|
SetDParam(2, min( v->First()->GetCurrentMaxSpeed(), v->breakdown_severity));
|
||||||
} 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;
|
||||||
}
|
}
|
||||||
|
@@ -194,7 +194,7 @@ public:
|
|||||||
Vehicle **hash_tile_current; ///< NOSAVE: Cache of the current hash chain.
|
Vehicle **hash_tile_current; ///< NOSAVE: Cache of the current hash chain.
|
||||||
|
|
||||||
byte breakdown_severity; ///< severity of the breakdown. Note that lower means more severe
|
byte breakdown_severity; ///< severity of the breakdown. Note that lower means more severe
|
||||||
byte breakdown_type; ///< Type of breakdown
|
byte breakdown_type; ///< Type of breakdown
|
||||||
SpriteID colourmap; ///< NOSAVE: cached colour mapping
|
SpriteID colourmap; ///< NOSAVE: cached colour mapping
|
||||||
|
|
||||||
/* Related to age and service time */
|
/* Related to age and service time */
|
||||||
|
@@ -2610,28 +2610,29 @@ public:
|
|||||||
StringID str;
|
StringID str;
|
||||||
if (v->vehstatus & VS_CRASHED) {
|
if (v->vehstatus & VS_CRASHED) {
|
||||||
str = STR_VEHICLE_STATUS_CRASHED;
|
str = STR_VEHICLE_STATUS_CRASHED;
|
||||||
} else if ( v->breakdown_ctr == 1 || ( v->type == VEH_TRAIN && Train::From( v )->flags & VRF_IS_BROKEN ) ) {
|
} else if (v->breakdown_ctr == 1 || (v->type == VEH_TRAIN && Train::From(v)->flags & VRF_IS_BROKEN)) {
|
||||||
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]);
|
||||||
if ( v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED ) {
|
if (v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED) {
|
||||||
SetDParam( 1, v->breakdown_severity << 3 );
|
SetDParam(1, v->breakdown_severity << 3);
|
||||||
} else {
|
} else {
|
||||||
SetDParam( 1, v->current_order.GetDestination( ) );
|
SetDParam(1, v->current_order.GetDestination());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const Vehicle *w = ( v->type == VEH_TRAIN ) ? GetMostSeverelyBrokenEngine( Train::From( v ) ) : v;
|
const Vehicle *w = (v->type == VEH_TRAIN) ? GetMostSeverelyBrokenEngine(Train::From(v)) : v;
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (v->vehstatus & VS_STOPPED) {
|
} else if (v->vehstatus & VS_STOPPED) {
|
||||||
|
@@ -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