From 6ce9cec071475b84ee3271170ac6eb219b72a206 Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Thu, 2 Apr 2026 21:07:48 +0200 Subject: [PATCH 1/6] fix: Add preprocessor guards around macros to resolve redefinition warnings. Added guards for WIN32_LEAN_AND_MEAN, _WIN32_WINNT, and NUM_ALPHA_TILES to prevent redefinition. - Related to #499 - Related to #503 --- Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | 2 ++ Core/Libraries/Source/WWVegas/WWLib/thread.cpp | 2 ++ Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index bcc35ed43d2..496f88a190c 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -22,7 +22,9 @@ #include +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #include "Registry.h" diff --git a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp index 7b30487e27b..f7edafad1cb 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp @@ -16,7 +16,9 @@ ** along with this program. If not, see . */ +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 +#endif #include "thread.h" #include "Except.h" diff --git a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index e800c2b7913..4ec211b6e94 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -57,7 +57,9 @@ typedef struct } TGlobalTextureClass; +#ifndef NUM_ALPHA_TILES #define NUM_ALPHA_TILES 8 +#endif class WorldHeightMapEdit : public WorldHeightMap { From 8f72c5bd3e4261bea06fe1496c819c781b5b04ba Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Fri, 3 Apr 2026 15:13:17 +0200 Subject: [PATCH 2/6] fix: removing defines alltogether --- Core/Libraries/Source/WWVegas/WWLib/thread.cpp | 3 --- Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h | 4 ---- 2 files changed, 7 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp index f7edafad1cb..f523e894c20 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/thread.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/thread.cpp @@ -16,9 +16,6 @@ ** along with this program. If not, see . */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif #include "thread.h" #include "Except.h" diff --git a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index 4ec211b6e94..aa76687e457 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -57,10 +57,6 @@ typedef struct } TGlobalTextureClass; -#ifndef NUM_ALPHA_TILES -#define NUM_ALPHA_TILES 8 -#endif - class WorldHeightMapEdit : public WorldHeightMap { protected: From 2055397fd4ebe9b2eb84032b8d8c7313231c04fb Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Sat, 4 Apr 2026 18:28:03 +0200 Subject: [PATCH 3/6] fix: replace macro definition WIN32_LEAN_AND_MEAN by header inclusion --- Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index 496f88a190c..aee887b53dd 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -21,10 +21,7 @@ // Author: Matthew D. Campbell, December 2001 #include - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif +#include #include #include "Registry.h" From 275992f3d89f4be7206a00d4d25fd9f8017bf9e0 Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Sun, 5 Apr 2026 19:12:31 +0200 Subject: [PATCH 4/6] fix: removing windows.h as it is included in win.h Also sorting includes by alphabetic order --- Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index aee887b53dd..7b5714eae18 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -22,8 +22,6 @@ #include #include -#include - #include "Registry.h" bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::string& val) From f1e08dad75d3184b76cd087286cf0f702b6fd9a6 Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Mon, 6 Apr 2026 09:17:38 +0200 Subject: [PATCH 5/6] refactor: sort includes --- Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index 7b5714eae18..217d67793aa 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -20,9 +20,9 @@ // Simple interface for storing/retrieving registry values // Author: Matthew D. Campbell, December 2001 +#include "Registry.h" #include #include -#include "Registry.h" bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::string& val) { From 27d6f6818bcaff8e4bfc23c7b8edc43c5646840e Mon Sep 17 00:00:00 2001 From: Skyaero <21192585+Skyaero42@users.noreply.github.com> Date: Mon, 6 Apr 2026 20:28:08 +0200 Subject: [PATCH 6/6] fix: use correct header encapsulation --- Core/Libraries/Source/WWVegas/WWDownload/registry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp index 217d67793aa..a54d41bc3bf 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/registry.cpp @@ -22,7 +22,7 @@ #include "Registry.h" #include -#include +#include "win.h" bool getStringFromRegistry(HKEY root, std::string path, std::string key, std::string& val) {