Changeset - r8224:194097dc7288
[Not reviewed]
master
! ! !
rubidium - 16 years ago 2008-01-09 09:45:45
rubidium@openttd.org
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
63 files changed with 333 insertions and 285 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -36,6 +36,7 @@
 
#include "variables.h"
 
#include "autoreplace_func.h"
 
#include "autoreplace_gui.h"
 
#include "gfx_func.h"
 

	
 
void Aircraft::UpdateDeltaXY(Direction direction)
 
{
src/aircraft_gui.cpp
Show inline comments
 
@@ -10,13 +10,13 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "engine.h"
 
#include "viewport.h"
 
#include "player.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 
#include "gfx_func.h"
 

	
 
/**
 
* Draw the details for the given vehicle at the position (x,y)
src/airport_gui.cpp
Show inline comments
 
@@ -10,7 +10,6 @@
 
#include "gui.h"
 
#include "station_gui.h"
 
#include "terraform_gui.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "station.h"
 
#include "airport.h"
 
@@ -18,6 +17,8 @@
 
#include "sound_func.h"
 
#include "window_func.h"
 
#include "variables.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 
static byte _selected_airport_type;
 

	
src/autoreplace_gui.cpp
Show inline comments
 
@@ -18,6 +18,7 @@
 
#include "window_func.h"
 
#include "vehicle_func.h"
 
#include "autoreplace_func.h"
 
#include "gfx_func.h"
 

	
 
static RailType _railtype_selected_in_replace_gui;
 

	
src/bridge_gui.cpp
Show inline comments
 
@@ -7,7 +7,6 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "economy_func.h"
 
#include "variables.h"
 
@@ -16,6 +15,8 @@
 
#include "window_func.h"
 
#include "sound_func.h"
 
#include "map_func.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 
static struct BridgeData {
 
	uint8 last_size;
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -30,6 +30,7 @@
 
#include "date_func.h"
 
#include "vehicle_func.h"
 
#include "settings_type.h"
 
#include "gfx_func.h"
 

	
 
struct buildvehicle_d {
 
	VehicleType vehicle_type;
src/clear_cmd.cpp
Show inline comments
 
@@ -7,7 +7,6 @@
 
#include "clear_map.h"
 
#include "table/strings.h"
 
#include "player.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "bridge.h"
 
#include "landscape.h"
 
@@ -21,6 +20,7 @@
 
#include "functions.h"
 
#include "economy_func.h"
 
#include "table/clear_land.h"
 
#include "viewport_func.h"
 

	
 
static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
 
{
src/console.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 
#define ICON_BUFFER 79
 
#define ICON_HISTORY_SIZE 20
src/depot_gui.cpp
Show inline comments
 
@@ -12,7 +12,8 @@
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
src/dock_gui.cpp
Show inline comments
 
@@ -12,13 +12,14 @@
 
#include "terraform_gui.h"
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "water.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 
#include "sound_func.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 
static void ShowBuildDockStationPicker();
 
static void ShowBuildDocksDepotPicker();
src/economy.cpp
Show inline comments
 
@@ -43,6 +43,7 @@
 
#include "track_type.h"
 
#include "track_func.h"
 
#include "rail_map.h"
 
#include "gfx_func.h"
 

	
 
/**
 
 * Multiply two integer values and shift the results to right.
src/elrail.cpp
Show inline comments
 
@@ -48,7 +48,7 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "station_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "variables.h" /* ... same here */
 
#include "landscape.h"
 
#include "rail_type.h"
src/engine_gui.cpp
Show inline comments
 
@@ -8,7 +8,7 @@
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "gfx_func.h"
 
#include "engine.h"
 
#include "command_func.h"
 
#include "economy_func.h"
src/genworld_gui.cpp
Show inline comments
 
@@ -26,6 +26,7 @@
 
#include "sound_func.h"
 
#include "fios.h"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 
/**
 
 * In what 'mode' the GenerateLandscapeWindowProc is.
src/graph_gui.cpp
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "gfx_func.h"
 

	
 
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
 
static uint _legend_excluded_players;
src/group_gui.cpp
Show inline comments
 
@@ -15,7 +15,6 @@
 
#include "depot.h"
 
#include "train.h"
 
#include "group.h"
 
#include "viewport.h"
 
#include "debug.h"
 
#include "strings_func.h"
 
#include "core/alloc_func.hpp"
 
@@ -23,6 +22,8 @@
 
#include "vehicle_func.h"
 
#include "autoreplace_gui.h"
 
#include "string_func.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 

	
 
struct Sorting {
src/gui.h
Show inline comments
 
@@ -49,13 +49,6 @@ void ShowBuildAirToolbar();
 
void ShowGenerateLandscape();
 
void ShowHeightmapLoad();
 

	
 
typedef void PlaceProc(TileIndex tile);
 
void PlaceProc_DemolishArea(TileIndex tile);
 
void PlaceProc_LevelLand(TileIndex tile);
 
void PlaceProc_BuyLand(TileIndex tile);
 
bool GUIPlaceProcDragXY(const WindowEvent *e);
 
VARDEF PlaceProc *_place_proc;
 

	
 
/** Drag and drop selection process, or, what to do with an area of land when
 
 * you've selected it. */
 
enum {
src/industry_gui.cpp
Show inline comments
 
@@ -11,7 +11,8 @@
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "command_func.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "industry.h"
 
#include "town.h"
 
#include "variables.h"
src/intro_gui.cpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "fios.h"
 
#include "gfx_func.h"
 

	
 
static const Widget _select_game_widgets[] = {
 
{    WWT_CAPTION, RESIZE_NONE, 13,   0, 335,   0,  13, STR_0307_OPENTTD,         STR_NULL},
src/main_gui.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
#include "window_gui.h"
 
#include "window_func.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "news.h"
src/misc.cpp
Show inline comments
 
@@ -18,7 +18,7 @@
 
#include "newgrf_house.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "economy_func.h"
 
#include "zoom_func.h"
 
#include "functions.h"
 
@@ -27,6 +27,8 @@
 
#include "vehicle_func.h"
 
#include "texteff.hpp"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 

	
 
char _name_array[512][32];
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -18,7 +18,8 @@
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "station.h"
 
#include "command_func.h"
 
#include "player.h"
src/music_gui.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "sound_func.h"
 
#include "gfx_func.h"
 
#include "core/math_func.hpp"
 

	
 
static byte _music_wnd_cursong;
 
static bool _song_is_active;
src/network/network_gui.cpp
Show inline comments
 
@@ -26,6 +26,7 @@
 
#include "../window_func.h"
 
#include "../core/alloc_func.hpp"
 
#include "../string_func.h"
 
#include "../gfx_func.h"
 

	
 
#define BGC 5
 
#define BTC 15
src/newgrf_gui.cpp
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "window_func.h"
 
#include "core/alloc_func.hpp"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 
/** Parse an integerlist string and set each found value
 
 * @param p the string to be parsed. Each element in the list is seperated by a
src/news_gui.cpp
Show inline comments
 
@@ -7,7 +7,7 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "news.h"
 
#include "variables.h"
 
#include "transparency.h"
src/openttd.cpp
Show inline comments
 
@@ -20,7 +20,8 @@
 
#include "station_map.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "window_func.h"
 
#include "window_gui.h"
 
#include "player.h"
src/order_gui.cpp
Show inline comments
 
@@ -13,7 +13,8 @@
 
#include "station.h"
 
#include "town.h"
 
#include "command_func.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "depot.h"
 
#include "waypoint.h"
 
#include "train.h"
src/player_gui.cpp
Show inline comments
 
@@ -9,7 +9,8 @@
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "network/network.h"
src/rail_cmd.cpp
Show inline comments
 
@@ -16,7 +16,7 @@
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "command_func.h"
 
#include "pathfind.h"
 
#include "engine.h"
src/rail_gui.cpp
Show inline comments
 
@@ -12,7 +12,8 @@
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "terraform_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "station.h"
 
#include "waypoint.h"
src/road_cmd.cpp
Show inline comments
 
@@ -16,7 +16,7 @@
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "town.h"
src/road_gui.cpp
Show inline comments
 
@@ -10,7 +10,8 @@
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "terraform_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "road_type.h"
src/roadveh_cmd.cpp
Show inline comments
 
@@ -40,6 +40,7 @@
 
#include "sound_func.h"
 
#include "variables.h"
 
#include "autoreplace_gui.h"
 
#include "gfx_func.h"
 

	
 

	
 
static const uint16 _roadveh_images[63] = {
src/roadveh_gui.cpp
Show inline comments
 
@@ -10,7 +10,8 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
src/settings_gui.cpp
Show inline comments
 
@@ -25,6 +25,7 @@
 
#include "vehicle_base.h"
 
#include "core/alloc_func.hpp"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 
static uint32 _difficulty_click_a;
 
static uint32 _difficulty_click_b;
src/ship_cmd.cpp
Show inline comments
 
@@ -36,6 +36,7 @@
 
#include "sound_func.h"
 
#include "variables.h"
 
#include "autoreplace_gui.h"
 
#include "gfx_func.h"
 

	
 

	
 
static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
src/ship_gui.cpp
Show inline comments
 
@@ -10,7 +10,8 @@
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
src/signs_gui.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 
#include "map_func.h"
 
#include "gfx_func.h"
 
#include "viewport_func.h"
 

	
 
static const Sign **_sign_sort;
 
static uint _num_sign_sort;
src/smallmap_gui.cpp
Show inline comments
 
@@ -16,7 +16,8 @@
 
#include "window_gui.h"
 
#include "tree_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "player.h"
 
#include "town.h"
 
#include "variables.h"
src/sound.cpp
Show inline comments
 
@@ -7,7 +7,6 @@
 
#include "landscape.h"
 
#include "mixer.h"
 
#include "sound_func.h"
 
#include "viewport.h"
 
#include "fileio.h"
 
#include "newgrf_sound.h"
 
#include "fios.h"
src/station_gui.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include "strings_func.h"
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
 

	
src/subsidy_gui.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "window_gui.h"
 
#include "strings_func.h"
 
#include "date_func.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 

	
 
static void HandleSubsidyClick(int y)
 
{
src/table/autorail.h
Show inline comments
 
@@ -52,21 +52,21 @@ static const int _AutorailTilehSprite[][
 

	
 
// maps each pixel of a tile (16x16) to a selection type
 
// (0,0) is the top corner, (16,16) the bottom corner
 
static const byte _AutorailPiece[][16] = {
 
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
 
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5,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DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL },
 
	{ HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL },
 
	{ HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL }
 
};
src/terraform_gui.cpp
Show inline comments
 
@@ -11,7 +11,8 @@
 
#include "player.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "signs.h"
 
#include "variables.h"
src/timetable_gui.cpp
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "strings_func.h"
 
#include "vehicle_base.h"
 
#include "string_func.h"
 
#include "gfx_func.h"
 

	
 
static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
 
{
src/town_cmd.cpp
Show inline comments
 
@@ -13,7 +13,7 @@
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "town.h"
 
#include "command_func.h"
 
#include "industry.h"
src/town_gui.cpp
Show inline comments
 
@@ -8,7 +8,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "town.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
src/train_cmd.cpp
Show inline comments
 
@@ -45,6 +45,7 @@
 
#include "sound_func.h"
 
#include "variables.h"
 
#include "autoreplace_gui.h"
 
#include "gfx_func.h"
 

	
 

	
 
static bool TrainCheckIfLineEnds(Vehicle *v);
src/train_gui.cpp
Show inline comments
 
@@ -9,7 +9,7 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "gfx_func.h"
 
#include "command_func.h"
 
#include "vehicle_gui.h"
 
#include "depot.h"
src/transparency_gui.cpp
Show inline comments
 
@@ -6,7 +6,6 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "variables.h"
 
#include "transparency.h"
 
#include "sound_func.h"
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -16,7 +16,7 @@
 
#include "landscape.h"
 
#include "tunnel_map.h"
 
#include "unmovable_map.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "town.h"
src/unmovable_cmd.cpp
Show inline comments
 
@@ -9,7 +9,7 @@
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "command_func.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "player.h"
 
#include "gui.h"
 
#include "station.h"
src/vehicle.cpp
Show inline comments
 
@@ -13,7 +13,8 @@
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "timetable.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "news.h"
 
#include "command_func.h"
 
#include "saveload.h"
src/vehicle_gui.cpp
Show inline comments
 
@@ -16,7 +16,8 @@
 
#include "command_func.h"
 
#include "variables.h"
 
#include "vehicle_gui.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "gfx_func.h"
 
#include "train.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
src/viewport.cpp
Show inline comments
 
@@ -11,7 +11,7 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "landscape.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "station.h"
 
#include "town.h"
 
#include "signs.h"
 
@@ -28,6 +28,8 @@
 

	
 
#define VIEWPORT_DRAW_MEM (65536 * 2)
 

	
 
PlaceProc *_place_proc;
 
Point _tile_fract_coords;
 
ZoomLevel _saved_scrollpos_zoom;
 

	
 
/**
 
@@ -865,23 +867,22 @@ static bool IsPartOfAutoLine(int px, int
 
	px -= _thd.selstart.x;
 
	py -= _thd.selstart.y;
 

	
 
	switch (_thd.drawstyle) {
 
	case HT_LINE | HT_DIR_X:  return py == 0; // x direction
 
	case HT_LINE | HT_DIR_Y:  return px == 0; // y direction
 
	case HT_LINE | HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
 
	case HT_LINE | HT_DIR_HL: return px == -py || px == -py + 16; // horizontal lower
 
	case HT_LINE | HT_DIR_VL: return px == py || px == py + 16; // vertival left
 
	case HT_LINE | HT_DIR_VR: return px == py || px == py - 16; // vertical right
 
	default:
 
		NOT_REACHED();
 
	if ((_thd.drawstyle & ~HT_DIR_MASK) != HT_LINE) return false;
 

	
 
	switch (_thd.drawstyle & HT_DIR_MASK) {
 
		case HT_DIR_X:  return py == 0; // x direction
 
		case HT_DIR_Y:  return px == 0; // y direction
 
		case HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
 
		case HT_DIR_HL: return px == -py || px == -py + 16; // horizontal lower
 
		case HT_DIR_VL: return px == py || px == py + 16; // vertival left
 
		case HT_DIR_VR: return px == py || px == py - 16; // vertical right
 
		default:
 
			NOT_REACHED();
 
	}
 

	
 
	/* useless, but avoids compiler warning this way */
 
	return 0;
 
}
 

	
 
// [direction][side]
 
static const int _AutorailType[6][2] = {
 
static const HighLightStyle _autorail_type[6][2] = {
 
	{ HT_DIR_X,  HT_DIR_X },
 
	{ HT_DIR_Y,  HT_DIR_Y },
 
	{ HT_DIR_HU, HT_DIR_HL },
 
@@ -969,7 +970,7 @@ static void DrawTileSelection(const Tile
 
			/* autorail highlight piece under cursor */
 
			uint type = _thd.drawstyle & 0xF;
 
			assert(type <= 5);
 
			DrawAutorailSelection(ti, _AutorailType[type][0]);
 
			DrawAutorailSelection(ti, _autorail_type[type][0]);
 
		} else if (IsPartOfAutoLine(ti->x, ti->y)) {
 
			/* autorail highlighting long line */
 
			int dir = _thd.drawstyle & ~0xF0;
 
@@ -982,7 +983,7 @@ static void DrawTileSelection(const Tile
 
				side = Delta(Delta(TileX(start), TileX(ti->tile)), Delta(TileY(start), TileY(ti->tile)));
 
			}
 

	
 
			DrawAutorailSelection(ti, _AutorailType[dir][side]);
 
			DrawAutorailSelection(ti, _autorail_type[dir][side]);
 
		}
 
		return;
 
	}
 
@@ -2229,9 +2230,9 @@ void SetTileSelectBigSize(int ox, int oy
 
}
 

	
 
/** returns the best autorail highlight type from map coordinates */
 
static byte GetAutorailHT(int x, int y)
 
static HighLightStyle GetAutorailHT(int x, int y)
 
{
 
	return HT_RAIL | _AutorailPiece[x & 0xF][y & 0xF];
 
	return HT_RAIL | _autorail_piece[x & 0xF][y & 0xF];
 
}
 

	
 
/**
 
@@ -2376,7 +2377,7 @@ static void VpStartPreSizing()
 

	
 
/** returns information about the 2x1 piece to be build.
 
 * The lower bits (0-3) are the track type. */
 
static byte Check2x1AutoRail(int mode)
 
static HighLightStyle Check2x1AutoRail(int mode)
 
{
 
	int fxpy = _tile_fract_coords.x + _tile_fract_coords.y;
 
	int sxpy = (_thd.selend.x & 0xF) + (_thd.selend.y & 0xF);
 
@@ -2384,28 +2385,27 @@ static byte Check2x1AutoRail(int mode)
 
	int sxmy = (_thd.selend.x & 0xF) - (_thd.selend.y & 0xF);
 

	
 
	switch (mode) {
 
	case 0: // end piece is lower right
 
		if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
 
		if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return 5; }
 
		return 1;
 

	
 
	case 1:
 
		if (fxmy > 3 && sxmy < -3) { /*SwapSelection(); DoRailroadTrack(0); */return 4; }
 
		if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return 2; }
 
		return 1;
 

	
 
	case 2:
 
		if (fxmy > 3 && sxmy < -3) { /*DoRailroadTrack(3);*/ return 4; }
 
		if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
 
		return 0;
 

	
 
	case 3:
 
		if (fxmy < -3 && sxmy > 3) { /*SwapSelection(); DoRailroadTrack(3);*/ return 5; }
 
		if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return 2; }
 
		return 0;
 
		default: NOT_REACHED();
 
		case 0: // end piece is lower right
 
			if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_HL; }
 
			if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return HT_DIR_VR; }
 
			return HT_DIR_Y;
 

	
 
		case 1:
 
			if (fxmy > 3 && sxmy < -3) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_VL; }
 
			if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return HT_DIR_HU; }
 
			return HT_DIR_Y;
 

	
 
		case 2:
 
			if (fxmy > 3 && sxmy < -3) { /*DoRailroadTrack(3);*/ return HT_DIR_VL; }
 
			if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_HL; }
 
			return HT_DIR_X;
 

	
 
		case 3:
 
			if (fxmy < -3 && sxmy > 3) { /*SwapSelection(); DoRailroadTrack(3);*/ return HT_DIR_VR; }
 
			if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return HT_DIR_HU; }
 
			return HT_DIR_X;
 
	}
 

	
 
	return 0; // avoids compiler warnings
 
}
 

	
 
/** Check if the direction of start and end tile should be swapped based on
 
@@ -2749,7 +2749,7 @@ calc_heightdiff_single_direction:;
 

	
 
				/* If dragging an area (eg dynamite tool) and it is actually a single
 
				 * row/column, change the type to 'line' to get proper calculation for height */
 
				style = _thd.next_drawstyle;
 
				style = (HighLightStyle)_thd.next_drawstyle;
 
				if (style & HT_RECT) {
 
					if (dx == 1) {
 
						style = HT_LINE | HT_DIR_Y;
src/viewport.h
Show inline comments
 
deleted file
src/viewport_func.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file viewport_func.h Functions related to (drawing on) viewports. */
 

	
 
#ifndef VIEWPORT_FUNC_H
 
#define VIEWPORT_FUNC_H
 

	
 
#include "viewport_type.h"
 
#include "vehicle_type.h"
 

	
 
void SetSelectionRed(bool);
 

	
 
void InitViewports();
 
void DeleteWindowViewport(Window *w);
 
void AssignWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
 
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
 
Point GetTileBelowCursor();
 
void UpdateViewportPosition(Window *w);
 

	
 
bool DoZoomInOutWindow(int how, Window *w);
 
void ZoomInOrOutToCursorWindow(bool in, Window * w);
 
Point GetTileZoomCenterWindow(bool in, Window * w);
 
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
 

	
 
static inline void MaxZoomInOut(int how, Window *w)
 
{
 
	while (DoZoomInOutWindow(how, w)) {};
 
}
 

	
 
void OffsetGroundSprite(int x, int y);
 

	
 
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
 
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
 
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0, const SubSprite *sub = NULL);
 
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
 
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
 

	
 

	
 
void StartSpriteCombine();
 
void EndSpriteCombine();
 

	
 
void HandleViewportClicked(const ViewPort *vp, int x, int y);
 
void PlaceObject();
 
void SetRedErrorSquare(TileIndex tile);
 
void SetTileSelectSize(int w, int h);
 
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
 

	
 
Vehicle *CheckMouseOverVehicle();
 

	
 
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
 
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
 
void VpSetPresizeRange(uint from, uint to);
 
void VpSetPlaceSizingLimit(int limit);
 

	
 
typedef void PlaceProc(TileIndex tile);
 
void PlaceProc_DemolishArea(TileIndex tile);
 
void PlaceProc_LevelLand(TileIndex tile);
 
void PlaceProc_BuyLand(TileIndex tile);
 
bool GUIPlaceProcDragXY(const WindowEvent *e);
 

	
 
/* common button handler */
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
 

	
 
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
 

	
 
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
 
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
 

	
 
void ResetObjectToPlace();
 

	
 
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
 

	
 
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
 
bool ScrollMainWindowTo(int x, int y, bool instant = false);
 

	
 
extern PlaceProc *_place_proc;
 
extern Point _tile_fract_coords;
 
extern TileHighlightData _thd;
 

	
 
#endif /* VIEWPORT_FUNC_H */
src/viewport_type.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file viewport_type.h Types related to viewports. */
 

	
 
#ifndef VIEWPORT_TYPE_H
 
#define VIEWPORT_TYPE_H
 

	
 
#include "zoom_type.h"
 
#include "window_type.h"
 
#include "tile_type.h"
 

	
 
struct ViewPort {
 
	int left,top;                       // screen coordinates for the viewport
 
	int width, height;                  // screen width/height for the viewport
 

	
 
	int virtual_left, virtual_top;      // virtual coordinates
 
	int virtual_width, virtual_height;  // these are just width << zoom, height << zoom
 

	
 
	ZoomLevel zoom;
 
};
 

	
 
enum {
 
	ZOOM_IN   = 0,
 
	ZOOM_OUT  = 1,
 
	ZOOM_NONE = 2, // hack, used to update the button status
 
};
 

	
 
/**
 
 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
 
 * z=0..5  Everything that can be built under low bridges.
 
 * z=6     reserved, currently unused.
 
 * z=7     Z separator between bridge/tunnel and the things under/above it.
 
 */
 
enum {
 
	BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height.
 
	BB_Z_SEPARATOR  = 7,        ///< Separates the bridge/tunnel from the things under/above it.
 
};
 

	
 
/** Viewport place method (type of highlighted area and placed objects) */
 
enum ViewportPlaceMethod {
 
	VPM_X_OR_Y          = 0, ///< drag in X or Y direction
 
	VPM_FIX_X           = 1, ///< drag only in X axis
 
	VPM_FIX_Y           = 2, ///< drag only in Y axis
 
	VPM_RAILDIRS        = 3, ///< all rail directions
 
	VPM_X_AND_Y         = 4, ///< area of land in X and Y directions
 
	VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
 
	VPM_SIGNALDIRS      = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
 
};
 

	
 
/** Viewport highlight mode (for highlighting tiles below cursor) */
 
enum ViewportHighlightMode {
 
	VHM_NONE    = 0, ///< default
 
	VHM_RECT    = 1, ///< rectangle (stations, depots, ...)
 
	VHM_POINT   = 2, ///< point (lower land, raise land, level land, ...)
 
	VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
 
	VHM_DRAG    = 4, ///< dragging items in the depot windows
 
	VHM_RAIL    = 5, ///< rail pieces
 
};
 

	
 
/* highlighting draw styles */
 
enum HighLightStyle {
 
	HT_NONE   = 0x00,
 
	HT_RECT   = 0x80,
 
	HT_POINT  = 0x40,
 
	HT_LINE   = 0x20,    ///< used for autorail highlighting (longer streches)
 
	                     ///< (uses lower bits to indicate direction)
 
	HT_RAIL   = 0x10,    ///< autorail (one piece)
 
	                     ///< (uses lower bits to indicate direction)
 
	HT_DRAG_MASK = 0xF0, ///< masks the drag-type
 

	
 
	/* lower bits (used with HT_LINE and HT_RAIL):
 
	 * (see ASCII art in autorail.h for a visual interpretation) */
 
	HT_DIR_X  = 0,    ///< X direction
 
	HT_DIR_Y  = 1,    ///< Y direction
 
	HT_DIR_HU = 2,    ///< horizontal upper
 
	HT_DIR_HL = 3,    ///< horizontal lower
 
	HT_DIR_VL = 4,    ///< vertical left
 
	HT_DIR_VR = 5,    ///< vertical right
 
	HT_DIR_MASK = 0x7 ///< masks the drag-direction
 
};
 
DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
 

	
 

	
 
struct TileHighlightData {
 
	Point size;
 
	Point outersize;
 
	Point pos;
 
	Point offs;
 

	
 
	Point new_pos;
 
	Point new_size;
 
	Point new_outersize;
 

	
 
	Point selend, selstart;
 

	
 
	byte dirty;
 
	byte sizelimit;
 

	
 
	byte drawstyle;      // lower bits 0-3 are reserved for detailed highlight information information
 
	byte new_drawstyle;  // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
 
	byte next_drawstyle; // queued, but not yet drawn style
 

	
 
	ViewportHighlightMode place_mode;
 
	bool make_square_red;
 
	WindowClass window_class;
 
	WindowNumber window_number;
 

	
 
	ViewportPlaceMethod select_method;
 
	byte select_proc;
 

	
 
	TileIndex redsq;
 
};
 

	
 
#endif /* VIEWPORT_TYPE_H */
src/water_cmd.cpp
Show inline comments
 
@@ -12,7 +12,7 @@
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "viewport.h"
 
#include "viewport_func.h"
 
#include "command_func.h"
 
#include "town.h"
 
#include "news.h"
src/widget.cpp
Show inline comments
 
@@ -7,7 +7,7 @@
 
#include "player.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "viewport.h"
 
#include "gfx_func.h"
 
#include "window_gui.h"
 
#include "window_func.h"
 

	
src/window.cpp
Show inline comments
 
@@ -7,8 +7,9 @@
 
#include "openttd.h"
 
#include "debug.h"
 
#include "player.h"
 
#include "viewport.h"
 
#include "gfx_func.h"
 
#include "console.h"
 
#include "viewport_func.h"
 
#include "variables.h"
 
#include "table/sprites.h"
 
#include "genworld.h"
src/window_gui.h
Show inline comments
 
@@ -7,7 +7,7 @@
 

	
 
#include "core/bitmath_func.hpp"
 
#include "vehicle_type.h"
 
#include "viewport.h"
 
#include "viewport_type.h"
 

	
 
/**
 
 * The maximum number of windows that can be opened.
0 comments (0 inline, 0 general)