summaryrefslogtreecommitdiff
path: root/src/autoreplace_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-26 21:02:35 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-26 21:02:35 +0000
commit191954d8a7b5f3cf42cfed56a3c8edd90b67e92d (patch)
tree319a71a39327a2dffaf9b5a57c31eee769d39e7b /src/autoreplace_gui.cpp
parentc5b749f9837effff08f766e9405b5175cefb4306 (diff)
downloadopenttd-191954d8a7b5f3cf42cfed56a3c8edd90b67e92d.tar.xz
(svn r11989) -Fix: Resize autoreplace window to fit purchase information text if it is too large.
Diffstat (limited to 'src/autoreplace_gui.cpp')
-rw-r--r--src/autoreplace_gui.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 29a7490cf..a478f1456 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -345,7 +345,13 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
/* Also draw the details if an engine is selected */
if (WP(w, replaceveh_d).sel_engine[i] != INVALID_ENGINE) {
const Widget *wi = &w->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS];
- DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]);
+ int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]);
+
+ if (text_end > wi->bottom) {
+ SetWindowDirty(w);
+ ResizeWindowForWidget(w, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom);
+ SetWindowDirty(w);
+ }
}
}