From d0724c263a292188dee7bfa9704833d7c856e18f Mon Sep 17 00:00:00 2001
From: toaster <rollerorbital@gmail.com>
Date: Sat, 6 Apr 2024 20:58:04 +0100
Subject: [PATCH] Bring roundsplayed_t into the highest common denominator
 header

No indirect, hard-to-maintain magic number range in modetimeplayed arrays
---
 src/doomdef.h  | 10 ++++++++++
 src/doomstat.h |  4 ++--
 src/m_cond.h   |  9 ---------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/doomdef.h b/src/doomdef.h
index f9f7b65f82..69faba1a00 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -590,6 +590,16 @@ UINT32 quickncasehash (const char *p, size_t n)
 	return x;
 }
 
+// m_cond, doomstat
+typedef enum {
+	GDGT_RACE,
+	GDGT_BATTLE,
+	GDGT_PRISONS,
+	GDGT_SPECIAL,
+	GDGT_CUSTOM,
+	GDGT_MAX
+} roundsplayed_t;
+
 #ifndef __cplusplus
 #ifndef min // Double-Check with WATTCP-32's cdefs.h
 #define min(x, y) (((x) < (y)) ? (x) : (y))
diff --git a/src/doomstat.h b/src/doomstat.h
index 6a481a1a3a..20f0531ba0 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -124,7 +124,7 @@ struct skinrecord_t
 	UINT32 wins;
 	UINT32 rounds;
 	UINT32 timeplayed;
-	UINT32 modetimeplayed[5]; // no GDGT_MAX, m_cond.h is not included in here... it might need to be?
+	UINT32 modetimeplayed[GDGT_MAX];
 	UINT32 tumbletime;
 };
 
@@ -167,7 +167,7 @@ struct recorddata_t
 	recordtimes_t spbattack; ///< Best times for SPB Attack
 	UINT32 timeplayed;
 	UINT32 netgametimeplayed;
-	UINT32 modetimeplayed[5];
+	UINT32 modetimeplayed[GDGT_MAX];
 	UINT32 timeattacktimeplayed;
 	UINT32 spbattacktimeplayed;
 	UINT32 rounds;
diff --git a/src/m_cond.h b/src/m_cond.h
index fc2b64c5ad..90c219c39e 100644
--- a/src/m_cond.h
+++ b/src/m_cond.h
@@ -311,15 +311,6 @@ typedef enum {
 	GDGONER_DONE,
 } gdgoner_t;
 
-typedef enum {
-	GDGT_RACE,
-	GDGT_BATTLE,
-	GDGT_PRISONS,
-	GDGT_SPECIAL,
-	GDGT_CUSTOM,
-	GDGT_MAX
-} roundsplayed_t;
-
 struct candata_t
 {
 	UINT16 col;
-- 
GitLab