(svn r28004) -Update from Eints:
[openttd.git] / src / viewport_type.h
blob07485c324334559c036aeea2c2be4fc40d076da8
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file viewport_type.h Types related to viewports. */
12 #ifndef VIEWPORT_TYPE_H
13 #define VIEWPORT_TYPE_H
15 #include "zoom_type.h"
16 #include "strings_type.h"
17 #include "table/strings.h"
19 class LinkGraphOverlay;
21 /**
22 * Data structure for viewport, display of a part of the world
24 struct ViewPort {
25 int left; ///< Screen coordinate left egde of the viewport
26 int top; ///< Screen coordinate top edge of the viewport
27 int width; ///< Screen width of the viewport
28 int height; ///< Screen height of the viewport
30 int virtual_left; ///< Virtual left coordinate
31 int virtual_top; ///< Virtual top coordinate
32 int virtual_width; ///< width << zoom
33 int virtual_height; ///< height << zoom
35 ZoomLevel zoom; ///< The zoom level of the viewport.
36 LinkGraphOverlay *overlay;
39 /** Margins for the viewport sign */
40 enum ViewportSignMargin {
41 VPSM_LEFT = 1, ///< Left margin
42 VPSM_RIGHT = 1, ///< Right margin
43 VPSM_TOP = 1, ///< Top margin
44 VPSM_BOTTOM = 1, ///< Bottom margin
47 /** Location information about a sign as seen on the viewport */
48 struct ViewportSign {
49 int32 center; ///< The center position of the sign
50 int32 top; ///< The top of the sign
51 uint16 width_normal; ///< The width when not zoomed out (normal font)
52 uint16 width_small; ///< The width when zoomed out (small font)
54 void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
55 void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
58 /**
59 * Directions of zooming.
60 * @see DoZoomInOutWindow
62 enum ZoomStateChange {
63 ZOOM_IN = 0, ///< Zoom in (get more detailed view).
64 ZOOM_OUT = 1, ///< Zoom out (get helicopter view).
65 ZOOM_NONE = 2, ///< Hack, used to update the button status.
68 /**
69 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
70 * z=0..5 Everything that can be built under low bridges.
71 * z=6 reserved, currently unused.
72 * z=7 Z separator between bridge/tunnel and the things under/above it.
74 static const uint BB_HEIGHT_UNDER_BRIDGE = 6; ///< Everything that can be built under low bridges, must not exceed this Z height.
75 static const uint BB_Z_SEPARATOR = 7; ///< Separates the bridge/tunnel from the things under/above it.
77 /** Viewport place method (type of highlighted area and placed objects) */
78 enum ViewportPlaceMethod {
79 VPM_X_OR_Y = 0, ///< drag in X or Y direction
80 VPM_FIX_X = 1, ///< drag only in X axis
81 VPM_FIX_Y = 2, ///< drag only in Y axis
82 VPM_X_AND_Y = 3, ///< area of land in X and Y directions
83 VPM_X_AND_Y_LIMITED = 4, ///< area of land of limited size
84 VPM_FIX_HORIZONTAL = 5, ///< drag only in horizontal direction
85 VPM_FIX_VERTICAL = 6, ///< drag only in vertical direction
86 VPM_X_LIMITED = 7, ///< Drag only in X axis with limited size
87 VPM_Y_LIMITED = 8, ///< Drag only in Y axis with limited size
88 VPM_RAILDIRS = 0x40, ///< all rail directions
89 VPM_SIGNALDIRS = 0x80, ///< similar to VMP_RAILDIRS, but with different cursor
91 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
93 /**
94 * Drag and drop selection process, or, what to do with an area of land when
95 * you've selected it.
97 enum ViewportDragDropSelectionProcess {
98 DDSP_DEMOLISH_AREA, ///< Clear area
99 DDSP_RAISE_AND_LEVEL_AREA, ///< Raise / level area
100 DDSP_LOWER_AND_LEVEL_AREA, ///< Lower / level area
101 DDSP_LEVEL_AREA, ///< Level area
102 DDSP_CREATE_DESERT, ///< Fill area with desert
103 DDSP_CREATE_ROCKS, ///< Fill area with rocks
104 DDSP_CREATE_WATER, ///< Create a canal
105 DDSP_CREATE_RIVER, ///< Create rivers
106 DDSP_PLANT_TREES, ///< Plant trees
107 DDSP_BUILD_BRIDGE, ///< Bridge placement
109 /* Rail specific actions */
110 DDSP_PLACE_RAIL, ///< Rail placement
111 DDSP_BUILD_SIGNALS, ///< Signal placement
112 DDSP_BUILD_STATION, ///< Station placement
113 DDSP_REMOVE_STATION, ///< Station removal
114 DDSP_CONVERT_RAIL, ///< Rail conversion
116 /* Road specific actions */
117 DDSP_PLACE_ROAD_X_DIR, ///< Road placement (X axis)
118 DDSP_PLACE_ROAD_Y_DIR, ///< Road placement (Y axis)
119 DDSP_PLACE_AUTOROAD, ///< Road placement (auto)
120 DDSP_BUILD_BUSSTOP, ///< Road stop placement (buses)
121 DDSP_BUILD_TRUCKSTOP, ///< Road stop placement (trucks)
122 DDSP_REMOVE_BUSSTOP, ///< Road stop removal (buses)
123 DDSP_REMOVE_TRUCKSTOP, ///< Road stop removal (trucks)
126 #endif /* VIEWPORT_TYPE_H */