summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-07-01 00:04:09 +0000
committerbelugas <belugas@openttd.org>2008-07-01 00:04:09 +0000
commitce721a579fbe107c420a0cbd9f5c7b22c5234b6f (patch)
treec9a35e49029f1226232991eb4e0a3e01df260e0f
parente9e453cf8bb46ef48cd385cb954e080c282b521d (diff)
downloadopenttd-ce721a579fbe107c420a0cbd9f5c7b22c5234b6f.tar.xz
(svn r13670) -Codechange : Merge some very alike events handlers.
-rw-r--r--src/toolbar_gui.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index bb9d1e847..9becdf8d3 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -520,7 +520,7 @@ static void MenuClickShowAir(int index)
static void ToolbarZoomInClick(Window *w)
{
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
- w->HandleButtonClick(TBN_ZOOMIN);
+ w->HandleButtonClick((_game_mode == GM_EDITOR) ? TBSE_ZOOMIN : TBN_ZOOMIN);
SndPlayFx(SND_15_BEEP);
}
}
@@ -530,7 +530,7 @@ static void ToolbarZoomInClick(Window *w)
static void ToolbarZoomOutClick(Window *w)
{
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) {
- w->HandleButtonClick(TBN_ZOOMOUT);
+ w->HandleButtonClick((_game_mode == GM_EDITOR) ? TBSE_ZOOMOUT : TBN_ZOOMOUT);
SndPlayFx(SND_15_BEEP);
}
}
@@ -704,22 +704,6 @@ static void ToolbarScenDateForward(Window *w)
_left_button_clicked = false;
}
-static void ToolbarScenZoomIn(Window *w)
-{
- if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
- w->HandleButtonClick(TBSE_ZOOMIN);
- SndPlayFx(SND_15_BEEP);
- }
-}
-
-static void ToolbarScenZoomOut(Window *w)
-{
- if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) {
- w->HandleButtonClick(TBSE_ZOOMOUT);
- SndPlayFx(SND_15_BEEP);
- }
-}
-
static void ToolbarScenGenLand(Window *w)
{
w->HandleButtonClick(TBSE_LANDGENERATE);
@@ -1080,8 +1064,8 @@ static ToolbarButtonProc * const _scen_toolbar_button_procs[] = {
ToolbarScenDateBackward,
ToolbarScenDateForward,
ToolbarScenMapTownDir,
- ToolbarScenZoomIn,
- ToolbarScenZoomOut,
+ ToolbarZoomInClick,
+ ToolbarZoomOutClick,
ToolbarScenGenLand,
ToolbarScenGenTown,
ToolbarScenGenIndustry,
@@ -1161,13 +1145,13 @@ public:
case WKC_NUM_PLUS:
case WKC_EQUALS:
case WKC_SHIFT | WKC_EQUALS:
- case WKC_SHIFT | WKC_F5: ToolbarScenZoomIn(this); break;
+ case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break;
/* those following are all fall through */
case WKC_NUM_MINUS:
case WKC_MINUS:
case WKC_SHIFT | WKC_MINUS:
- case WKC_SHIFT | WKC_F6: ToolbarScenZoomOut(this); break;
+ case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break;
case 'L': ShowEditorTerraformToolbar(); break;
case 'M': ShowSmallMap(); break;