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 25264 2013-05-19 14:49:25Z rubidium $ */
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
18 class LinkGraphOverlay;
19
23 struct ViewPort {
24 int left;
25 int top;
26 int width;
27 int height;
28
29 int virtual_left;
30 int virtual_top;
31 int virtual_width;
32 int virtual_height;
33
34 ZoomLevel zoom;
35 LinkGraphOverlay *overlay;
36 };
37
39 enum ViewportSignMargin {
40 VPSM_LEFT = 1,
41 VPSM_RIGHT = 1,
42 VPSM_TOP = 1,
43 VPSM_BOTTOM = 1,
44 };
45
47 struct ViewportSign {
48 int32 center;
49 int32 top;
50 uint16 width_normal;
51 uint16 width_small;
52
53 void UpdatePosition(int center, int top, StringID str);
54 void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
55 };
56
61 enum ZoomStateChange {
62 ZOOM_IN = 0,
63 ZOOM_OUT = 1,
64 ZOOM_NONE = 2,
65 };
66
73 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
74 static const uint BB_Z_SEPARATOR = 7;
75
77 enum ViewportPlaceMethod {
78 VPM_X_OR_Y = 0,
79 VPM_FIX_X = 1,
80 VPM_FIX_Y = 2,
81 VPM_X_AND_Y = 3,
82 VPM_X_AND_Y_LIMITED = 4,
83 VPM_FIX_HORIZONTAL = 5,
84 VPM_FIX_VERTICAL = 6,
85 VPM_X_LIMITED = 7,
86 VPM_Y_LIMITED = 8,
87 VPM_RAILDIRS = 0x40,
88 VPM_SIGNALDIRS = 0x80,
89 };
90 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
91
92
96 enum ViewportDragDropSelectionProcess {
97 DDSP_DEMOLISH_AREA,
98 DDSP_RAISE_AND_LEVEL_AREA,
99 DDSP_LOWER_AND_LEVEL_AREA,
100 DDSP_LEVEL_AREA,
101 DDSP_CREATE_DESERT,
102 DDSP_CREATE_ROCKS,
103 DDSP_CREATE_WATER,
104 DDSP_CREATE_RIVER,
105 DDSP_PLANT_TREES,
106 DDSP_BUILD_BRIDGE,
107
108 /* Rail specific actions */
109 DDSP_PLACE_RAIL,
110 DDSP_BUILD_SIGNALS,
111 DDSP_BUILD_STATION,
112 DDSP_REMOVE_STATION,
113 DDSP_CONVERT_RAIL,
114
115 /* Road specific actions */
116 DDSP_PLACE_ROAD_X_DIR,
117 DDSP_PLACE_ROAD_Y_DIR,
118 DDSP_PLACE_AUTOROAD,
119 DDSP_BUILD_BUSSTOP,
120 DDSP_BUILD_TRUCKSTOP,
121 DDSP_REMOVE_BUSSTOP,
122 DDSP_REMOVE_TRUCKSTOP,
123 };
124
125 #endif /* VIEWPORT_TYPE_H */