From 8f0e68285b4eadd1780280d7e36b00ff80c20f67 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 22 Dec 2007 23:30:28 +0000 Subject: (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type. --- src/aircraft_gui.cpp | 1 - src/airport_gui.cpp | 1 - src/blitter/base.hpp | 1 + src/bridge_gui.cpp | 1 - src/build_vehicle_gui.cpp | 1 - src/console.cpp | 1 - src/console_cmds.cpp | 1 + src/core/geometry_type.hpp | 37 +++++++++++++++++++++++++++++++++++++ src/depot_gui.cpp | 1 - src/disaster_cmd.cpp | 1 - src/dock_gui.cpp | 1 - src/economy.cpp | 1 - src/economy_func.h | 1 + src/engine.cpp | 2 +- src/engine_gui.cpp | 1 - src/fontcache.cpp | 1 - src/fontcache.h | 2 ++ src/functions.h | 12 +----------- src/genworld.cpp | 1 - src/genworld_gui.cpp | 1 - src/gfx.cpp | 8 ++++---- src/gfx.h | 27 +++------------------------ src/gfxinit.cpp | 1 - src/graph_gui.cpp | 1 - src/group_gui.cpp | 1 - src/gui.h | 1 + src/heightmap.cpp | 1 - src/industry_gui.cpp | 1 - src/intro_gui.cpp | 1 - src/landscape.h | 2 +- src/main_gui.cpp | 1 - src/misc_cmd.cpp | 1 - src/misc_gui.cpp | 3 +-- src/music_gui.cpp | 1 - src/network/network.h | 3 ++- src/newgrf.cpp | 1 - src/newgrf_gui.cpp | 1 - src/newgrf_station.cpp | 1 + src/news_gui.cpp | 1 - src/oldloader.cpp | 1 + src/openttd.cpp | 1 - src/openttd.h | 26 +++++++++++--------------- src/order_gui.cpp | 1 - src/os2.cpp | 1 - src/player.h | 1 - src/player_gui.cpp | 1 - src/players.cpp | 2 +- src/rail.h | 1 - src/rail_gui.cpp | 1 - src/road_cmd.cpp | 1 - src/road_gui.cpp | 1 - src/saveload.cpp | 1 - src/screenshot.cpp | 1 - src/settings.cpp | 2 -- src/settings_gui.cpp | 1 - src/signs.cpp | 1 + src/signs_gui.cpp | 1 - src/smallmap_gui.cpp | 1 - src/station.cpp | 1 - src/station.h | 1 + src/station_cmd.cpp | 1 - src/station_gui.cpp | 1 - src/subsidy_gui.cpp | 1 - src/terraform_gui.cpp | 1 - src/texteff.cpp | 3 +-- src/town_cmd.cpp | 1 - src/town_gui.cpp | 1 - src/transparency_gui.cpp | 1 - src/variables.h | 3 +-- src/vehicle.cpp | 1 - src/vehicle_gui.cpp | 1 - src/video/sdl_v.cpp | 1 + src/video/win32_v.cpp | 1 + src/viewport.cpp | 1 - src/viewport.h | 10 ++++++++++ src/waypoint.cpp | 2 +- src/widget.cpp | 1 - src/win32.cpp | 1 - src/window.cpp | 1 - 79 files changed, 87 insertions(+), 120 deletions(-) create mode 100644 src/core/geometry_type.hpp diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index 7a3c4e922..426092bcd 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -12,7 +12,6 @@ #include "map.h" #include "gui.h" #include "vehicle.h" -#include "gfx.h" #include "engine.h" #include "viewport.h" #include "player.h" diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 27243468c..a19a3098e 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -12,7 +12,6 @@ #include "gui.h" #include "station_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "command_func.h" #include "vehicle.h" diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp index d9f2a32e1..c9db1d9d4 100644 --- a/src/blitter/base.hpp +++ b/src/blitter/base.hpp @@ -5,6 +5,7 @@ #include "../spritecache.h" #include "../spriteloader/spriteloader.hpp" +#include "../zoom.hpp" enum BlitterMode { BM_NORMAL, diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 68dd674ff..5b0d0c32c 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -10,7 +10,6 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "gfx.h" #include "command_func.h" #include "economy_func.h" #include "sound.h" diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 297559010..83d5d709f 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -15,7 +15,6 @@ #include "gui.h" #include "vehicle.h" #include "articulated_vehicles.h" -#include "gfx.h" #include "textbuf_gui.h" #include "station.h" #include "command_func.h" diff --git a/src/console.cpp b/src/console.cpp index 5e4db8965..7d0efa6dc 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -9,7 +9,6 @@ #include "gui.h" #include "textbuf_gui.h" #include "window_gui.h" -#include "gfx.h" #include "player.h" #include "variables.h" #include "string.h" diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 4368c3c18..8cd8fe41d 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -27,6 +27,7 @@ #include "date.h" #include "network/network.h" #include "strings_func.h" +#include "viewport.h" // ** scriptfile handling ** // static FILE *_script_file; diff --git a/src/core/geometry_type.hpp b/src/core/geometry_type.hpp new file mode 100644 index 000000000..f2759ef4d --- /dev/null +++ b/src/core/geometry_type.hpp @@ -0,0 +1,37 @@ +/* $Id$ */ + +/** @file geometry_type.hpp All geometry types in OpenTTD. */ + +#ifndef GEOMETRY_TYPE_HPP +#define GEOMETRY_TYPE_HPP + +struct Point { + int x; + int y; +}; + +struct Dimension { + int width; + int height; +}; + +struct Rect { + int left; + int top; + int right; + int bottom; +}; + +struct PointDimension { + int x; + int y; + int width; + int height; +}; + +struct Pair { + int a; + int b; +}; + +#endif /* GEOMETRY_TYPE_HPP */ diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index fc35ad3d0..f3a79875b 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -13,7 +13,6 @@ #include "table/sprites.h" #include "gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "vehicle.h" #include "viewport.h" #include "command_func.h" diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index 2b14b4b89..491bcc29c 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -18,7 +18,6 @@ #include "stdafx.h" #include "openttd.h" -#include "gfx.h" #include "landscape.h" #include "industry_map.h" diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index e16254d27..855f39a2d 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -14,7 +14,6 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "command_func.h" #include "variables.h" diff --git a/src/economy.cpp b/src/economy.cpp index 80d56c72e..50bd3de4b 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -14,7 +14,6 @@ #include "player.h" #include "station.h" #include "vehicle.h" -#include "gfx.h" #include "command_func.h" #include "saveload.h" #include "industry.h" diff --git a/src/economy_func.h b/src/economy_func.h index 04d79ac8d..3eb927f9e 100644 --- a/src/economy_func.h +++ b/src/economy_func.h @@ -5,6 +5,7 @@ #ifndef ECONOMY_FUNC_H #define ECONOMY_FUNC_H +#include "core/geometry_type.hpp" #include "economy_type.h" #include "cargo_type.h" #include "vehicle_type.h" diff --git a/src/engine.cpp b/src/engine.cpp index 68786ba2b..dad623593 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -8,7 +8,6 @@ #include "functions.h" #include "table/strings.h" #include "engine.h" -#include "gfx.h" #include "player.h" #include "command_func.h" #include "vehicle.h" @@ -24,6 +23,7 @@ #include "string.h" #include "misc/autoptr.hpp" #include "strings_func.h" +#include "viewport.h" EngineInfo _engine_info[TOTAL_NUM_ENGINES]; RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES]; diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index bf5957ad1..7586c0fb6 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -10,7 +10,6 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "gfx.h" #include "engine.h" #include "command_func.h" #include "economy_func.h" diff --git a/src/fontcache.cpp b/src/fontcache.cpp index e11ae7a40..81f68f0d8 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -9,7 +9,6 @@ #include "table/sprites.h" #include "table/control_codes.h" #include "spritecache.h" -#include "gfx.h" #include "string.h" #include "fontcache.h" #include "helpers.hpp" diff --git a/src/fontcache.h b/src/fontcache.h index b8f450cad..d5f283840 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -3,6 +3,8 @@ #ifndef FONTCACHE_H #define FONTCACHE_H +#include "gfx.h" + /** Get the SpriteID mapped to the given font size and key */ SpriteID GetUnicodeGlyph(FontSize size, uint32 key); diff --git a/src/functions.h b/src/functions.h index c7b758132..c4b42dc45 100644 --- a/src/functions.h +++ b/src/functions.h @@ -5,10 +5,9 @@ #ifndef FUNCTIONS_H #define FUNCTIONS_H -#include "gfx.h" -#include "viewport.h" #include "core/random_func.hpp" #include "command_type.h" +#include "window_type.h" void UpdateTownMaxPass(Town *t); @@ -74,15 +73,6 @@ void InvalidateWindowClassesData(WindowClass cls); void DeleteWindowById(WindowClass cls, WindowNumber number); void DeleteWindowByClass(WindowClass cls); -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); bool EnsureNoVehicleOnGround(TileIndex tile); /** diff --git a/src/genworld.cpp b/src/genworld.cpp index 94d4a6e9b..e97d64bff 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -12,7 +12,6 @@ #include "thread.h" #include "command_func.h" #include "genworld.h" -#include "gfx.h" #include "gfxinit.h" #include "window_func.h" #include "network/network.h" diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index c48fdb8f0..d41ba4251 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -11,7 +11,6 @@ #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "gfxinit.h" #include "player.h" #include "command_func.h" diff --git a/src/gfx.cpp b/src/gfx.cpp index d5c4d5a75..66043eec4 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -5,9 +5,9 @@ #include "stdafx.h" #include "openttd.h" #include "functions.h" +#include "gfx.h" #include "spritecache.h" #include "string.h" -#include "gfx.h" #include "table/palettes.h" #include "table/sprites.h" #include "variables.h" @@ -514,16 +514,16 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh) } /** Return the string dimension in pixels. The height and width are returned - * in a single BoundingRect value. TINYFONT, BIGFONT modifiers are only + * in a single Dimension value. TINYFONT, BIGFONT modifiers are only * supported as the first character of the string. The returned dimensions * are therefore a rough estimation correct for all the current strings * but not every possible combination * @param str string to calculate pixel-width * @return string width and height in pixels */ -BoundingRect GetStringBoundingBox(const char *str) +Dimension GetStringBoundingBox(const char *str) { FontSize size = _cur_fontsize; - BoundingRect br; + Dimension br; int max_width; WChar c; diff --git a/src/gfx.h b/src/gfx.h index a09553c8e..a06a00d30 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -37,6 +37,8 @@ #include "openttd.h" #include "core/math_func.hpp" +#include "core/geometry_type.hpp" +#include "core/enum_type.hpp" #include "zoom.hpp" enum WindowKeyCodes { @@ -125,26 +127,10 @@ enum WindowKeyCodes { WKC_MINUS = 153, ///< - Minus }; -enum GameModes { - GM_MENU, - GM_NORMAL, - GM_EDITOR -}; - void GameLoop(); void CreateConsole(); -typedef int32 CursorID; - -struct Point { - int x, y; -}; - -struct Rect { - int left,top,right,bottom; -}; - /** A single sprite of a list of animated cursors */ struct AnimCursor { static const CursorID LAST = MAX_UVALUE(CursorID); @@ -203,10 +189,6 @@ extern bool _right_button_down; extern bool _right_button_clicked; extern DrawPixelInfo _screen; -extern bool _exit_game; -extern bool _networking; ///< are we in networking mode? -extern byte _game_mode; -extern byte _pause_game; extern int _pal_first_dirty; extern int _pal_count_dirty; @@ -229,15 +211,12 @@ void HandleExitGameRequest(); void GameSizeChanged(); void UndrawMouseCursor(); -#include "helpers.hpp" - enum FontSize { FS_NORMAL, FS_SMALL, FS_LARGE, FS_END, }; - DECLARE_POSTFIX_INCREMENT(FontSize); void RedrawScreenRect(int left, int top, int right, int bottom); @@ -281,7 +260,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int color); void GfxDrawLine(int left, int top, int right, int bottom, int color); void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3); -BoundingRect GetStringBoundingBox(const char *str); +Dimension GetStringBoundingBox(const char *str); uint32 FormatStringLinebreaks(char *str, int maxw); void LoadStringWidthTable(); void DrawStringMultiCenter(int x, int y, StringID str, int maxw); diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 8adc256c2..a6694dece 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -6,7 +6,6 @@ #include "openttd.h" #include "debug.h" #include "functions.h" -#include "gfx.h" #include "gfxinit.h" #include "spritecache.h" #include "table/sprites.h" diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 3413bd0ce..9b186b127 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -9,7 +9,6 @@ #include "functions.h" #include "gui.h" #include "window_gui.h" -#include "gfx.h" #include "player.h" #include "economy_func.h" #include "variables.h" diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 178b4f835..ca655ee75 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -10,7 +10,6 @@ #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "vehicle.h" #include "command_func.h" #include "engine.h" diff --git a/src/gui.h b/src/gui.h index db9e339a6..ad02b2ef5 100644 --- a/src/gui.h +++ b/src/gui.h @@ -7,6 +7,7 @@ #include "string.h" #include "window_type.h" +#include "vehicle_type.h" #include "gfx.h" /* main_gui.cpp */ diff --git a/src/heightmap.cpp b/src/heightmap.cpp index 360127dc5..b6a62edb4 100644 --- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -11,7 +11,6 @@ #include "table/strings.h" #include "void_map.h" #include "debug.h" -#include "gfx.h" #include "gui.h" #include "saveload.h" #include "bmp.h" diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 93061569f..1ca817d26 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -12,7 +12,6 @@ #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "command_func.h" #include "viewport.h" #include "industry.h" diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 220299238..4a20a5725 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -10,7 +10,6 @@ #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "player.h" #include "network/network.h" #include "variables.h" diff --git a/src/landscape.h b/src/landscape.h index 8324fc129..7df408753 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -5,7 +5,7 @@ #ifndef LANDSCAPE_H #define LANDSCAPE_H -#include "gfx.h" +#include "core/geometry_type.hpp" enum { SNOW_LINE_MONTHS = 12, diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 6fafc8ebe..d511d197c 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -17,7 +17,6 @@ #include "window_func.h" #include "textbuf_gui.h" #include "viewport.h" -#include "gfx.h" #include "player.h" #include "command_func.h" #include "news.h" diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 0d045d752..2128a6f32 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -10,7 +10,6 @@ #include "command_func.h" #include "economy_func.h" #include "player.h" -#include "gfx.h" #include "gui.h" #include "window_func.h" #include "textbuf_gui.h" diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index b3b9dcbcb..94fb1ce25 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -21,7 +21,6 @@ #include "station_gui.h" #include "textbuf_gui.h" #include "viewport.h" -#include "gfx.h" #include "station.h" #include "command_func.h" #include "player.h" @@ -728,7 +727,7 @@ static void TooltipsWndProc(Window *w, WindowEvent *e) void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]) { char buffer[512]; - BoundingRect br; + Dimension br; Window *w; uint i; int x, y; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 0cdd9ce85..e920afee2 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -8,7 +8,6 @@ #include "table/sprites.h" #include "functions.h" #include "fileio.h" -#include "gfx.h" #include "sound.h" #include "variables.h" #include "music.h" diff --git a/src/network/network.h b/src/network/network.h index 2017d6b47..d2a18749b 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -216,6 +216,7 @@ void NetworkDisconnect(); bool IsNetworkCompatibleVersion(const char *version); +extern bool _networking; ///< are we in networking mode? VARDEF bool _network_server; ///< network-server is active VARDEF bool _network_available; ///< is network mode available? VARDEF bool _network_dedicated; ///< are we a dedicated server? @@ -235,7 +236,7 @@ static inline void NetworkShutDown() {} #endif /* ENABLE_NETWORK */ -/* Thss variable must always be registered! */ +/* This variable must always be registered! */ VARDEF PlayerID _network_playas; ///< an id to play as.. (see players.h:Players) #endif /* NETWORK_H */ diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 99073c4aa..2520e6c01 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -8,7 +8,6 @@ #include "openttd.h" #include "debug.h" -#include "gfx.h" #include "fileio.h" #include "functions.h" #include "engine.h" diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index d99c23d0c..84532927d 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -6,7 +6,6 @@ #include "openttd.h" #include "functions.h" #include "variables.h" -#include "gfx.h" #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 790e5e8dc..d0167c71b 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -23,6 +23,7 @@ #include "cargotype.h" #include "town_map.h" #include "newgrf_town.h" +#include "gfx.h" static StationClass station_classes[STAT_CLASS_MAX]; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 246f86120..5a3382426 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -9,7 +9,6 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "gfx.h" #include "news.h" #include "vehicle.h" #include "sound.h" diff --git a/src/oldloader.cpp b/src/oldloader.cpp index f1c25a5bd..ba0ab6112 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -24,6 +24,7 @@ #include "newgrf_config.h" #include "ai/ai.h" #include "date.h" +#include "zoom.hpp" enum { HEADER_SIZE = 49, diff --git a/src/openttd.cpp b/src/openttd.cpp index 1f020c9f8..cac5b908b 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -17,7 +17,6 @@ #include "functions.h" #include "mixer.h" #include "spritecache.h" -#include "gfx.h" #include "gfxinit.h" #include "gui.h" #include "landscape.h" diff --git a/src/openttd.h b/src/openttd.h index 664a0b72c..7ad6de5b9 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -11,21 +11,6 @@ #include "helpers.hpp" #include "strings_type.h" -struct Oblong { - int x, y; - int width, height; -}; - -struct BoundingRect { - int width; - int height; -}; - -struct Pair { - int a; - int b; -}; - #include "map.h" #include "slope_type.h" @@ -46,6 +31,7 @@ struct PalSpriteID { SpriteID sprite; SpriteID pal; }; +typedef int32 CursorID; typedef uint16 EngineID; typedef uint16 UnitID; @@ -83,6 +69,12 @@ typedef int32 Date; typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h +enum GameModes { + GM_MENU, + GM_NORMAL, + GM_EDITOR +}; + enum SwitchModes { SM_NONE = 0, SM_NEWGAME = 1, @@ -282,4 +274,8 @@ enum ThreadMsg { void OTTD_SendThreadMessage(ThreadMsg msg); +extern byte _game_mode; +extern bool _exit_game; +extern byte _pause_game; + #endif /* OPENTTD_H */ diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 2fe6beca4..2f9852383 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -12,7 +12,6 @@ #include "map.h" #include "gui.h" #include "window_gui.h" -#include "gfx.h" #include "vehicle.h" #include "station.h" #include "town.h" diff --git a/src/os2.cpp b/src/os2.cpp index bee04cea7..4763d7c1d 100644 --- a/src/os2.cpp +++ b/src/os2.cpp @@ -7,7 +7,6 @@ #include "variables.h" #include "string.h" #include "table/strings.h" -#include "gfx.h" #include "gui.h" #include "functions.h" #include "fileio.h" diff --git a/src/player.h b/src/player.h index 83fd5f7fa..f14d2e8d7 100644 --- a/src/player.h +++ b/src/player.h @@ -14,7 +14,6 @@ #include "engine.h" #include "livery.h" #include "genworld.h" -#include "gfx.h" struct PlayerEconomyEntry { Money income; diff --git a/src/player_gui.cpp b/src/player_gui.cpp index 0043ef201..9d36fb307 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -11,7 +11,6 @@ #include "window_gui.h" #include "textbuf_gui.h" #include "viewport.h" -#include "gfx.h" #include "player.h" #include "command_func.h" #include "vehicle.h" diff --git a/src/players.cpp b/src/players.cpp index 7556d8639..b54ef6a6c 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -14,7 +14,6 @@ #include "town.h" #include "vehicle.h" #include "station.h" -#include "gfx.h" #include "news.h" #include "saveload.h" #include "command_func.h" @@ -30,6 +29,7 @@ #include "window_func.h" #include "tile_map.h" #include "strings_func.h" +#include "gfx.h" /** * Sets the local player and updates the patch settings that are set on a diff --git a/src/rail.h b/src/rail.h index ccc6c7857..bffda08e7 100644 --- a/src/rail.h +++ b/src/rail.h @@ -5,7 +5,6 @@ #ifndef RAIL_H #define RAIL_H -#include "gfx.h" #include "rail_type.h" #include "track_type.h" #include "vehicle_type.h" diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 43519e0f6..8ffcddc2b 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -15,7 +15,6 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "command_func.h" #include "vehicle.h" diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 5e2546d08..66a2041e6 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -22,7 +22,6 @@ #include "command_func.h" #include "player.h" #include "town.h" -#include "gfx.h" #include "sound.h" #include "yapf/yapf.h" #include "depot.h" diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 14d4e7313..bdd852d72 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -12,7 +12,6 @@ #include "window_gui.h" #include "station_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "command_func.h" #include "variables.h" diff --git a/src/saveload.cpp b/src/saveload.cpp index bbf9dda06..73e688701 100644 --- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -1100,7 +1100,6 @@ static void UninitNoComp() ********************************************/ #include "table/sprites.h" -#include "gfx.h" #include "gui.h" struct ThreadedSave { diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 0bef9135f..f88c3b528 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -5,7 +5,6 @@ #include "debug.h" #include "functions.h" #include "table/strings.h" -#include "gfx.h" #include "fileio.h" #include "viewport.h" #include "player.h" diff --git a/src/settings.cpp b/src/settings.cpp index f5541cded..c7396f76c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -45,7 +45,6 @@ #include "window_func.h" #include "strings_func.h" #ifdef WITH_FREETYPE -#include "gfx.h" #include "fontcache.h" #endif #include "spritecache.h" @@ -1087,7 +1086,6 @@ static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list /* Begin - Callback Functions for the various settings */ #include "gui.h" #include "town.h" -#include "gfx.h" /* virtual PositionMainToolbar function, calls the right one.*/ static int32 v_PositionMainToolbar(int32 p1) { diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 270f04add..175939d20 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -12,7 +12,6 @@ #include "gui.h" #include "window_gui.h" #include "textbuf_gui.h" -#include "gfx.h" #include "command_func.h" #include "engine.h" #include "screenshot.h" diff --git a/src/signs.cpp b/src/signs.cpp index dcaf4499d..4ea465fb4 100644 --- a/src/signs.cpp +++ b/src/signs.cpp @@ -15,6 +15,7 @@ #include "string.h" #include "misc/autoptr.hpp" #include "strings_func.h" +#include "viewport.h" SignID _new_sign_id; uint _total_signs; diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 34d808eb1..c816b809b 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -10,7 +10,6 @@ #include "gui.h" #include "textbuf_gui.h" #include "window_gui.h" -#include "gfx.h" #include "player.h" #include "signs.h" #include "debug.h" diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 1371dd84b..a5ba7d205 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -18,7 +18,6 @@ #include "window_gui.h" #include "tree_map.h" #include "tunnel_map.h" -#include "gfx.h" #include "viewport.h" #include "player.h" #include "vehicle.h" diff --git a/src/station.cpp b/src/station.cpp index 9fba56656..f9c56b7dd 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -12,7 +12,6 @@ #include "table/strings.h" #include "map.h" #include "station.h" -#include "gfx.h" #include "viewport.h" #include "town.h" #include "vehicle.h" diff --git a/src/station.h b/src/station.h index 62a7c69c4..000dbd22c 100644 --- a/src/station.h +++ b/src/station.h @@ -13,6 +13,7 @@ #include "newgrf_station.h" #include "cargopacket.h" #include "cargo_type.h" +#include "core/geometry_type.hpp" #include #include diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index ba31f9243..899aab80a 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -16,7 +16,6 @@ #include "table/strings.h" #include "map.h" #include "station.h" -#include "gfx.h" #include "viewport.h" #include "command_func.h" #include "town.h" diff --git a/src/station_gui.cpp b/src/station_gui.cpp index ffdd78db5..e4378eac8 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -11,7 +11,6 @@ #include "window_gui.h" #include "textbuf_gui.h" #include "station.h" -#include "gfx.h" #include "player.h" #include "economy_func.h" #include "town.h" diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index ddbdc871a..847b43018 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -10,7 +10,6 @@ #include "industry.h" #include "town.h" #include "player.h" -#include "gfx.h" #include "economy_func.h" #include "variables.h" #include "date.h" diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 55d923f2b..19a8b1fd1 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -13,7 +13,6 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "command_func.h" #include "vehicle.h" diff --git a/src/texteff.cpp b/src/texteff.cpp index 447a6c2a5..c5a33ca72 100644 --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -6,7 +6,6 @@ #include "openttd.h" #include "functions.h" #include "tile_cmd.h" -#include "gfx.h" #include "landscape.h" #include "viewport.h" #include "saveload.h" @@ -58,7 +57,7 @@ static bool _chatmessage_visible = false; /* The chatbox grows from the bottom so the coordinates are pixels from * the left and pixels from the bottom. The height is the maximum height */ -static const Oblong _chatmsg_box = {10, 30, 500, 150}; +static const PointDimension _chatmsg_box = {10, 30, 500, 150}; static uint8 _chatmessage_backup[150 * 500 * 6]; // (height * width) static inline uint GetChatMessageCount() diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index fdf715f0f..ccd4c723c 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -17,7 +17,6 @@ #include "viewport.h" #include "town.h" #include "command_func.h" -#include "gfx.h" #include "industry.h" #include "station.h" #include "vehicle.h" diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 5e67d6a91..1f74d79cd 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -9,7 +9,6 @@ #include "table/sprites.h" #include "table/strings.h" #include "town.h" -#include "gfx.h" #include "viewport.h" #include "gui.h" #include "window_gui.h" diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index ddbe4cde1..add27c2f4 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -8,7 +8,6 @@ #include "gui.h" #include "window_gui.h" #include "viewport.h" -#include "gfx.h" #include "sound.h" #include "variables.h" #include "transparency.h" diff --git a/src/variables.h b/src/variables.h index f21afc024..079c01c1c 100644 --- a/src/variables.h +++ b/src/variables.h @@ -6,11 +6,10 @@ #define VARIABLES_H #include "yapf/yapf_settings.h" +#include "openttd.h" /* ********* START OF SAVE REGION */ -#include "gfx.h" - struct GameOptions { GameDifficulty diff; byte diff_level; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 0c9dfabd3..8cd999bf9 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -15,7 +15,6 @@ #include "map.h" #include "vehicle.h" #include "timetable.h" -#include "gfx.h" #include "viewport.h" #include "news.h" #include "command_func.h" diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index af161fb82..3c1613212 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -16,7 +16,6 @@ #include "window_gui.h" #include "textbuf_gui.h" #include "command_func.h" -#include "gfx.h" #include "variables.h" #include "vehicle_gui.h" #include "viewport.h" diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 8b3c4adbb..9d4a7986a 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -11,6 +11,7 @@ #include "../sdl.h" #include "../variables.h" #include "../blitter/factory.hpp" +#include "../network/network.h" #include "sdl_v.h" #include diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index ab6dbab75..1fc344fac 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -7,6 +7,7 @@ #include "../variables.h" #include "../win32.h" #include "../blitter/factory.hpp" +#include "../network/network.h" #include "win32_v.h" #include #include diff --git a/src/viewport.cpp b/src/viewport.cpp index f02ee112e..b3a7e7d20 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -15,7 +15,6 @@ #include "viewport.h" #include "vehicle.h" #include "station.h" -#include "gfx.h" #include "town.h" #include "signs.h" #include "waypoint.h" diff --git a/src/viewport.h b/src/viewport.h index 08ef26744..451c0a42d 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -168,4 +168,14 @@ extern TileHighlightData _thd; 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); + #endif /* VIEWPORT_H */ diff --git a/src/waypoint.cpp b/src/waypoint.cpp index ca824e9e3..dbe2cd07c 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -7,7 +7,6 @@ #include "command_func.h" #include "functions.h" -#include "gfx.h" #include "landscape.h" #include "map.h" #include "order.h" @@ -26,6 +25,7 @@ #include "string.h" #include "misc/autoptr.hpp" #include "strings_func.h" +#include "viewport.h" enum { MAX_WAYPOINTS_PER_TOWN = 64, diff --git a/src/widget.cpp b/src/widget.cpp index a1a62d127..2d7c9ad2c 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -8,7 +8,6 @@ #include "player.h" #include "table/sprites.h" #include "table/strings.h" -#include "gfx.h" #include "viewport.h" #include "window_gui.h" diff --git a/src/win32.cpp b/src/win32.cpp index 4b378910f..52eb11670 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -9,7 +9,6 @@ #include "helpers.hpp" #include "saveload.h" #include "string.h" -#include "gfx.h" #include "textbuf_gui.h" #include "fileio.h" #include diff --git a/src/window.cpp b/src/window.cpp index 5f05dfe89..6df6609c4 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -9,7 +9,6 @@ #include "functions.h" #include "map.h" #include "player.h" -#include "gfx.h" #include "viewport.h" #include "console.h" #include "variables.h" -- cgit v1.2.3-70-g09d2