From cc2ed3b06d0a79c9852a55c95be4bd5ac6bed902 Mon Sep 17 00:00:00 2001
From: Belonit <54427022+Belonit@users.noreply.github.com>
Date: Wed, 14 Oct 2026 11:28:31 +0300
Subject: [PATCH] Prevent periodic reshrouding after defeat
---
Spawner.vcxproj | 1 +
src/Misc/Bugfixes.GapGenerator.cpp | 34 ++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
create mode 100644 src/Misc/Bugfixes.GapGenerator.cpp
diff --git a/Spawner.vcxproj b/Spawner.vcxproj
index 5a109174..838be1f1 100644
--- a/Spawner.vcxproj
+++ b/Spawner.vcxproj
@@ -36,6 +36,7 @@
+
diff --git a/src/Misc/Bugfixes.GapGenerator.cpp b/src/Misc/Bugfixes.GapGenerator.cpp
new file mode 100644
index 00000000..b1131649
--- /dev/null
+++ b/src/Misc/Bugfixes.GapGenerator.cpp
@@ -0,0 +1,34 @@
+/**
+* yrpp-spawner
+*
+* Copyright(C) 2026-present CnCNet
+*
+* This program 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, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program 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.See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.If not, see .
+*/
+
+#include
+#include
+
+// Every 120 frames, the game hides cells marked with FlagToShroud.
+// Revealing the map on defeat leaves these marks intact, so skip their processing
+// for the defeated local player while retaining the visibility recalculation pass.
+DEFINE_HOOK(0x578148, MapClass_UpdateShroud_SkipDefeatedPlayer, 0x7)
+{
+ enum { SkipReshroud = 0x5781A9 };
+
+ if (HouseClass::CurrentPlayer->Defeated)
+ return SkipReshroud;
+
+ return 0;
+}