# viewport_type.h

Go to the documentation of this file.

    00001 /* $Id: viewport_type.h 24900 2013-01-08 22:46:42Z planetmaker $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef VIEWPORT_TYPE_H
    00013 #define VIEWPORT_TYPE_H
    00014
    00015 #include "zoom_type.h"
    00016 #include "strings_type.h"
    00017
    00021 struct ViewPort {
    00022   int left;
    00023   int top;
    00024   int width;
    00025   int height;
    00026
    00027   int virtual_left;
    00028   int virtual_top;
    00029   int virtual_width;
    00030   int virtual_height;
    00031
    00032   ZoomLevel zoom;
    00033 };
    00034
    00036 enum ViewportSignMargin {
    00037   VPSM_LEFT   = 1,
    00038   VPSM_RIGHT  = 1,
    00039   VPSM_TOP    = 1,
    00040   VPSM_BOTTOM = 1,
    00041 };
    00042
    00044 struct ViewportSign {
    00045   int32 center;
    00046   int32 top;
    00047   uint16 width_normal;
    00048   uint16 width_small;
    00049
    00050   void UpdatePosition(int center, int top, StringID str);
    00051   void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
    00052 };
    00053
    00058 enum ZoomStateChange {
    00059   ZOOM_IN   = 0,
    00060   ZOOM_OUT  = 1,
    00061   ZOOM_NONE = 2,
    00062 };
    00063
    00070 static const uint BB_HEIGHT_UNDER_BRIDGE = 6;
    00071 static const uint BB_Z_SEPARATOR         = 7;
    00072
    00074 enum ViewportPlaceMethod {
    00075   VPM_X_OR_Y          =    0,
    00076   VPM_FIX_X           =    1,
    00077   VPM_FIX_Y           =    2,
    00078   VPM_X_AND_Y         =    3,
    00079   VPM_X_AND_Y_LIMITED =    4,
    00080   VPM_FIX_HORIZONTAL  =    5,
    00081   VPM_FIX_VERTICAL    =    6,
    00082   VPM_X_LIMITED       =    7,
    00083   VPM_Y_LIMITED       =    8,
    00084   VPM_RAILDIRS        = 0x40,
    00085   VPM_SIGNALDIRS      = 0x80,
    00086 };
    00087 DECLARE_ENUM_AS_BIT_SET(ViewportPlaceMethod)
    00088
    00089
    00093 enum ViewportDragDropSelectionProcess {
    00094   DDSP_DEMOLISH_AREA,
    00095   DDSP_RAISE_AND_LEVEL_AREA,
    00096   DDSP_LOWER_AND_LEVEL_AREA,
    00097   DDSP_LEVEL_AREA,
    00098   DDSP_CREATE_DESERT,
    00099   DDSP_CREATE_ROCKS,
    00100   DDSP_CREATE_WATER,
    00101   DDSP_CREATE_RIVER,
    00102   DDSP_PLANT_TREES,
    00103   DDSP_BUILD_BRIDGE,
    00104
    00105   /* Rail specific actions */
    00106   DDSP_PLACE_RAIL,
    00107   DDSP_BUILD_SIGNALS,
    00108   DDSP_BUILD_STATION,
    00109   DDSP_REMOVE_STATION,
    00110   DDSP_CONVERT_RAIL,
    00111
    00112   /* Road specific actions */
    00113   DDSP_PLACE_ROAD_X_DIR,
    00114   DDSP_PLACE_ROAD_Y_DIR,
    00115   DDSP_PLACE_AUTOROAD,
    00116   DDSP_BUILD_BUSSTOP,
    00117   DDSP_BUILD_TRUCKSTOP,
    00118   DDSP_REMOVE_BUSSTOP,
    00119   DDSP_REMOVE_TRUCKSTOP,
    00120 };
    00121
    00122 #endif /* VIEWPORT_TYPE_H */