summaryrefslogtreecommitdiff
path: root/viewport.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-11-07 13:06:02 +0000
committerDarkvater <Darkvater@openttd.org>2006-11-07 13:06:02 +0000
commit3a2c773411ccabaaa87130a8499bda4995588a54 (patch)
tree99bc81d869567e52619264b8aa261b56be9836eb /viewport.c
parent501fcb3465bc95744dcc78461d71e822e9c4d5cd (diff)
downloadopenttd-3a2c773411ccabaaa87130a8499bda4995588a54.tar.xz
(svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
buttons depending on calling window, game-mode); handle it by broadcasting messages to the calling window, because that knows how and what buttons to set.
Diffstat (limited to 'viewport.c')
-rw-r--r--viewport.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/viewport.c b/viewport.c
index 79ae0b269..6d6f5cf58 100644
--- a/viewport.c
+++ b/viewport.c
@@ -375,6 +375,21 @@ Point GetTileZoomCenterWindow(bool in, Window * w)
return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, x + vp->left, y + vp->top);
}
+/** Update the status of the zoom-buttons according to the zoom-level
+ * of the viewport. This will update their status and invalidate accordingly
+ * @param window pointer to the window that has the zoom buttons
+ * @param vp pointer to the viewport whose zoom-level the buttons represent
+ * @param widget_zoom_in widget index for window with zoom-in button
+ * @param widget_zoom_out widget index for window with zoom-out button */
+void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out)
+{
+ SetWindowWidgetDisabledState(w, widget_zoom_in, vp->zoom == 0);
+ InvalidateWidget(w, widget_zoom_in);
+
+ SetWindowWidgetDisabledState(w, widget_zoom_out, vp->zoom == 2);
+ InvalidateWidget(w, widget_zoom_out);
+}
+
void DrawGroundSpriteAt(uint32 image, int32 x, int32 y, byte z)
{
ViewportDrawer *vd = _cur_vd;