From e1426b004c0446dff935da2d62d13c696ca24dad Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 13 Apr 2015 08:33:57 +0200 Subject: Fix assigning structs not compiling on Visual Studio --- src/hexen/sb_bar.c | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c index 3846f4c6..52a65824 100644 --- a/src/hexen/sb_bar.c +++ b/src/hexen/sb_bar.c @@ -242,6 +242,10 @@ static Cheat_t Cheats[] = { {CheatRevealFunc, &CheatRevealSeq}, }; +#define SET_CHEAT(cheat, seq) \ + { memcpy(cheat.sequence, seq, sizeof(seq)); \ + cheat.sequence_len = sizeof(seq) - 1; } + // CODE -------------------------------------------------------------------- //========================================================================== @@ -306,30 +310,30 @@ void SB_Init(void) 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"); } } -- cgit v1.2.3