OpenTTD: src/viewport_type.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

viewport_type.h
Go to the documentation of this file.
1 /* $Id: viewport_type.h 27248 2015-04-25 11:58:19Z frosch $ */
2
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 */
9
12 #ifndef VIEWPORT_TYPE_H
13 #define VIEWPORT_TYPE_H
14
15 #include "zoom_type.h"
16 #include "strings_type.h"
17 #include "table/strings.h"
18
19 class LinkGraphOverlay;
20
24 struct ViewPort {
25 int left;
26 int top;
27 int width;
28 int height;
29
30 int virtual_left;
31 int virtual_top;
32 int virtual_width;
33 int virtual_height;
34
35 ZoomLevel zoom;
36 LinkGraphOverlay *overlay;
37 };
38
40 enum ViewportSignMargin {
41 VPSM_LEFT = 1,
42 VPSM_RIGHT = 1,
43 VPSM_TOP = 1,
44 VPSM_BOTTOM = 1,
45 };
46
48 struct ViewportSign {
49 int32 center;
50 int32 top;
51 uint16 width_normal;
52 uint16 width_small;
53
54 void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
55 void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
56 };
57
62 enum ZoomStateChange {
63 ZOOM_IN = 0,
64 ZOOM_OUT = 1,
65 ZOOM_NONE = 2,
66 };
67
74 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
75 static const uint BB_Z_SEPARATOR = 7;
76
78 enum ViewportPlaceMethod {
79 VPM_X_OR_Y = 0,
80 VPM_FIX_X = 1,
81 VPM_FIX_Y = 2,
82 VPM_X_AND_Y = 3,
83 VPM_X_AND_Y_LIMITED = 4,
84 VPM_FIX_HORIZONTAL = 5,
85 VPM_FIX_VERTICAL = 6,
86 VPM_X_LIMITED = 7,
87 VPM_Y_LIMITED = 8,
88 VPM_RAILDIRS = 0x40,
89 VPM_SIGNALDIRS = 0x80,
90 };
91 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
92
93
97 enum ViewportDragDropSelectionProcess {
98 DDSP_DEMOLISH_AREA,
99 DDSP_RAISE_AND_LEVEL_AREA,
100 DDSP_LOWER_AND_LEVEL_AREA,
101 DDSP_LEVEL_AREA,
102 DDSP_CREATE_DESERT,
103 DDSP_CREATE_ROCKS,
104 DDSP_CREATE_WATER,
105 DDSP_CREATE_RIVER,
106 DDSP_PLANT_TREES,
107 DDSP_BUILD_BRIDGE,
108
109 /* Rail specific actions */
110 DDSP_PLACE_RAIL,
111 DDSP_BUILD_SIGNALS,
112 DDSP_BUILD_STATION,
113 DDSP_REMOVE_STATION,
114 DDSP_CONVERT_RAIL,
115
116 /* Road specific actions */
117 DDSP_PLACE_ROAD_X_DIR,
118 DDSP_PLACE_ROAD_Y_DIR,
119 DDSP_PLACE_AUTOROAD,
120 DDSP_BUILD_BUSSTOP,
121 DDSP_BUILD_TRUCKSTOP,
122 DDSP_REMOVE_BUSSTOP,
123 DDSP_REMOVE_TRUCKSTOP,
124 };
125
126 #endif /* VIEWPORT_TYPE_H */