1
0
Fork 0

Change: Use an indent, not a dash, to list train capacity

pull/9884/head^2
Tyler Trahan 2022-05-11 15:28:59 -06:00 committed by Niels Martin Hansen
parent 646d160c38
commit ebc76a4200
2 changed files with 10 additions and 5 deletions

View File

@ -4228,8 +4228,8 @@ STR_VEHICLE_DETAILS_TRAIN_ENGINE_BUILT_AND_VALUE :{LTBLUE}{ENGINE
STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE :{LTBLUE}{ENGINE}{BLACK} Value: {LTBLUE}{CURRENCY_LONG} STR_VEHICLE_DETAILS_TRAIN_WAGON_VALUE :{LTBLUE}{ENGINE}{BLACK} Value: {LTBLUE}{CURRENCY_LONG}
STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT :{BLACK}Total cargo capacity of this train: STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_TEXT :{BLACK}Total cargo capacity of this train:
STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY :{LTBLUE}- {CARGO_LONG} ({CARGO_SHORT}) STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY :{LTBLUE}{CARGO_LONG} ({CARGO_SHORT})
STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT :{LTBLUE}- {CARGO_LONG} ({CARGO_SHORT}) (x{NUM}) STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT :{LTBLUE}{CARGO_LONG} ({CARGO_SHORT}) (x{NUM})
STR_VEHICLE_DETAILS_CARGO_EMPTY :{LTBLUE}Empty STR_VEHICLE_DETAILS_CARGO_EMPTY :{LTBLUE}Empty
STR_VEHICLE_DETAILS_CARGO_FROM :{LTBLUE}{CARGO_LONG} from {STATION} STR_VEHICLE_DETAILS_CARGO_FROM :{LTBLUE}{CARGO_LONG} from {STATION}

View File

@ -180,8 +180,9 @@ struct CargoSummaryItem {
} }
}; };
static const uint TRAIN_DETAILS_MIN_INDENT = 32; ///< Minimum indent level in the train details window static const uint TRAIN_DETAILS_MIN_INDENT = 32; ///< Minimum indent level in the train details window
static const uint TRAIN_DETAILS_MAX_INDENT = 72; ///< Maximum indent level in the train details window; wider than this and we start on a new line static const uint TRAIN_DETAILS_MAX_INDENT = 72; ///< Maximum indent level in the train details window; wider than this and we start on a new line
static const int TRAIN_DETAILS_LIST_INDENT = 10; ///< Indent for list items in the Total Cargo window
/** Container for the cargo summary information. */ /** Container for the cargo summary information. */
typedef std::vector<CargoSummaryItem> CargoSummary; typedef std::vector<CargoSummaryItem> CargoSummary;
@ -363,6 +364,10 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
/* get rid of awkward offset */ /* get rid of awkward offset */
y -= WD_MATRIX_TOP; y -= WD_MATRIX_TOP;
/* Indent the total cargo capacity details */
int offs_left = _current_text_dir == TD_LTR ? TRAIN_DETAILS_LIST_INDENT : 0;
int offs_right = _current_text_dir == TD_LTR ? 0 : TRAIN_DETAILS_LIST_INDENT;
int sprite_height = ScaleGUITrad(GetVehicleHeight(VEH_TRAIN)); int sprite_height = ScaleGUITrad(GetVehicleHeight(VEH_TRAIN));
int line_height = std::max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); int line_height = std::max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM);
int sprite_y_offset = line_height / 2; int sprite_y_offset = line_height / 2;
@ -465,7 +470,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
SetDParam(2, i); // {SHORTCARGO} #1 SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2 SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
SetDParam(4, _settings_game.vehicle.freight_trains); SetDParam(4, _settings_game.vehicle.freight_trains);
DrawString(left, right, y + text_y_offset, FreightWagonMult(i) > 1 ? STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT : STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY); DrawString(left + offs_left, right - offs_right, y + text_y_offset, FreightWagonMult(i) > 1 ? STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY_MULT : STR_VEHICLE_DETAILS_TRAIN_TOTAL_CAPACITY);
y += line_height; y += line_height;
} }
} }