Fix #423: Max TE/weight should not be shown for maglevs

This commit is contained in:
Jonathan G Rennison
2022-09-16 12:32:44 +01:00
parent 5825fec5bf
commit fc5e20719d
9 changed files with 39 additions and 23 deletions

View File

@@ -5390,8 +5390,10 @@ STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Weight:
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Weight: {LTBLUE}{WEIGHT_SHORT} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY} {BLACK}Max. T.E.: {LTBLUE}{FORCE} STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Weight: {LTBLUE}{WEIGHT_SHORT} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY} {BLACK}Max. T.E.: {LTBLUE}{FORCE}
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Train length {LTBLUE}{DECIMAL} tile{P "" s} {STRING4} STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Train length {LTBLUE}{DECIMAL} tile{P "" s} {STRING4}
STR_VEHICLE_INFO_WEIGHT_RATIOS :{BLACK}Power / weight: {LTBLUE}{POWER_WEIGHT_RATIO} {BLACK} Max. T.E / weight: {LTBLUE}{FORCE_WEIGHT_RATIO} STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1}
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Full weight: {LTBLUE}{WEIGHT_SHORT} {STRING2} STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}Power / weight: {LTBLUE}{POWER_WEIGHT_RATIO}
STR_VEHICLE_INFO_TE_WEIGHT_RATIO :{BLACK}Max. T.E / weight: {LTBLUE}{FORCE_WEIGHT_RATIO}
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Full weight: {LTBLUE}{WEIGHT_SHORT} {STRING4}
STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Max. speed (full): {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Max. speed (full): {LTBLUE}{VELOCITY}
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Profit this year: {LTBLUE}{CURRENCY_LONG} (last year: {CURRENCY_LONG}) STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Profit this year: {LTBLUE}{CURRENCY_LONG} (last year: {CURRENCY_LONG})

View File

@@ -6579,7 +6579,9 @@ STR_RUNNING :{LTBLUE}Funcion
STR_NEED_REPAIR :{ORANGE}O vehículo precisa reparacións - velocidade máxima reducida a {VELOCITY} STR_NEED_REPAIR :{ORANGE}O vehículo precisa reparacións - velocidade máxima reducida a {VELOCITY}
STR_CURRENT_STATUS :{BLACK}Estado actual: {STRING} STR_CURRENT_STATUS :{BLACK}Estado actual: {STRING}
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Lonxitude do tren {LTBLUE}{DECIMAL} cadro{P "" s} {STRING} STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Lonxitude do tren {LTBLUE}{DECIMAL} cadro{P "" s} {STRING}
STR_VEHICLE_INFO_WEIGHT_RATIOS :{BLACK}Potencia / peso: {LTBLUE}{POWER_WEIGHT_RATIO} {BLACK} Esforzo máximo de tracción / peso: {LTBLUE}{FORCE_WEIGHT_RATIO} STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1}
STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}Potencia / peso: {LTBLUE}{POWER_WEIGHT_RATIO}
STR_VEHICLE_INFO_TE_WEIGHT_RATIO :{BLACK}Esforzo máximo de tracción / peso: {LTBLUE}{FORCE_WEIGHT_RATIO}
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Peso total: {LTBLUE}{WEIGHT_SHORT} {STRING} STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Peso total: {LTBLUE}{WEIGHT_SHORT} {STRING}
STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Velocidade máxima (cheo): {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Velocidade máxima (cheo): {LTBLUE}{VELOCITY}
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR_LIFETIME :{STRING} (vida útil: {CURRENCY_LONG}) STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR_LIFETIME :{STRING} (vida útil: {CURRENCY_LONG})

View File

@@ -5378,7 +5378,9 @@ STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}Gewicht:
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY} {BLACK}Max. Zugkraft: {LTBLUE}{FORCE} STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}Gewicht: {LTBLUE}{WEIGHT_SHORT} {BLACK}Leistung: {LTBLUE}{POWER}{BLACK} Max. Geschw.: {LTBLUE}{VELOCITY} {BLACK}Max. Zugkraft: {LTBLUE}{FORCE}
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Zuglänge: {LTBLUE}{DECIMAL} Kachel{P "" n} {STRING} STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}Zuglänge: {LTBLUE}{DECIMAL} Kachel{P "" n} {STRING}
STR_VEHICLE_INFO_WEIGHT_RATIOS :{BLACK}Leistung / Gewicht: {LTBLUE}{POWER_WEIGHT_RATIO} {BLACK} Max. Zugkraft / Gewicht: {LTBLUE}{FORCE_WEIGHT_RATIO} STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1}
STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}Leistung / Gewicht: {LTBLUE}{POWER_WEIGHT_RATIO}
STR_VEHICLE_INFO_TE_WEIGHT_RATIO :{BLACK}Max. Zugkraft / Gewicht: {LTBLUE}{FORCE_WEIGHT_RATIO}
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Volles Gewicht: {LTBLUE}{WEIGHT_SHORT} {STRING} STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}Volles Gewicht: {LTBLUE}{WEIGHT_SHORT} {STRING}
STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Maximalgeschwindigkeit (beladen): {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}Maximalgeschwindigkeit (beladen): {LTBLUE}{VELOCITY}

View File

@@ -5385,7 +5385,9 @@ STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED :{BLACK}무게:
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}무게: {LTBLUE}{WEIGHT_SHORT} {BLACK}힘: {LTBLUE}{POWER}{BLACK} 최고 속력: {LTBLUE}{VELOCITY} {BLACK}최고 견인력: {LTBLUE}{FORCE} STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :{BLACK}무게: {LTBLUE}{WEIGHT_SHORT} {BLACK}힘: {LTBLUE}{POWER}{BLACK} 최고 속력: {LTBLUE}{VELOCITY} {BLACK}최고 견인력: {LTBLUE}{FORCE}
STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}열차 길이: {LTBLUE}{DECIMAL} 칸 {STRING} STR_VEHICLE_INFO_TRAIN_LENGTH :{BLACK}열차 길이: {LTBLUE}{DECIMAL} 칸 {STRING}
STR_VEHICLE_INFO_WEIGHT_RATIOS :{BLACK}힘 / 무게: {LTBLUE}{POWER_WEIGHT_RATIO} {BLACK} 최고 견인력 / 무게: {LTBLUE}{FORCE_WEIGHT_RATIO} STR_VEHICLE_INFO_WEIGHT_RATIOS :{STRING1} {STRING1}
STR_VEHICLE_INFO_POWER_WEIGHT_RATIO :{BLACK}힘 / 무게: {LTBLUE}{POWER_WEIGHT_RATIO}
STR_VEHICLE_INFO_TE_WEIGHT_RATIO :{BLACK}최고 견인력 / 무게: {LTBLUE}{FORCE_WEIGHT_RATIO}
STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}전체 중량: {LTBLUE}{WEIGHT_SHORT} {STRING} STR_VEHICLE_INFO_FULL_WEIGHT_WITH_RATIOS :{BLACK}전체 중량: {LTBLUE}{WEIGHT_SHORT} {STRING}
STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}가득 실었을 때 최대 속력: {LTBLUE}{VELOCITY} STR_VEHICLE_INFO_MAX_SPEED_LOADED :{BLACK}가득 실었을 때 최대 속력: {LTBLUE}{VELOCITY}

View File

@@ -199,8 +199,8 @@ class NIHVehicle : public NIHelper {
seprintf(buffer, lastof(buffer), " Speed restriction: %u, signal speed restriction (ATC): %u", seprintf(buffer, lastof(buffer), " Speed restriction: %u, signal speed restriction (ATC): %u",
t->speed_restriction, t->signal_speed_restriction); t->speed_restriction, t->signal_speed_restriction);
output.print(buffer); output.print(buffer);
seprintf(buffer, lastof(buffer), " Railtype: %u, compatible_railtypes: 0x" OTTD_PRINTFHEX64, seprintf(buffer, lastof(buffer), " Railtype: %u, compatible_railtypes: 0x" OTTD_PRINTFHEX64 ", acceleration type: %u",
t->railtype, t->compatible_railtypes); t->railtype, t->compatible_railtypes, t->GetAccelerationType());
output.print(buffer); output.print(buffer);
if (t->vehstatus & VS_CRASHED) { if (t->vehstatus & VS_CRASHED) {
seprintf(buffer, lastof(buffer), " CRASHED: anim pos: %u", t->crash_anim_pos); seprintf(buffer, lastof(buffer), " CRASHED: anim pos: %u", t->crash_anim_pos);

View File

@@ -352,8 +352,10 @@ public:
SetDParam(0, full_weight); SetDParam(0, full_weight);
if (_settings_client.gui.show_train_weight_ratios_in_details) { if (_settings_client.gui.show_train_weight_ratios_in_details) {
SetDParam(1, STR_VEHICLE_INFO_WEIGHT_RATIOS); SetDParam(1, STR_VEHICLE_INFO_WEIGHT_RATIOS);
SetDParam(2, (100 * this->virtual_train->gcache.cached_power) / std::max<uint>(1, full_weight)); SetDParam(2, STR_VEHICLE_INFO_POWER_WEIGHT_RATIO);
SetDParam(3, (this->virtual_train->gcache.cached_max_te / 10) / std::max<uint>(1, full_weight)); SetDParam(3, (100 * this->virtual_train->gcache.cached_power) / std::max<uint>(1, full_weight));
SetDParam(4, this->virtual_train->GetAccelerationType() == 2 ? STR_EMPTY : STR_VEHICLE_INFO_TE_WEIGHT_RATIO);
SetDParam(5, (this->virtual_train->gcache.cached_max_te / 10) / std::max<uint>(1, full_weight));
} else { } else {
SetDParam(1, STR_EMPTY); SetDParam(1, STR_EMPTY);
} }

View File

@@ -768,8 +768,10 @@ public:
SetDParam(0, tmp->full_weight); SetDParam(0, tmp->full_weight);
if (_settings_client.gui.show_train_weight_ratios_in_details) { if (_settings_client.gui.show_train_weight_ratios_in_details) {
SetDParam(1, STR_VEHICLE_INFO_WEIGHT_RATIOS); SetDParam(1, STR_VEHICLE_INFO_WEIGHT_RATIOS);
SetDParam(2, (100 * tmp->power) / std::max<uint>(1, tmp->full_weight)); SetDParam(2, STR_VEHICLE_INFO_POWER_WEIGHT_RATIO);
SetDParam(3, (tmp->max_te / 10) / std::max<uint>(1, tmp->full_weight)); SetDParam(3, (100 * tmp->power) / std::max<uint>(1, tmp->full_weight));
SetDParam(4, GetRailTypeInfo(tmp->railtype)->acceleration_type == 2 ? STR_EMPTY : STR_VEHICLE_INFO_TE_WEIGHT_RATIO);
SetDParam(5, (tmp->max_te / 10) / std::max<uint>(1, tmp->full_weight));
} else { } else {
SetDParam(1, STR_EMPTY); SetDParam(1, STR_EMPTY);
} }

View File

@@ -321,6 +321,15 @@ public:
return this->GetCargoWeight(this->cargo.StoredCount()); return this->GetCargoWeight(this->cargo.StoredCount());
} }
/**
* Allows to know the acceleration type of a vehicle.
* @return Acceleration type of the vehicle.
*/
inline int GetAccelerationType() const
{
return GetRailTypeInfo(this->railtype)->acceleration_type;
}
protected: // These functions should not be called outside acceleration code. protected: // These functions should not be called outside acceleration code.
/** /**
* Gets the speed a broken down train (low speed breakdown) is limited to. * Gets the speed a broken down train (low speed breakdown) is limited to.
@@ -439,15 +448,6 @@ protected: // These functions should not be called outside acceleration code.
return 15 * (512 + this->GetCurrentSpeed()) / 512; return 15 * (512 + this->GetCurrentSpeed()) / 512;
} }
/**
* Allows to know the acceleration type of a vehicle.
* @return Acceleration type of the vehicle.
*/
inline int GetAccelerationType() const
{
return GetRailTypeInfo(this->railtype)->acceleration_type;
}
/** /**
* Returns the slope steepness used by this vehicle. * Returns the slope steepness used by this vehicle.
* @return Slope steepness used by the vehicle. * @return Slope steepness used by the vehicle.

View File

@@ -2899,8 +2899,10 @@ struct VehicleDetailsWindow : Window {
dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_GROUP)); dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_GROUP));
} }
if (this->vehicle_weight_ratio_line_shown) { if (this->vehicle_weight_ratio_line_shown) {
SetDParamMaxValue(0, 1 << 16); SetDParam(0, STR_VEHICLE_INFO_POWER_WEIGHT_RATIO);
SetDParamMaxValue(1, 1 << 16); SetDParamMaxValue(1, 1 << 16);
SetDParam(2, (v->type != VEH_TRAIN || Train::From(v)->GetAccelerationType() == 2) ? STR_EMPTY : STR_VEHICLE_INFO_TE_WEIGHT_RATIO);
SetDParamMaxValue(3, 1 << 16);
dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_WEIGHT_RATIOS)); dim = maxdim(dim, GetStringBoundingBox(STR_VEHICLE_INFO_WEIGHT_RATIOS));
} }
SetDParam(0, STR_VEHICLE_INFO_AGE); SetDParam(0, STR_VEHICLE_INFO_AGE);
@@ -3047,8 +3049,10 @@ struct VehicleDetailsWindow : Window {
bool should_show_weight_ratio = this->ShouldShowWeightRatioLine(v); bool should_show_weight_ratio = this->ShouldShowWeightRatioLine(v);
if (should_show_weight_ratio) { if (should_show_weight_ratio) {
SetDParam(0, (100 * Train::From(v)->gcache.cached_power) / std::max<uint>(1, Train::From(v)->gcache.cached_weight)); SetDParam(0, STR_VEHICLE_INFO_POWER_WEIGHT_RATIO);
SetDParam(1, (Train::From(v)->gcache.cached_max_te / 10) / std::max<uint>(1, Train::From(v)->gcache.cached_weight)); SetDParam(1, (100 * Train::From(v)->gcache.cached_power) / std::max<uint>(1, Train::From(v)->gcache.cached_weight));
SetDParam(2, Train::From(v)->GetAccelerationType() == 2 ? STR_EMPTY : STR_VEHICLE_INFO_TE_WEIGHT_RATIO);
SetDParam(3, (Train::From(v)->gcache.cached_max_te / 10) / std::max<uint>(1, Train::From(v)->gcache.cached_weight));
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_VEHICLE_INFO_WEIGHT_RATIOS); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_VEHICLE_INFO_WEIGHT_RATIOS);
y += FONT_HEIGHT_NORMAL; y += FONT_HEIGHT_NORMAL;
} }