src/viewport_type.h
branchnoai
changeset 10455 22c441f5adf9
parent 10142 56ee7da4ad56
child 10513 33cb70ff2f5d
equal deleted inserted replaced
10412:ef44f62cb8b9 10455:22c441f5adf9
     3 /** @file viewport_type.h Types related to viewports. */
     3 /** @file viewport_type.h Types related to viewports. */
     4 
     4 
     5 #ifndef VIEWPORT_TYPE_H
     5 #ifndef VIEWPORT_TYPE_H
     6 #define VIEWPORT_TYPE_H
     6 #define VIEWPORT_TYPE_H
     7 
     7 
     8 #include "core/geometry_type.hpp"
       
     9 #include "zoom_type.h"
     8 #include "zoom_type.h"
    10 #include "window_type.h"
       
    11 #include "tile_type.h"
       
    12 
     9 
    13 /**
    10 /**
    14  * Data structure for viewport, display of a part of the world
    11  * Data structure for viewport, display of a part of the world
    15  */
    12  */
    16 struct ViewPort {
    13 struct ViewPort {
    23 	int virtual_top;     ///< Virtual top coordinate
    20 	int virtual_top;     ///< Virtual top coordinate
    24 	int virtual_width;   ///< width << zoom
    21 	int virtual_width;   ///< width << zoom
    25 	int virtual_height;  ///< height << zoom
    22 	int virtual_height;  ///< height << zoom
    26 
    23 
    27 	ZoomLevel zoom;
    24 	ZoomLevel zoom;
       
    25 };
       
    26 
       
    27 struct ViewportSign {
       
    28 	int32 left;
       
    29 	int32 top;
       
    30 	byte width_1, width_2;
    28 };
    31 };
    29 
    32 
    30 enum {
    33 enum {
    31 	ZOOM_IN   = 0,
    34 	ZOOM_IN   = 0,
    32 	ZOOM_OUT  = 1,
    35 	ZOOM_OUT  = 1,
    53 	VPM_X_AND_Y         = 4, ///< area of land in X and Y directions
    56 	VPM_X_AND_Y         = 4, ///< area of land in X and Y directions
    54 	VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
    57 	VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
    55 	VPM_SIGNALDIRS      = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
    58 	VPM_SIGNALDIRS      = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
    56 };
    59 };
    57 
    60 
    58 /** Viewport highlight mode (for highlighting tiles below cursor) */
       
    59 enum ViewportHighlightMode {
       
    60 	VHM_NONE    = 0, ///< default
       
    61 	VHM_RECT    = 1, ///< rectangle (stations, depots, ...)
       
    62 	VHM_POINT   = 2, ///< point (lower land, raise land, level land, ...)
       
    63 	VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
       
    64 	VHM_DRAG    = 4, ///< dragging items in the depot windows
       
    65 	VHM_RAIL    = 5, ///< rail pieces
       
    66 };
       
    67 
       
    68 /** Highlighting draw styles */
       
    69 enum HighLightStyle {
       
    70 	HT_NONE   = 0x00,
       
    71 	HT_RECT   = 0x80,
       
    72 	HT_POINT  = 0x40,
       
    73 	HT_LINE   = 0x20,    ///< used for autorail highlighting (longer streches)
       
    74 	                     ///< (uses lower bits to indicate direction)
       
    75 	HT_RAIL   = 0x10,    ///< autorail (one piece)
       
    76 	                     ///< (uses lower bits to indicate direction)
       
    77 	HT_DRAG_MASK = 0xF0, ///< masks the drag-type
       
    78 
       
    79 	/* lower bits (used with HT_LINE and HT_RAIL):
       
    80 	 * (see ASCII art in autorail.h for a visual interpretation) */
       
    81 	HT_DIR_X  = 0,    ///< X direction
       
    82 	HT_DIR_Y  = 1,    ///< Y direction
       
    83 	HT_DIR_HU = 2,    ///< horizontal upper
       
    84 	HT_DIR_HL = 3,    ///< horizontal lower
       
    85 	HT_DIR_VL = 4,    ///< vertical left
       
    86 	HT_DIR_VR = 5,    ///< vertical right
       
    87 	HT_DIR_MASK = 0x7 ///< masks the drag-direction
       
    88 };
       
    89 DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
       
    90 
       
    91 
       
    92 struct TileHighlightData {
       
    93 	Point size;
       
    94 	Point outersize;
       
    95 	Point pos;
       
    96 	Point offs;
       
    97 
       
    98 	Point new_pos;
       
    99 	Point new_size;
       
   100 	Point new_outersize;
       
   101 
       
   102 	Point selend, selstart;
       
   103 
       
   104 	byte dirty;
       
   105 	byte sizelimit;
       
   106 
       
   107 	byte drawstyle;      // lower bits 0-3 are reserved for detailed highlight information information
       
   108 	byte new_drawstyle;  // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
       
   109 	byte next_drawstyle; // queued, but not yet drawn style
       
   110 
       
   111 	ViewportHighlightMode place_mode;
       
   112 	bool make_square_red;
       
   113 	WindowClass window_class;
       
   114 	WindowNumber window_number;
       
   115 
       
   116 	ViewportPlaceMethod select_method;
       
   117 	byte select_proc;
       
   118 
       
   119 	TileIndex redsq;
       
   120 };
       
   121 
       
   122 #endif /* VIEWPORT_TYPE_H */
    61 #endif /* VIEWPORT_TYPE_H */