annotate src/tilehighlight_type.h @ 12778:bc7926153e19 draft

(svn r17248) -Fix: add GPL license notice where appropriate
author rubidium <rubidium@openttd.org>
date Fri, 21 Aug 2009 20:21:05 +0000
parents cdaad565efe5
children a899d4e5ee1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
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/>.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11702
diff changeset
9
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
10 /** @file tilehighlight_type.h Types related to highlighting tiles. */
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #ifndef TILEHIGHLIGHT_TYPE_H
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #define TILEHIGHLIGHT_TYPE_H
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 #include "core/geometry_type.hpp"
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16 #include "zoom_type.h"
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
17 #include "window_type.h"
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 #include "tile_type.h"
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 /** Highlighting draw styles */
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
21 enum HighLightStyle {
11702
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
22 HT_NONE = 0x00, ///< default
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
23 HT_RECT = 0x10, ///< rectangle (stations, depots, ...)
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
24 HT_POINT = 0x20, ///< point (lower land, raise land, level land, ...)
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
25 HT_SPECIAL = 0x30, ///< special mode used for highlighting while dragging (and for tunnels/docks)
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
26 HT_DRAG = 0x40, ///< dragging items in the depot windows
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
27 HT_LINE = 0x08, ///< used for autorail highlighting (longer streches), lower bits: direction
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
28 HT_RAIL = 0x80, ///< autorail (one piece), lower bits: direction
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
29 HT_DRAG_MASK = 0xF8, ///< masks the drag-type
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 /* lower bits (used with HT_LINE and HT_RAIL):
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 * (see ASCII art in autorail.h for a visual interpretation) */
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 HT_DIR_X = 0, ///< X direction
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
34 HT_DIR_Y = 1, ///< Y direction
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
35 HT_DIR_HU = 2, ///< horizontal upper
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
36 HT_DIR_HL = 3, ///< horizontal lower
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
37 HT_DIR_VL = 4, ///< vertical left
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
38 HT_DIR_VR = 5, ///< vertical right
11700
5cb273d3151b (svn r16086) -Codechange: magic numbers substitutes by enums and some type safety
rubidium <rubidium@openttd.org>
parents: 11072
diff changeset
39 HT_DIR_END, ///< end marker
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
40 HT_DIR_MASK = 0x7 ///< masks the drag-direction
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
41 };
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
42 DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
43
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
44
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
45 struct TileHighlightData {
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
46 Point size;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
47 Point outersize;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
48 Point pos;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
49 Point offs;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
50
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
51 Point new_pos;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
52 Point new_size;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
53 Point new_outersize;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
54
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
55 Point selend, selstart;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
56
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
57 byte dirty;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
58 byte sizelimit;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
59
11700
5cb273d3151b (svn r16086) -Codechange: magic numbers substitutes by enums and some type safety
rubidium <rubidium@openttd.org>
parents: 11072
diff changeset
60 HighLightStyle drawstyle; // lower bits 0-3 are reserved for detailed highlight information information
5cb273d3151b (svn r16086) -Codechange: magic numbers substitutes by enums and some type safety
rubidium <rubidium@openttd.org>
parents: 11072
diff changeset
61 HighLightStyle new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
5cb273d3151b (svn r16086) -Codechange: magic numbers substitutes by enums and some type safety
rubidium <rubidium@openttd.org>
parents: 11072
diff changeset
62 HighLightStyle next_drawstyle; // queued, but not yet drawn style
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
63
11702
cdaad565efe5 (svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents: 11700
diff changeset
64 HighLightStyle place_mode;
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
65 bool make_square_red;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
66 WindowClass window_class;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
67 WindowNumber window_number;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
68
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 ViewportPlaceMethod select_method;
9147
6c9755fab091 (svn r13009) -Codechange: move more tile highlighting related functions/types to tilehighlight_*.h.
rubidium <rubidium@openttd.org>
parents: 9127
diff changeset
70 ViewportDragDropSelectionProcess select_proc;
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
71
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
72 TileIndex redsq;
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
73 };
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
74
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
diff changeset
75 #endif /* TILEHIGHLIGHT_TYPE_H */