Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (Revision 11368) +++ src/lang/english.txt (Arbeitskopie) @@ -288,11 +288,14 @@ STR_013D_INFORMATION :{BLACK}Information STR_013E_CAPACITIES :{BLACK}Capacities STR_013E_TOTAL_CARGO :{BLACK}Total Cargo +STR_WAGON_SPEEDS :{BLACK}Speeds STR_013F_CAPACITY :{BLACK}Capacity: {LTBLUE}{CARGO} STR_CAPACITY_MULT :{BLACK}Capacity: {LTBLUE}{CARGO} (x{NUM}) STR_013F_TOTAL_CAPACITY_TEXT :{BLACK}Total cargo capacity of this train: STR_013F_TOTAL_CAPACITY :{LTBLUE}- {CARGO} ({SHORTCARGO}) STR_TOTAL_CAPACITY_MULT :{LTBLUE}- {CARGO} ({SHORTCARGO}) (x{NUM}) +STR_WAGON_SPEEDS_VELOCITY :{LTBLUE}{VELOCITY} +STR_WAGON_SPEEDS_VELOCITY_NO_LIMIT :{LTBLUE}No limit STR_0140_NEW_GAME :{BLACK}New Game STR_0141_LOAD_GAME :{BLACK}Load Game STR_SINGLE_PLAYER :{BLACK}Single player @@ -2740,6 +2743,7 @@ STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES :{BLACK}Show details of train vehicles STR_8851_SHOW_CAPACITIES_OF_EACH :{BLACK}Show capacities of each vehicle STR_8852_SHOW_TOTAL_CARGO :{BLACK}Show total capacity of train, split by cargo type +SHOW_WAGON_SPEEDS :{BLACK}Show engine and wagons speeds STR_8852_ORDERS_LIST_CLICK_ON_ORDER :{BLACK}Orders list - click on an order to highlight it. CTRL + click scrolls to the station STR_8853_SKIP_THE_CURRENT_ORDER :{BLACK}Skip the current order, and start the next. CTRL + click skips to the selected order STR_8854_DELETE_THE_HIGHLIGHTED :{BLACK}Delete the highlighted order Index: src/vehicle_gui.h =================================================================== --- src/vehicle_gui.h (Revision 11368) +++ src/vehicle_gui.h (Arbeitskopie) @@ -41,6 +41,27 @@ VLW_MASK = 0x700, }; +/** Constants of vehicle details widget indices */ +enum VehicleDetailsWindowWidgets { + VLD_WIDGET_CLOSEBOX = 0, + VLD_WIDGET_CAPTION, + VLD_WIDGET_RENAME_VEHICLE, + VLD_WIDGET_TOP_DETAILS, + VLD_WIDGET_INCREASE_SERVICING_INTERVAL, + VLD_WIDGET_DECREASE_SERVICING_INTERVAL, + VLD_WIDGET_BOTTOM_RIGHT, + VLD_WIDGET_MIDDLE_DETAILS, + VLD_WIDGET_SCROLLBAR, + VLD_WIDGET_DETAILS_CARGO_CARRIED, + VLD_WIDGET_DETAILS_TRAIN_VEHICLES, + VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, + VLD_WIDGET_DETAILS_TOTAL_CARGO, + VLD_WIDGET_DETAILS_SPACER, + VLD_WIDGET_DETAILS_SPEEDS, + VLD_WIDGET_DETAILS_SPACER2, + VLD_WIDGET_RESIZE, +}; + static inline bool ValidVLWFlags(uint16 flags) { return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); Index: src/vehicle_gui.cpp =================================================================== --- src/vehicle_gui.cpp (Revision 11368) +++ src/vehicle_gui.cpp (Arbeitskopie) @@ -1280,24 +1280,6 @@ /* Unified vehicle GUI - Vehicle Details Window */ -/** Constants of vehicle details widget indices */ -enum VehicleDetailsWindowWidgets { - VLD_WIDGET_CLOSEBOX = 0, - VLD_WIDGET_CAPTION, - VLD_WIDGET_RENAME_VEHICLE, - VLD_WIDGET_TOP_DETAILS, - VLD_WIDGET_INCREASE_SERVICING_INTERVAL, - VLD_WIDGET_DECREASE_SERVICING_INTERVAL, - VLD_WIDGET_BOTTOM_RIGHT, - VLD_WIDGET_MIDDLE_DETAILS, - VLD_WIDGET_SCROLLBAR, - VLD_WIDGET_DETAILS_CARGO_CARRIED, - VLD_WIDGET_DETAILS_TRAIN_VEHICLES, - VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, - VLD_WIDGET_DETAILS_TOTAL_CARGO, - VLD_WIDGET_RESIZE, -}; - /** Vehicle details widgets. */ static const Widget _vehicle_details_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // VLD_WIDGET_CLOSEBOX @@ -1313,7 +1295,11 @@ { WWT_PUSHTXTBTN, RESIZE_TB, 14, 96, 194, 113, 124, STR_013D_INFORMATION, STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES},// VLD_WIDGET_DETAILS_TRAIN_VEHICLES { WWT_PUSHTXTBTN, RESIZE_TB, 14, 195, 293, 113, 124, STR_013E_CAPACITIES, STR_8851_SHOW_CAPACITIES_OF_EACH}, // VLD_WIDGET_DETAILS_CAPACITY_OF_EACH { WWT_PUSHTXTBTN, RESIZE_RTB, 14, 294, 392, 113, 124, STR_013E_TOTAL_CARGO, STR_8852_SHOW_TOTAL_CARGO}, // VLD_WIDGET_DETAILS_TOTAL_CARGO - { WWT_RESIZEBOX, RESIZE_LRTB, 14, 393, 404, 113, 124, 0x0, STR_RESIZE_BUTTON}, // VLD_RESIZE + { WWT_PANEL, RESIZE_LRTB, 14, 393, 404, 113, 124, 0x0, STR_NULL}, // VLD_WIDGET_DETAILS_SPACER + { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 95, 125, 136, STR_WAGON_SPEEDS, SHOW_WAGON_SPEEDS}, // VLD_WIDGET_DETAILS_SPEEDS + { WWT_PANEL, RESIZE_LRTB, 14, 96, 392, 125, 136, 0x0, STR_NULL}, // VLD_WIDGET_DETAILS_SPACER2 + { WWT_RESIZEBOX, RESIZE_LRTB, 14, 393, 404, 125, 136, 0x0, STR_RESIZE_BUTTON}, // VLD_RESIZE + { WIDGETS_END}, }; @@ -1364,12 +1350,14 @@ ResizeWindow(w, 0, 39); w->vscroll.cap = 6; - w->height += 12; + w->height += 24; w->resize.step_height = 14; w->resize.height = w->height - 14 * 2; // Minimum of 4 wagons in the display w->widget[VLD_WIDGET_RENAME_VEHICLE].tooltips = STR_8867_NAME_TRAIN; w->widget[VLD_WIDGET_CAPTION].data = STR_8802_DETAILS; + + WP(w, vehicledetails_d).tab = VLD_WIDGET_DETAILS_CARGO_CARRIED; break; case VEH_ROAD: { @@ -1406,12 +1394,11 @@ if (v->type != VEH_TRAIN) { w->vscroll.cap = 1; w->widget[VLD_WIDGET_MIDDLE_DETAILS].right += 12; + WP(w, vehicledetails_d).tab = 0; } w->widget[VLD_WIDGET_MIDDLE_DETAILS].data = (w->vscroll.cap << 8) + 1; w->caption_color = v->owner; - - WP(w, vehicledetails_d).tab = 0; } /** Checks whether service interval is enabled for the vehicle. */ @@ -1463,7 +1450,7 @@ SetWindowWidgetDisabledState(w, VLD_WIDGET_RENAME_VEHICLE, v->owner != _local_player); if (v->type == VEH_TRAIN) { - DisableWindowWidget(w, det_tab + VLD_WIDGET_DETAILS_CARGO_CARRIED); + DisableWindowWidget(w, det_tab); SetVScrollCount(w, GetTrainDetailsWndVScroll(v->index, det_tab)); } @@ -1473,6 +1460,9 @@ VLD_WIDGET_DETAILS_TRAIN_VEHICLES, VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, VLD_WIDGET_DETAILS_TOTAL_CARGO, + VLD_WIDGET_DETAILS_SPACER, + VLD_WIDGET_DETAILS_SPEEDS, + VLD_WIDGET_DETAILS_SPACER2, VLD_WIDGET_RESIZE, WIDGET_LIST_END); @@ -1528,7 +1518,7 @@ /* Draw service interval text */ SetDParam(0, v->service_interval); SetDParam(1, v->date_of_last_service); - DrawString(13, w->height - (v->type != VEH_TRAIN ? 11 : 23), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0); + DrawString(13, w->height - (v->type != VEH_TRAIN ? 11 : 35), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0); switch (v->type) { case VEH_TRAIN: @@ -1598,15 +1588,17 @@ case VLD_WIDGET_DETAILS_TRAIN_VEHICLES: case VLD_WIDGET_DETAILS_CAPACITY_OF_EACH: case VLD_WIDGET_DETAILS_TOTAL_CARGO: + case VLD_WIDGET_DETAILS_SPEEDS: SetWindowWidgetsDisabledState(w, false, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TRAIN_VEHICLES, VLD_WIDGET_DETAILS_CAPACITY_OF_EACH, VLD_WIDGET_DETAILS_TOTAL_CARGO, + VLD_WIDGET_DETAILS_SPEEDS, e->we.click.widget, WIDGET_LIST_END); - WP(w, vehicledetails_d).tab = e->we.click.widget - VLD_WIDGET_DETAILS_CARGO_CARRIED; + WP(w, vehicledetails_d).tab = e->we.click.widget; SetWindowDirty(w); break; } @@ -1620,7 +1612,11 @@ break; case WE_RESIZE: - if (e->we.sizing.diff.x != 0) ResizeButtons(w, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO); + if (e->we.sizing.diff.x != 0) { + ResizeButtons(w, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO); + w->widget[VLD_WIDGET_DETAILS_SPEEDS].right = w->widget[VLD_WIDGET_DETAILS_CARGO_CARRIED].right; + w->widget[VLD_WIDGET_DETAILS_SPACER2].left = w->widget[VLD_WIDGET_DETAILS_TRAIN_VEHICLES].left; + } if (e->we.sizing.diff.y == 0) break; w->vscroll.cap += e->we.sizing.diff.y / 14; Index: src/train_gui.cpp =================================================================== --- src/train_gui.cpp (Revision 11368) +++ src/train_gui.cpp (Arbeitskopie) @@ -152,6 +152,33 @@ } } +/** + * Vehicle speeds detail. + * It displays the maximum speed of the vehicle according the GRF settings and patch options + * + * @param v Vehicle to display + * @param x Coordinate (horizontal) of the string to display + * @param y Coordinate (vertical) of the string to display + */ +static void TrainDetailsSpeedsTab(const Vehicle *v, int x, int y) +{ + /* Vehicle max speed is found from the general vehicle information, not the vehicle itself */ + const RailVehicleInfo *rvi = RailVehInfo(v->engine_type); + + /* Wagons can have max speed only when the wagon_speed_limits is set and not using wagon override */ + if ((rvi->railveh_type != RAILVEH_WAGON || _patches.wagon_speed_limits) && !UsesWagonOverride(v)) { + if (GetVehicleProperty(v, 0x09, rvi->max_speed) != 0) { + /* Max speed is set, so we display it. The speed value + * has to be recalculated from from the internals. */ + SetDParam(0, GetVehicleProperty(v, 0x09, rvi->max_speed) * 10 / 16); + DrawString(x, y, STR_WAGON_SPEEDS_VELOCITY, 0); + } else { + /* Max speed is not set, so we display "no limit" */ + DrawString(x, y, STR_WAGON_SPEEDS_VELOCITY_NO_LIMIT, 0); + } + } +} + int GetTrainDetailsWndVScroll(VehicleID veh_id, byte det_tab) { AcceptedCargo act_cargo; @@ -185,8 +212,8 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vscroll_cap, byte det_tab) { - /* draw the first 3 details tabs */ - if (det_tab != 3) { + /* Draw all detail tab but the total cargo */ + if (det_tab != VLD_WIDGET_DETAILS_TOTAL_CARGO) { const Vehicle *u = v; x = 1; for (;;) { @@ -207,14 +234,15 @@ py = y + 2; switch (det_tab) { default: NOT_REACHED(); - case 0: TrainDetailsCargoTab( v, px, py); break; - case 1: + case VLD_WIDGET_DETAILS_CARGO_CARRIED: TrainDetailsCargoTab(v, px, py); break; + case VLD_WIDGET_DETAILS_TRAIN_VEHICLES: /* Only show name and value for the 'real' part */ if (!IsArticulatedPart(v)) { TrainDetailsInfoTab(v, px, py); } break; - case 2: TrainDetailsCapacityTab(v, px, py); break; + case VLD_WIDGET_DETAILS_CAPACITY_OF_EACH: TrainDetailsCapacityTab(v, px, py); break; + case VLD_WIDGET_DETAILS_SPEEDS: TrainDetailsSpeedsTab(v, px, py); break; } y += 14;