diff options
author | bjarni <bjarni@openttd.org> | 2008-04-22 23:16:36 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2008-04-22 23:16:36 +0000 |
commit | 80a0435ba822f4b92d84f10744bec5a7028ee69b (patch) | |
tree | e85acfcca4390f09f801c1b010b1f77fee03da42 /src/build_vehicle_gui.cpp | |
parent | 2c057b318ee5eff14aec5c80640796fd8d49c08b (diff) | |
download | openttd-80a0435ba822f4b92d84f10744bec5a7028ee69b.tar.xz |
(svn r12843) -Feature [FS#1945]: The autoreplace window is now resizable in both directions
The code to open this window is also unified for all vehicle types
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r-- | src/build_vehicle_gui.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 42210cf63..5174a949e 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -935,9 +935,9 @@ static void DrawVehicleEngine(VehicleType type, int x, int y, EngineID engine, S * @param min where to start in the list * @param max where in the list to end * @param selected_id what engine to highlight as selected, if any - * @param show_count Display the number of vehicles (used by autoreplace) + * @param count_location Offset to print the engine count (used by autoreplace). 0 means it's off */ -void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group) +void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group) { byte step_size = GetVehicleListHeight(type); byte x_offset = 0; @@ -977,10 +977,10 @@ void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, u SetDParam(0, engine); DrawString(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK); - DrawVehicleEngine(type, x, y + y_offset, engine, (show_count && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_player)); - if (show_count) { + DrawVehicleEngine(type, x, y + y_offset, engine, (count_location != 0 && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_player)); + if (count_location != 0) { SetDParam(0, num_engines); - DrawStringRightAligned(213, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING); + DrawStringRightAligned(count_location, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING); } } } @@ -1000,7 +1000,7 @@ static void DrawBuildVehicleWindow(Window *w) DrawWindowWidgets(w); - DrawEngineList(bv->vehicle_type, w->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, w->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, bv->eng_list, w->vscroll.pos, max, bv->sel_engine, false, DEFAULT_GROUP); + DrawEngineList(bv->vehicle_type, w->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, w->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, bv->eng_list, w->vscroll.pos, max, bv->sel_engine, 0, DEFAULT_GROUP); if (bv->sel_engine != INVALID_ENGINE) { const Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL]; |