summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-06-21 01:40:56 +0000
committerbelugas <belugas@openttd.org>2008-06-21 01:40:56 +0000
commita6e0e2d83788dc98c9dc10f4db5ec472ffb06cbb (patch)
tree513788c8a9d9c2beb7755d0ba7a70917db32b214
parent4236dd3be5c4c5c130551f625f3459a4c733bfc3 (diff)
downloadopenttd-a6e0e2d83788dc98c9dc10f4db5ec472ffb06cbb.tar.xz
(svn r13597) -Codechange: Enumification of the Map menu items.
The rework allowed to remove a function, by merging two quite similar ones.
-rw-r--r--src/toolbar_gui.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 4a58f5d2d..76b04f23a 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -291,27 +291,37 @@ static void MenuClickSaveLoad(int index)
/* --- Map button menu --- */
+enum MapMenuEntries {
+ MME_SHOW_SMALLMAP = 0,
+ MME_SHOW_EXTRAVIEWPORTS,
+ MME_SHOW_SIGNLISTS,
+ MME_SHOW_TOWNDIRECTORY, ///< This entry is only used in Editor mode
+ MME_MENUCOUNT_NORMAL = 3,
+ MME_MENUCOUNT_EDITOR = 4,
+};
+
static void ToolbarMapClick(Window *w)
{
- PopupMainToolbMenu(w, TBN_SMALLMAP, STR_02DE_MAP_OF_WORLD, 3);
+ PopupMainToolbMenu(w, TBN_SMALLMAP, STR_02DE_MAP_OF_WORLD, MME_MENUCOUNT_NORMAL);
}
-static void MenuClickMap(int index)
+static void ToolbarScenMapTownDir(Window *w)
{
- switch (index) {
- case 0: ShowSmallMap(); break;
- case 1: ShowExtraViewPortWindow(); break;
- case 2: ShowSignList(); break;
- }
+ /* Scenario editor button, Use different button to activate.
+ * This scheme will allow to have an action (SEMA_MAP_CLICK, which is in fact
+ * an entry in _menu_clicked_procs) while at the same time having a start button
+ * who is not at the same index as its action
+ * @see ToolbarMenuWindow::OnMouseLoop */
+ PopupMainToolbMenu(w, TBSE_SMALLMAP | SEMA_MAP_CLICK, STR_02DE_MAP_OF_WORLD, MME_MENUCOUNT_EDITOR);
}
-static void MenuClickScenMap(int index)
+static void MenuClickMap(int index)
{
switch (index) {
- case 0: ShowSmallMap(); break;
- case 1: ShowExtraViewPortWindow(); break;
- case 2: ShowSignList(); break;
- case 3: ShowTownDirectory(); break;
+ case MME_SHOW_SMALLMAP: ShowSmallMap(); break;
+ case MME_SHOW_EXTRAVIEWPORTS: ShowExtraViewPortWindow(); break;
+ case MME_SHOW_SIGNLISTS: ShowSignList(); break;
+ case MME_SHOW_TOWNDIRECTORY: if (_game_mode == GM_EDITOR) ShowTownDirectory(); break;
}
}
@@ -682,16 +692,6 @@ static void ToolbarScenDateForward(Window *w)
_left_button_clicked = false;
}
-static void ToolbarScenMapTownDir(Window *w)
-{
- /* Scenario editor button, Use different button to activate.
- * This scheme will allow to have an action (SEMA_MAP_CLICK, which is in fact
- * an entry in _menu_clicked_procs) while at the same time having a start button
- * who is not at the same index as its action
- * @see ToolbarMenuWindow::OnMouseLoop */
- PopupMainToolbMenu(w, TBSE_SMALLMAP | SEMA_MAP_CLICK, STR_02DE_MAP_OF_WORLD, 4);
-}
-
static void ToolbarScenZoomIn(Window *w)
{
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
@@ -1314,7 +1314,7 @@ static MenuClickedProc * const _menu_clicked_procs[] = {
MenuClickShowRoad, /* 14 */
MenuClickShowShips, /* 15 */
MenuClickShowAir, /* 16 */
- MenuClickScenMap, /* 17 */
+ MenuClickMap, /* 17 */
NULL, /* 18 */
MenuClickBuildRail, /* 19 */
MenuClickBuildRoad, /* 20 */