shithub: choc

Download patch

ref: e1426b004c0446dff935da2d62d13c696ca24dad
parent: 7504716edfe360c6a72d4d10eb4213d9cfe1f551
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Apr 13 04:33:57 EDT 2015

Fix assigning structs not compiling on Visual Studio

--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -242,6 +242,10 @@
     {CheatRevealFunc, &CheatRevealSeq},
 };
 
+#define SET_CHEAT(cheat, seq) \
+    { memcpy(cheat.sequence, seq, sizeof(seq)); \
+      cheat.sequence_len = sizeof(seq) - 1; }
+
 // CODE --------------------------------------------------------------------
 
 //==========================================================================
@@ -306,30 +310,30 @@
 
     if (gamemode == shareware)
     {
-	CheatGodSeq = (cheatseq_t) CHEAT("bgokey", 0);
-	CheatNoClipSeq = (cheatseq_t) CHEAT("rjohnson", 0);
-	CheatWeaponsSeq = (cheatseq_t) CHEAT("crhinehart", 0);
-	CheatHealthSeq =  (cheatseq_t) CHEAT("sgurno", 0);
-	CheatKeysSeq = (cheatseq_t) CHEAT("mraymondjudy", 0);
-	CheatSoundSeq = (cheatseq_t) CHEAT("kschilder", 0);
-	CheatTickerSeq = (cheatseq_t) CHEAT("rrettenmund", 0);
-	CheatArtifactAllSeq = (cheatseq_t) CHEAT("braffel", 0);
-	CheatPuzzleSeq = (cheatseq_t) CHEAT("tmoore", 0);
-	CheatWarpSeq = (cheatseq_t) CHEAT("bpelletier", 2);
-	CheatPigSeq = (cheatseq_t) CHEAT("ebiessman", 0);
-	CheatMassacreSeq = (cheatseq_t) CHEAT("cstika", 0);
-	CheatIDKFASeq = (cheatseq_t) CHEAT("rambo", 0);
-	CheatQuickenSeq1 = (cheatseq_t) CHEAT("quicken", 0);
-	CheatQuickenSeq2 = (cheatseq_t) CHEAT("quickenquicken", 0);
-	CheatQuickenSeq3 = (cheatseq_t) CHEAT("quickenquickenquicken", 0);
-	CheatClass1Seq = (cheatseq_t) CHEAT("plipo", 0);
-	CheatClass2Seq = (cheatseq_t) CHEAT("plipo", 1);
-	CheatVersionSeq = (cheatseq_t) CHEAT("pmacarther", 0);
-	CheatDebugSeq = (cheatseq_t) CHEAT("jsumwalt", 0);
-	CheatScriptSeq1 = (cheatseq_t) CHEAT("mwagabaza", 0);
-	CheatScriptSeq2 = (cheatseq_t) CHEAT("mwagabaza", 1);
-	CheatScriptSeq3 = (cheatseq_t) CHEAT("mwagabaza", 2);
-	CheatRevealSeq = (cheatseq_t) CHEAT("reveal", 0);
+	SET_CHEAT(CheatGodSeq, "bgokey");
+	SET_CHEAT(CheatNoClipSeq, "rjohnson");
+	SET_CHEAT(CheatWeaponsSeq, "crhinehart");
+	SET_CHEAT(CheatHealthSeq,"sgurno");
+	SET_CHEAT(CheatKeysSeq, "mraymondjudy");
+	SET_CHEAT(CheatSoundSeq, "kschilder");
+	SET_CHEAT(CheatTickerSeq, "rrettenmund");
+	SET_CHEAT(CheatArtifactAllSeq, "braffel");
+	SET_CHEAT(CheatPuzzleSeq, "tmoore");
+	SET_CHEAT(CheatWarpSeq, "bpelletier");
+	SET_CHEAT(CheatPigSeq, "ebiessman");
+	SET_CHEAT(CheatMassacreSeq, "cstika");
+	SET_CHEAT(CheatIDKFASeq, "rambo");
+	SET_CHEAT(CheatQuickenSeq1, "quicken");
+	SET_CHEAT(CheatQuickenSeq2, "quickenquicken");
+	SET_CHEAT(CheatQuickenSeq3, "quickenquickenquicken");
+	SET_CHEAT(CheatClass1Seq, "plipo");
+	SET_CHEAT(CheatClass2Seq, "plipo");
+	SET_CHEAT(CheatVersionSeq, "pmacarther");
+	SET_CHEAT(CheatDebugSeq, "jsumwalt");
+	SET_CHEAT(CheatScriptSeq1, "mwagabaza");
+	SET_CHEAT(CheatScriptSeq2, "mwagabaza");
+	SET_CHEAT(CheatScriptSeq3, "mwagabaza");
+	SET_CHEAT(CheatRevealSeq, "reveal");
     }
 }