summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-21 23:24:25 +0000
committerbjarni <bjarni@openttd.org>2007-01-21 23:24:25 +0000
commit1f32ce7e8932208993ef8bfc5c4124606f4ae6c3 (patch)
tree9752952ecffff6e620e55d288dc9fbaca74dc23e
parent4bb18a450c6774cb240e767c1373fb87407ea8ce (diff)
downloadopenttd-1f32ce7e8932208993ef8bfc5c4124606f4ae6c3.tar.xz
(svn r8334) -Fix (r8331): build window buttons now both resize as intended
-rw-r--r--src/build_vehicle_gui.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index c7fee0bcc..9ab3d4d0e 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -54,6 +54,14 @@ static const Widget _build_vehicle_widgets[] = {
{ WIDGETS_END},
};
+static void ResizeButtons(Window *w)
+{
+ /* Make the buttons in the bottom equal in size */
+ w->widget[BUILD_VEHICLE_WIDGET_RENAME].right = w->widget[BUILD_VEHICLE_WIDGET_RESIZE].left - 1;
+ w->widget[BUILD_VEHICLE_WIDGET_RENAME].left = w->widget[BUILD_VEHICLE_WIDGET_RENAME].right / 2;
+ w->widget[BUILD_VEHICLE_WIDGET_BUILD].right = w->widget[BUILD_VEHICLE_WIDGET_RENAME].left - 1;
+}
+
/* Setup widget strings to fit the different types of vehicles */
static void SetupWindowStrings(const Window *w, byte type)
{
@@ -762,6 +770,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
break;
case WE_RESIZE:
+ if (e->we.sizing.diff.x != 0) ResizeButtons(w);
if (e->we.sizing.diff.y == 0) break;
w->vscroll.cap += e->we.sizing.diff.y / GetVehicleListHeight(bv->vehicle_type);
@@ -820,6 +829,7 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
}
}
SetupWindowStrings(w, type);
+ ResizeButtons(w);
w->resize.width = w->width;
w->resize.height = w->height;