summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-06-18 03:19:31 +0000
committerbelugas <belugas@openttd.org>2008-06-18 03:19:31 +0000
commitbe4e7b86f3adba6cfc877f592295e3e0a13b1009 (patch)
tree1be787817acb1228cac87a46b47fb725e1d40a9f
parent22c017c0c24d1263c313447e4fc97641c7b198e7 (diff)
downloadopenttd-be4e7b86f3adba6cfc877f592295e3e0a13b1009.tar.xz
(svn r13562) -Codechange: Yet another enumification, which required a bit of explanation/documentation of a trickery some would call a hack
-rw-r--r--src/toolbar_gui.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 5c6489ab4..7927b88b8 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -98,7 +98,8 @@ enum ToolbarScenEditorWidgets {
TBSE_SEPARATOR,
TBSE_DATEBACKWARD,
TBSE_DATEFORWARD,
- TBSE_ZOOMIN = 9,
+ TBSE_SMALLMAP,
+ TBSE_ZOOMIN,
TBSE_ZOOMOUT,
TBSE_LANDGENERATE,
TBSE_TOWNGENERATE,
@@ -108,6 +109,14 @@ enum ToolbarScenEditorWidgets {
TBSE_PLACESIGNS,
};
+/** The idea of this enum is to allow a separation between widget position
+ * and _menu_clicked_procs's entry. By shifting, the "action" id is extracted and
+ * kept safe for usage when reuired.
+ * @see ToolbarMenuWindow::OnMouseLoop */
+enum ScenarioEditorMenuActions {
+ SEMA_MAP_CLICK = 17 << 8,
+};
+
static ToolbarMode _toolbar_mode;
static void SelectSignTool()
@@ -658,8 +667,12 @@ static void ToolbarScenDateForward(Window *w)
static void ToolbarScenMapTownDir(Window *w)
{
- /* Scenario editor button, *hack*hack* use different button to activate */
- PopupMainToolbMenu(w, 8 | (17 << 8), STR_02DE_MAP_OF_WORLD, 4);
+ /* 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)