summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-13 18:46:04 +0000
committerrubidium <rubidium@openttd.org>2007-12-13 18:46:04 +0000
commita0f2366e4052dbcdfcd5931b60104efdcf8ba83e (patch)
tree559800253167a43a8051c35a9601c98276c5cca8 /src/viewport.cpp
parent98d18c533789031756d3aebb6753d683494d4688 (diff)
downloadopenttd-a0f2366e4052dbcdfcd5931b60104efdcf8ba83e.tar.xz
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 96dbe753c..b9636ca11 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -32,8 +32,22 @@
ZoomLevel _saved_scrollpos_zoom;
-/* XXX - maximum viewports is maximum windows - 2 (main toolbar + status bar) */
-static ViewPort _viewports[25 - 2];
+/**
+ * The maximum number of viewports depends on the maximum number
+ * of windows. Technically is could be the maximum number of
+ * windows, but there is always at least one window that does
+ * not need a viewport. Not having 'support' for that viewport
+ * saves some time and memory.
+ * For the introduction GUI and create game GUIs there is no
+ * need for more than one viewport, however in the normal game
+ * and scenario editor one can make a lot of viewports. For the
+ * normal game one always has a main toolbar and a status bar,
+ * however the statusbar does not exist on the scenario editor.
+ *
+ * This means that we can only safely assume that there is one
+ * window without viewport.
+ */
+static ViewPort _viewports[MAX_NUMBER_OF_WINDOWS - 1];
static uint32 _active_viewports; ///< bitmasked variable where each bit signifies if a viewport is in use or not
assert_compile(lengthof(_viewports) < sizeof(_active_viewports) * 8);