/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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 .
*/
/**
* @file viewport.cpp Handling of all viewports.
*
* \verbatim
* The in-game coordinate system looks like this *
* *
* ^ Z *
* | *
* | *
* | *
* | *
* / \ *
* / \ *
* / \ *
* / \ *
* X < > Y *
* \endverbatim
*/
/**
* @defgroup vp_column_row Rows and columns in the viewport
*
* Columns are vertical sections of the viewport that are half a tile wide.
* The origin, i.e. column 0, is through the northern and southern most tile.
* This means that the column of e.g. Tile(0, 0) and Tile(100, 100) are in
* column number 0. The negative columns are towards the left of the screen,
* or towards the west, whereas the positive ones are towards respectively
* the right and east.
* With half a tile wide is meant that the next column of tiles directly west
* or east of the centre line are respectively column -1 and 1. Their tile
* centers are only half a tile from the center of their adjoining tile when
* looking only at the X-coordinate.
*
* \verbatim
* ╳ *
* ╱ ╲ *
* ╳ 0 ╳ *
* ╱ ╲ ╱ ╲ *
* ╳-1 ╳ 1 ╳ *
* ╱ ╲ ╱ ╲ ╱ ╲ *
* ╳-2 ╳ 0 ╳ 2 ╳ *
* ╲ ╱ ╲ ╱ ╲ ╱ *
* ╳-1 ╳ 1 ╳ *
* ╲ ╱ ╲ ╱ *
* ╳ 0 ╳ *
* ╲ ╱ *
* ╳ *
* \endverbatim
*
*
* Rows are horizontal sections of the viewport, also half a tile wide.
* This time the northern most tile on the map defines 0 and
* everything south of that has a positive number.
*/
#include "stdafx.h"
#include "clear_map.h"
#include "tree_map.h"
#include "industry.h"
#include "smallmap_gui.h"
#include "smallmap_colours.h"
#include "table/tree_land.h"
#include "blitter/32bpp_base.hpp"
#include "core/math_func.hpp"
#include "core/smallvec_type.hpp"
#include "landscape.h"
#include "viewport_func.h"
#include "station_base.h"
#include "waypoint_base.h"
#include "town.h"
#include "signs_base.h"
#include "signs_func.h"
#include "plans_base.h"
#include "plans_func.h"
#include "vehicle_base.h"
#include "vehicle_gui.h"
#include "blitter/factory.hpp"
#include "strings_func.h"
#include "zoom_func.h"
#include "vehicle_func.h"
#include "company_func.h"
#include "waypoint_func.h"
#include "window_func.h"
#include "tilehighlight_func.h"
#include "zoning.h"
#include "window_gui.h"
#include "linkgraph/linkgraph_gui.h"
#include "viewport_kdtree.h"
#include "town_kdtree.h"
#include "viewport_sprite_sorter.h"
#include "bridge_map.h"
#include "company_base.h"
#include "command_func.h"
#include "network/network_func.h"
#include "framerate_type.h"
#include "depot_base.h"
#include "tunnelbridge_map.h"
#include "gui.h"
#include "core/container_func.hpp"
#include "tunnelbridge_map.h"
#include "video/video_driver.hpp"
#include "scope_info.h"
#include "scope.h"
#include "blitter/32bpp_base.hpp"
#include "object_map.h"
#include "newgrf_object.h"
#include "infrastructure_func.h"
#include "tracerestrict.h"
#include "worker_thread.h"
#include "vehiclelist.h"
#include "core/backup_type.hpp"
#include