summaryrefslogtreecommitdiff
path: root/src/toolbar_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-03-25 19:06:59 +0000
committerrubidium <rubidium@openttd.org>2012-03-25 19:06:59 +0000
commit927734e6ce825f6b34380f73a2e73c74591dd16e (patch)
treec63e9e557e47cb68aff12e8ee01e8e41574ea900 /src/toolbar_gui.cpp
parentc8ce0faca49f85bbe72a3257bc327d14208f3d6c (diff)
downloadopenttd-927734e6ce825f6b34380f73a2e73c74591dd16e.tar.xz
(svn r24065) -Feature-ish [FS#5101]: debug option for showing the redrawn dirty blocks/rectangles
Diffstat (limited to 'src/toolbar_gui.cpp')
-rw-r--r--src/toolbar_gui.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 423dba436..31613f2e9 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -949,7 +949,7 @@ static CallBackFunction PlaceLandBlockInfo()
static CallBackFunction ToolbarHelpClick(Window *w)
{
- PopupMainToolbMenu(w, WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 11 : 9);
+ PopupMainToolbMenu(w, WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 12 : 9);
return CBF_NONE;
}
@@ -991,6 +991,23 @@ void ToggleBoundingBoxes()
}
/**
+ * Toggle drawing of the dirty blocks.
+ * @note has only an effect when newgrf_developer_tools are active.
+ *
+ * Function is found here and not in viewport.cpp in order to avoid
+ * importing the settings structs to there.
+ */
+void ToggleDirtyBlocks()
+{
+ extern bool _draw_dirty_blocks;
+ /* Always allow to toggle them off */
+ if (_settings_client.gui.newgrf_developer_tools || _draw_dirty_blocks) {
+ _draw_dirty_blocks = !_draw_dirty_blocks;
+ MarkWholeScreenDirty();
+ }
+}
+
+/**
* Choose the proper callback function for the main toolbar's help menu.
* @param index The menu index which was selected.
* @return CBF_NONE
@@ -1008,6 +1025,7 @@ static CallBackFunction MenuClickHelp(int index)
case 8: ShowAboutWindow(); break;
case 9: ShowSpriteAlignerWindow(); break;
case 10: ToggleBoundingBoxes(); break;
+ case 11: ToggleDirtyBlocks(); break;
}
return CBF_NONE;
}