summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/autoreplace_gui.cpp4
-rw-r--r--src/build_vehicle_gui.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 448a48c81..29a7490cf 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -334,13 +334,13 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
/* Draw the lists */
for(byte i = 0; i < 2; i++) {
- uint16 x = i == 0 ? 2 : 230; // at what X offset
+ uint widget = (i == 0) ? RVW_WIDGET_LEFT_MATRIX : RVW_WIDGET_RIGHT_MATRIX;
EngineList list = WP(w, replaceveh_d).list[i]; // which list to draw
EngineID start = i == 0 ? w->vscroll.pos : w->vscroll2.pos; // what is the offset for the start (scrolling)
EngineID end = min((i == 0 ? w->vscroll.cap : w->vscroll2.cap) + start, EngList_Count(&list));
/* Do the actual drawing */
- DrawEngineList((VehicleType)w->window_number, x, 15, list, start, end, WP(w, replaceveh_d).sel_engine[i], i == 0, selected_group);
+ DrawEngineList((VehicleType)w->window_number, w->widget[widget].left + 2, w->widget[widget].top + 1, list, start, end, WP(w, replaceveh_d).sel_engine[i], i == 0, selected_group);
/* Also draw the details if an engine is selected */
if (WP(w, replaceveh_d).sel_engine[i] != INVALID_ENGINE) {
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 0cbdf8338..f6f583f57 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -986,7 +986,7 @@ static void DrawBuildVehicleWindow(Window *w)
DrawWindowWidgets(w);
- DrawEngineList(bv->vehicle_type, 2, 27, 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, false, DEFAULT_GROUP);
if (bv->sel_engine != INVALID_ENGINE) {
const Widget *wi = &w->widget[BUILD_VEHICLE_WIDGET_PANEL];
@@ -1011,7 +1011,7 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
break;
case BUILD_VEHICLE_WIDGET_LIST: {
- uint i = (e->we.click.pt.y - 26) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
+ uint i = (e->we.click.pt.y - w->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(bv->vehicle_type) + w->vscroll.pos;
uint num_items = EngList_Count(&bv->eng_list);
bv->sel_engine = (i < num_items) ? bv->eng_list[i] : INVALID_ENGINE;
SetWindowDirty(w);