# HG changeset patch # User Rubidium # Date 2023-05-07 19:54:36 # Node ID 895ef9174a75f1a811586fcceec42ce46ae48f1c # Parent 08934aac09a591fadacfccdc2e8f24787ac1fe57 Change: include fmt.h C++ headers in stdafx.h This to prevent compilation issues between runs with and without precompiled headers. Also remove the headers from the rest of the code base as they are not needed there anymore, although they do relatively little harm. diff --git a/src/base_consist.h b/src/base_consist.h --- a/src/base_consist.h +++ b/src/base_consist.h @@ -12,7 +12,6 @@ #include "order_type.h" #include "timer/timer_game_calendar.h" -#include /** Various front vehicle properties that are preserved when autoreplacing, using order-backup or switching front engines within a consist. */ struct BaseConsist { diff --git a/src/bitmap_type.h b/src/bitmap_type.h --- a/src/bitmap_type.h +++ b/src/bitmap_type.h @@ -10,7 +10,6 @@ #ifndef BITMAP_TYPE_HPP #define BITMAP_TYPE_HPP -#include /** Represents a tile area containing containing individually set tiles. * Each tile must be contained within the preallocated area. diff --git a/src/cargotype.h b/src/cargotype.h --- a/src/cargotype.h +++ b/src/cargotype.h @@ -17,7 +17,6 @@ #include "landscape_type.h" #include "core/bitmath_func.hpp" #include "core/span_type.hpp" -#include /** Globally unique label of a cargo type. */ typedef uint32 CargoLabel; diff --git a/src/command_type.h b/src/command_type.h --- a/src/command_type.h +++ b/src/command_type.h @@ -13,7 +13,6 @@ #include "economy_type.h" #include "strings_type.h" #include "tile_type.h" -#include struct GRFFile; diff --git a/src/company_base.h b/src/company_base.h --- a/src/company_base.h +++ b/src/company_base.h @@ -17,7 +17,6 @@ #include "timer/timer_game_calendar.h" #include "settings_type.h" #include "group.h" -#include #include /** Statistics about the economy. */ diff --git a/src/console_gui.cpp b/src/console_gui.cpp --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -23,7 +23,6 @@ #include "timer/timer.h" #include "timer/timer_window.h" #include -#include #include "widgets/console_widget.h" diff --git a/src/core/kdtree.hpp b/src/core/kdtree.hpp --- a/src/core/kdtree.hpp +++ b/src/core/kdtree.hpp @@ -11,8 +11,6 @@ #define KDTREE_HPP #include "../stdafx.h" -#include -#include /** * K-dimensional tree, specialised for 2-dimensional space. diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -10,8 +10,6 @@ #ifndef MATH_FUNC_HPP #define MATH_FUNC_HPP -#include -#include /** * Returns the absolute value of (scalar) variable. diff --git a/src/core/overflowsafe_type.hpp b/src/core/overflowsafe_type.hpp --- a/src/core/overflowsafe_type.hpp +++ b/src/core/overflowsafe_type.hpp @@ -12,7 +12,6 @@ #include "math_func.hpp" -#include #ifdef __has_builtin # if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow) && __has_builtin(__builtin_mul_overflow) diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -11,7 +11,6 @@ #define SMALLVEC_TYPE_HPP #include "mem_func.hpp" -#include /** * Helper function to append an item to a vector if it is not already contained diff --git a/src/dedicated.cpp b/src/dedicated.cpp --- a/src/dedicated.cpp +++ b/src/dedicated.cpp @@ -10,7 +10,6 @@ #include "stdafx.h" #include "fileio_func.h" #include "debug.h" -#include std::string _log_file; ///< File to reroute output of a forked OpenTTD to std::unique_ptr _log_fd; ///< File to reroute output of a forked OpenTTD to diff --git a/src/driver.cpp b/src/driver.cpp --- a/src/driver.cpp +++ b/src/driver.cpp @@ -16,7 +16,6 @@ #include "video/video_driver.hpp" #include "string_func.h" #include "table/strings.h" -#include #include #include "safeguards.h" diff --git a/src/fileio_func.h b/src/fileio_func.h --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -12,8 +12,6 @@ #include "core/enum_type.hpp" #include "fileio_type.h" -#include -#include void FioFCloseFile(FILE *f); FILE *FioFOpenFile(const std::string &filename, const char *mode, Subdirectory subdir, size_t *filesize = nullptr); diff --git a/src/fios.cpp b/src/fios.cpp --- a/src/fios.cpp +++ b/src/fios.cpp @@ -20,8 +20,6 @@ #include "strings_func.h" #include "tar_type.h" #include -#include -#include #include #ifndef _WIN32 diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -29,7 +29,6 @@ #include #include -#include #include "safeguards.h" diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -22,7 +22,6 @@ #include "table/strgen_tables.h" #include -#include #include "../safeguards.h" diff --git a/src/gamelog.h b/src/gamelog.h --- a/src/gamelog.h +++ b/src/gamelog.h @@ -10,7 +10,6 @@ #ifndef GAMELOG_H #define GAMELOG_H -#include #include "newgrf_config.h" /** The actions we log. */ diff --git a/src/gfx_layout.h b/src/gfx_layout.h --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -15,11 +15,8 @@ #include "core/smallmap_type.hpp" #include -#include #include #include -#include -#include /** * Text drawing parameters, which can change while drawing a line, but are kept between multiple parts diff --git a/src/group.h b/src/group.h --- a/src/group.h +++ b/src/group.h @@ -16,7 +16,6 @@ #include "vehicle_type.h" #include "engine_type.h" #include "livery.h" -#include typedef Pool GroupPool; extern GroupPool _group_pool; ///< Pool of groups. diff --git a/src/industrytype.h b/src/industrytype.h --- a/src/industrytype.h +++ b/src/industrytype.h @@ -11,7 +11,6 @@ #define INDUSTRYTYPE_H #include -#include #include "map_type.h" #include "slope_type.h" #include "industry_type.h" diff --git a/src/ini_type.h b/src/ini_type.h --- a/src/ini_type.h +++ b/src/ini_type.h @@ -11,8 +11,6 @@ #define INI_TYPE_H #include "fileio_type.h" -#include -#include /** Types of groups */ enum IniGroupType { diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -16,7 +16,6 @@ #include "../window_gui.h" #include "linkgraph_base.h" #include -#include /** * Monthly statistics for a link between two stations. diff --git a/src/linkgraph/mcf.h b/src/linkgraph/mcf.h --- a/src/linkgraph/mcf.h +++ b/src/linkgraph/mcf.h @@ -4,7 +4,6 @@ #define MCF_H #include "linkgraphjob_base.h" -#include typedef std::vector PathVector; diff --git a/src/linkgraph/refresh.h b/src/linkgraph/refresh.h --- a/src/linkgraph/refresh.h +++ b/src/linkgraph/refresh.h @@ -12,7 +12,6 @@ #include "../cargo_type.h" #include "../vehicle_base.h" -#include #include #include diff --git a/src/misc/dbg_helpers.h b/src/misc/dbg_helpers.h --- a/src/misc/dbg_helpers.h +++ b/src/misc/dbg_helpers.h @@ -12,7 +12,6 @@ #include #include -#include #include "../direction_type.h" #include "../signal_type.h" diff --git a/src/misc/endian_buffer.hpp b/src/misc/endian_buffer.hpp --- a/src/misc/endian_buffer.hpp +++ b/src/misc/endian_buffer.hpp @@ -10,7 +10,6 @@ #ifndef ENDIAN_BUFFER_HPP #define ENDIAN_BUFFER_HPP -#include #include #include "../core/span_type.hpp" #include "../core/bitmath_func.hpp" diff --git a/src/misc/lrucache.hpp b/src/misc/lrucache.hpp --- a/src/misc/lrucache.hpp +++ b/src/misc/lrucache.hpp @@ -12,9 +12,7 @@ #include #include -#include #include -#include /** * Size limited cache with a least recently used eviction strategy. diff --git a/src/music/midifile.hpp b/src/music/midifile.hpp --- a/src/music/midifile.hpp +++ b/src/music/midifile.hpp @@ -13,8 +13,6 @@ #include "../stdafx.h" #include "../core/smallvec_type.hpp" #include "midi.h" -#include -#include struct MusicSongInfo; diff --git a/src/music_gui.cpp b/src/music_gui.cpp --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -8,7 +8,6 @@ /** @file music_gui.cpp GUI for the music playback. */ #include "stdafx.h" -#include #include "openttd.h" #include "base_media_base.h" #include "music/music_driver.hpp" diff --git a/src/network/core/address.h b/src/network/core/address.h --- a/src/network/core/address.h +++ b/src/network/core/address.h @@ -16,7 +16,6 @@ #include "../../string_func.h" #include "../../core/smallmap_type.hpp" -#include class NetworkAddress; typedef std::vector NetworkAddressList; ///< Type for a list of addresses. diff --git a/src/network/core/config.cpp b/src/network/core/config.cpp --- a/src/network/core/config.cpp +++ b/src/network/core/config.cpp @@ -11,7 +11,6 @@ #include "../../stdafx.h" -#include #include "../../string_func.h" #include "../../safeguards.h" diff --git a/src/network/core/http_curl.cpp b/src/network/core/http_curl.cpp --- a/src/network/core/http_curl.cpp +++ b/src/network/core/http_curl.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/src/network/core/packet.h b/src/network/core/packet.h --- a/src/network/core/packet.h +++ b/src/network/core/packet.h @@ -16,8 +16,6 @@ #include "config.h" #include "core.h" #include "../../string_type.h" -#include -#include typedef uint16 PacketSize; ///< Size of the whole packet. typedef uint8 PacketType; ///< Identifier for the packet diff --git a/src/network/core/tcp_content_type.h b/src/network/core/tcp_content_type.h --- a/src/network/core/tcp_content_type.h +++ b/src/network/core/tcp_content_type.h @@ -12,8 +12,6 @@ #ifndef NETWORK_CORE_TCP_CONTENT_TYPE_H #define NETWORK_CORE_TCP_CONTENT_TYPE_H -#include - /** The values in the enum are important; they are used as database 'keys' */ enum ContentType { CONTENT_TYPE_BEGIN = 1, ///< Helper to mark the begin of the types diff --git a/src/newgrf_class.h b/src/newgrf_class.h --- a/src/newgrf_class.h +++ b/src/newgrf_class.h @@ -12,7 +12,6 @@ #include "strings_type.h" -#include /** * Struct containing information relating to NewGRF classes for stations and airports. diff --git a/src/newgrf_config.h b/src/newgrf_config.h --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -17,7 +17,6 @@ #include "fileio_type.h" #include "textfile_type.h" #include "newgrf_text.h" -#include /** GRF config bit flags */ enum GCF_Flags { diff --git a/src/newgrf_profiling.h b/src/newgrf_profiling.h --- a/src/newgrf_profiling.h +++ b/src/newgrf_profiling.h @@ -17,9 +17,6 @@ #include "newgrf_callbacks.h" #include "newgrf_spritegroup.h" -#include -#include -#include /** * Callback profiler for NewGRF development diff --git a/src/newgrf_text.h b/src/newgrf_text.h --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -15,8 +15,6 @@ #include "core/smallvec_type.hpp" #include "table/control_codes.h" #include -#include -#include /** This character, the thorn ('รพ'), indicates a unicode string to NFO. */ static const WChar NFO_UTF8_IDENTIFIER = 0x00DE; diff --git a/src/newgrf_townname.h b/src/newgrf_townname.h --- a/src/newgrf_townname.h +++ b/src/newgrf_townname.h @@ -13,7 +13,6 @@ #ifndef NEWGRF_TOWNNAME_H #define NEWGRF_TOWNNAME_H -#include #include "strings_type.h" struct NamePart { diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -18,7 +18,6 @@ #include "../../strings_func.h" #include "../../zoom_func.h" #include "macos.h" -#include #include "../../table/control_codes.h" diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -15,7 +15,6 @@ #include "../../fontcache.h" #include "../../zoom_func.h" #include "macos.h" -#include #include diff --git a/src/os/macosx/string_osx.h b/src/os/macosx/string_osx.h --- a/src/os/macosx/string_osx.h +++ b/src/os/macosx/string_osx.h @@ -12,7 +12,6 @@ #include "../../gfx_layout.h" #include "../../string_base.h" -#include /** String iterator using CoreText as a backend. */ class OSXStringIterator : public StringIterator { diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp --- a/src/os/windows/string_uniscribe.cpp +++ b/src/os/windows/string_uniscribe.cpp @@ -16,7 +16,6 @@ #include "../../table/control_codes.h" #include "../../zoom_func.h" #include "win32.h" -#include #include #include diff --git a/src/os/windows/string_uniscribe.h b/src/os/windows/string_uniscribe.h --- a/src/os/windows/string_uniscribe.h +++ b/src/os/windows/string_uniscribe.h @@ -12,7 +12,6 @@ #include "../../gfx_layout.h" #include "../../string_base.h" -#include void UniscribeResetScriptCache(FontSize size); diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -10,7 +10,6 @@ #ifndef YAPF_COSTRAIL_HPP #define YAPF_COSTRAIL_HPP -#include #include "../../pbs.h" diff --git a/src/random_access_file_type.h b/src/random_access_file_type.h --- a/src/random_access_file_type.h +++ b/src/random_access_file_type.h @@ -11,7 +11,6 @@ #define RANDOM_ACCESS_FILE_TYPE_H #include "fileio_type.h" -#include /** * A file from which bytes, words and double words are read in (potentially) a random order. diff --git a/src/road.h b/src/road.h --- a/src/road.h +++ b/src/road.h @@ -19,7 +19,6 @@ #include "newgrf.h" #include "economy_func.h" -#include enum RoadTramType : bool { RTT_ROAD, diff --git a/src/saveload/engine_sl.cpp b/src/saveload/engine_sl.cpp --- a/src/saveload/engine_sl.cpp +++ b/src/saveload/engine_sl.cpp @@ -15,7 +15,6 @@ #include "saveload_internal.h" #include "../engine_base.h" #include "../string_func.h" -#include #include "../safeguards.h" diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -19,7 +19,6 @@ #include "saveload_internal.h" #include "oldloader.h" -#include #include "../safeguards.h" diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -44,8 +44,6 @@ #include "../error.h" #include #include -#include -#include #ifdef __EMSCRIPTEN__ # include #endif diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -14,9 +14,6 @@ #include "../fileio_type.h" #include "../fios.h" #include "../core/span_type.hpp" -#include -#include -#include /** SaveLoad versions * Previous savegame versions, the trunk revision where they were diff --git a/src/script/api/script_admin.hpp b/src/script/api/script_admin.hpp --- a/src/script/api/script_admin.hpp +++ b/src/script/api/script_admin.hpp @@ -10,7 +10,6 @@ #ifndef SCRIPT_ADMIN_HPP #define SCRIPT_ADMIN_HPP -#include #include "script_object.hpp" /** diff --git a/src/script/api/script_priorityqueue.hpp b/src/script/api/script_priorityqueue.hpp --- a/src/script/api/script_priorityqueue.hpp +++ b/src/script/api/script_priorityqueue.hpp @@ -13,7 +13,6 @@ #include "script_object.hpp" #include -#include /** * Class that creates a queue which keeps its items ordered by an item priority. diff --git a/src/script/script_storage.hpp b/src/script/script_storage.hpp --- a/src/script/script_storage.hpp +++ b/src/script/script_storage.hpp @@ -20,7 +20,6 @@ #include "script_log_types.hpp" #include "table/strings.h" -#include /** * The callback function for Mode-classes. diff --git a/src/script/squirrel_helper_type.hpp b/src/script/squirrel_helper_type.hpp --- a/src/script/squirrel_helper_type.hpp +++ b/src/script/squirrel_helper_type.hpp @@ -10,7 +10,6 @@ #ifndef SQUIRREL_HELPER_TYPE_HPP #define SQUIRREL_HELPER_TYPE_HPP -#include /** Definition of a simple array. */ template diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -42,8 +42,6 @@ #include "gui.h" #include "mixer.h" -#include -#include #include "safeguards.h" #include "video/video_driver.hpp" diff --git a/src/signs_base.h b/src/signs_base.h --- a/src/signs_base.h +++ b/src/signs_base.h @@ -14,7 +14,6 @@ #include "viewport_type.h" #include "core/pool_type.hpp" #include "company_type.h" -#include typedef Pool SignPool; extern SignPool _sign_pool; diff --git a/src/station_gui.cpp b/src/station_gui.cpp --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -38,7 +38,6 @@ #include "table/strings.h" #include -#include #include "safeguards.h" diff --git a/src/station_gui.h b/src/station_gui.h --- a/src/station_gui.h +++ b/src/station_gui.h @@ -14,7 +14,6 @@ #include "tilearea_type.h" #include "window_type.h" #include "station_type.h" -#include /** Types of cargo to display for station coverage. */ diff --git a/src/stdafx.h b/src/stdafx.h --- a/src/stdafx.h +++ b/src/stdafx.h @@ -53,15 +53,28 @@ #endif #include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include #include -#include -#include +#include +#include +#include +#include +#include #include +#include +#include #include +#include +#include #if defined(UNIX) || defined(__MINGW32__) # include diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -17,7 +17,6 @@ #include "strgen.h" -#include #if !defined(_WIN32) || defined(__CYGWIN__) #include diff --git a/src/string_type.h b/src/string_type.h --- a/src/string_type.h +++ b/src/string_type.h @@ -11,8 +11,6 @@ #define STRING_TYPE_H #include "core/enum_type.hpp" -#include -#include /** A non-breaking space. */ #define NBSP u8"\u00a0" diff --git a/src/tar_type.h b/src/tar_type.h --- a/src/tar_type.h +++ b/src/tar_type.h @@ -11,7 +11,6 @@ #define TAR_TYPE_H #include -#include #include #include "fileio_type.h" diff --git a/src/textfile_gui.h b/src/textfile_gui.h --- a/src/textfile_gui.h +++ b/src/textfile_gui.h @@ -14,7 +14,6 @@ #include "strings_func.h" #include "textfile_type.h" #include "window_gui.h" -#include std::optional GetTextfile(TextfileType type, Subdirectory dir, const std::string &filename); diff --git a/src/timer/timer.h b/src/timer/timer.h --- a/src/timer/timer.h +++ b/src/timer/timer.h @@ -12,7 +12,6 @@ #include "timer_manager.h" -#include /** * The base where every other type of timer is derived from. diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -24,7 +24,6 @@ #include "settings_type.h" #include "timetable_cmd.h" #include "timetable.h" -#include #include "widgets/timetable_widget.h" diff --git a/src/townname_type.h b/src/townname_type.h --- a/src/townname_type.h +++ b/src/townname_type.h @@ -17,7 +17,6 @@ #include "town_type.h" #include "string_type.h" #include -#include typedef std::set TownNames; diff --git a/src/vehicle_gui_base.h b/src/vehicle_gui_base.h --- a/src/vehicle_gui_base.h +++ b/src/vehicle_gui_base.h @@ -20,7 +20,6 @@ #include "window_gui.h" #include "widgets/dropdown_type.h" -#include #include typedef GUIList GUIVehicleList; diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include extern std::string _ini_videodriver; extern std::vector _resolutions; diff --git a/src/window_gui.h b/src/window_gui.h --- a/src/window_gui.h +++ b/src/window_gui.h @@ -11,8 +11,6 @@ #define WINDOW_GUI_H #include -#include -#include #include "vehiclelist.h" #include "vehicle_type.h"