summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoïc Guilloux <glx22@users.noreply.github.com>2021-04-29 14:26:08 +0200
committerGitHub <noreply@github.com>2021-04-29 14:26:08 +0200
commit356bbbb90aaa3ac981b69693ce40d3afdaa6ea33 (patch)
treef6488574bd8f270062d14953ac1ca1950c0f3826 /src
parent20ac0b41484ebcaef3f8bdc9d4410903fd499386 (diff)
downloadopenttd-356bbbb90aaa3ac981b69693ce40d3afdaa6ea33.tar.xz
Fix: [MinGW] Set minimum OS version to Windows XP (#9135)
Diffstat (limited to 'src')
-rw-r--r--src/network/network_chat_gui.cpp6
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/script/api/script_date.cpp3
-rw-r--r--src/script/squirrel.cpp5
-rw-r--r--src/stdafx.h15
5 files changed, 18 insertions, 13 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 862a0a4cb..14edc1503 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -7,9 +7,6 @@
/** @file network_chat_gui.cpp GUI for handling chat messages. */
-#include <stdarg.h> /* va_list */
-#include <deque>
-
#include "../stdafx.h"
#include "../strings_func.h"
#include "../blitter/factory.hpp"
@@ -28,6 +25,9 @@
#include "table/strings.h"
+#include <stdarg.h> /* va_list */
+#include <deque>
+
#include "../safeguards.h"
/** The draw buffer must be able to contain the chat message, client name and the "[All]" message,
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index dcfcc9f43..f5e823a0d 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -19,7 +19,6 @@
* <li>repeat this until everything is done, and flush any remaining output to file
* </ol>
*/
-#include <deque>
#include "../stdafx.h"
#include "../debug.h"
@@ -44,6 +43,7 @@
#include "../fios.h"
#include "../error.h"
#include <atomic>
+#include <deque>
#include <string>
#ifdef __EMSCRIPTEN__
# include <emscripten.h>
diff --git a/src/script/api/script_date.cpp b/src/script/api/script_date.cpp
index 9946a26ec..ae3dff78c 100644
--- a/src/script/api/script_date.cpp
+++ b/src/script/api/script_date.cpp
@@ -7,11 +7,12 @@
/** @file script_date.cpp Implementation of ScriptDate. */
-#include <time.h>
#include "../../stdafx.h"
#include "script_date.hpp"
#include "../../date_func.h"
+#include <time.h>
+
#include "../../safeguards.h"
/* static */ bool ScriptDate::IsValidDate(Date date)
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index b9d614e8d..77f84a641 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -7,8 +7,6 @@
/** @file squirrel.cpp the implementation of the Squirrel class. It handles all Squirrel-stuff and gives a nice API back to work with. */
-#include <stdarg.h>
-#include <map>
#include "../stdafx.h"
#include "../debug.h"
#include "squirrel_std.hpp"
@@ -21,6 +19,9 @@
#include <../squirrel/sqvm.h>
#include "../core/alloc_func.hpp"
+#include <stdarg.h>
+#include <map>
+
/**
* In the memory allocator for Squirrel we want to directly use malloc/realloc, so when the OS
* does not have enough memory the game does not go into unrecoverable error mode and kill the
diff --git a/src/stdafx.h b/src/stdafx.h
index 19009f5ff..819eb0e61 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -10,6 +10,15 @@
#ifndef STDAFX_H
#define STDAFX_H
+#if defined(_WIN32)
+ /* MinGW defaults to Windows 7 if none of these are set, and they must be set before any MinGW header is included */
+# define NTDDI_VERSION NTDDI_WINXP // Windows XP
+# define _WIN32_WINNT 0x501 // Windows XP
+# define _WIN32_WINDOWS 0x501 // Windows XP
+# define WINVER 0x0501 // Windows XP
+# define _WIN32_IE_ 0x0600 // 6.0 (XP+)
+#endif
+
#ifdef _MSC_VER
/* Stop Microsoft (and clang-cl) compilers from complaining about potentially-unsafe/potentially-non-standard functions */
# define _CRT_SECURE_NO_DEPRECATE
@@ -164,12 +173,6 @@
/* Stuff for MSVC */
#if defined(_MSC_VER)
# pragma once
-# define NTDDI_VERSION NTDDI_WINXP // Windows XP
-# define _WIN32_WINNT 0x501 // Windows XP
-# define _WIN32_WINDOWS 0x501 // Windows XP
-# define WINVER 0x0501 // Windows XP
-# define _WIN32_IE_ 0x0600 // 6.0 (XP+)
-
# define NOMINMAX // Disable min/max macros in windows.h.
# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data