3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10#ifndef STDAFX_H
11#define STDAFX_H
12
13#if defined(_WIN32)
14/* MinGW defaults to Windows 7 if none of these are set, and they must be set before any MinGW header is included */
15# define NTDDI_VERSION NTDDI_WINXP // Windows XP
16# define _WIN32_WINNT 0x501 // Windows XP
17# define _WIN32_WINDOWS 0x501 // Windows XP
18# define WINVER 0x0501 // Windows XP
19# define _WIN32_IE_ 0x0600 // 6.0 (XP+)
20#endif
21
22#ifdef _MSC_VER
23/* Stop Microsoft (and clang-cl) compilers from complaining about potentially-unsafe/potentially-non-standard functions */
97# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
98#endif
99
100#if defined(_MSC_VER)
101// See https://learn.microsoft.com/en-us/cpp/cpp/empty-bases?view=msvc-170
102# define EMPTY_BASES __declspec(empty_bases)
103#else
104# define EMPTY_BASES
105#endif
106
107/* Stuff for MSVC */
108#if defined(_MSC_VER)
109# pragma once
110# define NOMINMAX // Disable min/max macros in windows.h.
111
112# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
113# pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied
114# pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
115# pragma warning(disable: 4355) // 'this' : used in base member initializer list
116
117# if (_MSC_VER < 1400) // MSVC 2005 safety checks
118# error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not! Upgrade your compiler."
119# endif /* (_MSC_VER < 1400) */
120# pragma warning(disable: 4291) // no matching operator delete found; memory will not be freed if initialization throws an exception (reason: our overloaded functions never throw an exception)
121# pragma warning(disable: 4996) // 'function': was declared deprecated
122# pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked
126# pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ...
127
128# if (_MSC_VER == 1500) // Addresses item #13 on http://blogs.msdn.com/b/vcblog/archive/2008/08/11/tr1-fixes-in-vc9-sp1.aspx, for Visual Studio 2008