From b89c4affae9ab103f4d7817e6c2c97c095a2698f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Nov 2022 15:52:02 +0100 Subject: [PATCH] - removed the string assignment operators. These all caught literal 0's as well --- src/common/audio/sound/s_soundinternal.h | 10 ---------- src/common/engine/serializer.cpp | 4 ++-- src/gamedata/p_terrain.cpp | 2 +- src/gamedata/textures/anim_switches.cpp | 2 +- src/maploader/strifedialogue.cpp | 2 +- src/playsim/p_map.cpp | 2 +- src/r_data/sprites.cpp | 2 +- src/sound/s_advsound.cpp | 6 +++--- src/sound/s_sndseq.cpp | 14 +++++++------- 9 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/common/audio/sound/s_soundinternal.h b/src/common/audio/sound/s_soundinternal.h index a018da9a3..7d446c9ff 100644 --- a/src/common/audio/sound/s_soundinternal.h +++ b/src/common/audio/sound/s_soundinternal.h @@ -44,16 +44,6 @@ public: } FSoundID(const FSoundID &other) = default; FSoundID &operator=(const FSoundID &other) = default; - FSoundID &operator=(const char *name) - { - ID = GetSoundIndex(name); - return *this; - } - FSoundID &operator=(const FString &name) - { - ID = GetSoundIndex(name.GetChars()); - return *this; - } bool operator !=(FSoundID other) const { return ID != other.ID; diff --git a/src/common/engine/serializer.cpp b/src/common/engine/serializer.cpp index 0c82240d1..237865697 100644 --- a/src/common/engine/serializer.cpp +++ b/src/common/engine/serializer.cpp @@ -1358,12 +1358,12 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI } else if (val->IsNull()) { - sid = 0; + sid = NO_SOUND; } else { Printf(TEXTCOLOR_RED "string type expected for '%s'\n", key); - sid = 0; + sid = NO_SOUND; arc.mErrors++; } } diff --git a/src/gamedata/p_terrain.cpp b/src/gamedata/p_terrain.cpp index 3391e5513..9619f579b 100644 --- a/src/gamedata/p_terrain.cpp +++ b/src/gamedata/p_terrain.cpp @@ -355,7 +355,7 @@ static void ParseOuter (FScanner &sc) static void SetSplashDefaults (FSplashDef *splashdef) { splashdef->SmallSplashSound = - splashdef->NormalSplashSound = 0; + splashdef->NormalSplashSound = NO_SOUND; splashdef->SmallSplash = splashdef->SplashBase = splashdef->SplashChunk = NULL; diff --git a/src/gamedata/textures/anim_switches.cpp b/src/gamedata/textures/anim_switches.cpp index bf3b561f4..8089648fe 100644 --- a/src/gamedata/textures/anim_switches.cpp +++ b/src/gamedata/textures/anim_switches.cpp @@ -87,7 +87,7 @@ void FTextureAnimator::InitSwitchList () def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef)); def1->PreTexture = def2->frames[0].Texture = TexMan.CheckForTexture (list_p /* .name1 */, ETextureType::Wall, texflags); def2->PreTexture = def1->frames[0].Texture = TexMan.CheckForTexture (list_p + 9, ETextureType::Wall, texflags); - def1->Sound = def2->Sound = 0; + def1->Sound = def2->Sound = NO_SOUND; def1->NumFrames = def2->NumFrames = 1; def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0; def1->frames[0].TimeRnd = def2->frames[0].TimeRnd = 0; diff --git a/src/maploader/strifedialogue.cpp b/src/maploader/strifedialogue.cpp index 181405bb5..b09435dc2 100644 --- a/src/maploader/strifedialogue.cpp +++ b/src/maploader/strifedialogue.cpp @@ -419,7 +419,7 @@ FStrifeDialogueNode *MapLoader::ReadTeaserNode (const char *name, FileReader &lu } else { - node->SpeakerVoice = 0; + node->SpeakerVoice = NO_SOUND; } // The speaker's name, if any. diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 1794e0172..a9852bd6b 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -3489,7 +3489,7 @@ bool FSlide::BounceWall(AActor *mo) if (line->special == Line_Horizon || ((mo->BounceFlags & BOUNCE_NotOnSky) && line->hitSkyWall(mo))) { - mo->SeeSound = mo->BounceSound = 0; // it might make a sound otherwise + mo->SeeSound = mo->BounceSound = NO_SOUND; // it might make a sound otherwise mo->Destroy(); return true; } diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index c7fb249e2..25ac50f9b 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -886,7 +886,7 @@ void R_InitSkins (void) } // Register any sounds this skin provides - aliasid = 0; + aliasid = NO_SOUND; for (j = 0; j < NUMSKINSOUNDS; j++) { if (sndlumps[j] != -1) diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index 6b988786f..0b4c7a755 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -337,7 +337,7 @@ void S_CheckIntegrity() auto& sfx = *soundEngine->GetWritableSfx(FSoundID::fromInt(i)); Printf(TEXTCOLOR_RED "Sound %s has been disabled\n", sfx.name.GetChars()); sfx.bRandomHeader = false; - sfx.link = 0; // link to the empty sound. + sfx.link = NO_SOUND; // link to the empty sound. } } } @@ -440,7 +440,7 @@ static FSoundID S_AddSound (const char *logicalname, int lumpnum, FScanner *sc) { FRandomSoundList* rnd = soundEngine->ResolveRandomSound(sfx); rnd->Choices.Reset(); - rnd->Owner = 0; + rnd->Owner = NO_SOUND; } sfx->lumpnum = lumpnum; sfx->bRandomHeader = false; @@ -668,7 +668,7 @@ static void S_AddSNDINFO (int lump) ambient->periodmax = 0; ambient->volume = 0; ambient->attenuation = 0; - ambient->sound = 0; + ambient->sound = NO_SOUND; sc.MustGetString (); ambient->sound = FSoundID(soundEngine->FindSoundTentative(sc.String)); diff --git a/src/sound/s_sndseq.cpp b/src/sound/s_sndseq.cpp index 49d8c136c..99b58a8f9 100644 --- a/src/sound/s_sndseq.cpp +++ b/src/sound/s_sndseq.cpp @@ -581,7 +581,7 @@ void S_ParseSndSeq (int levellump) S_ClearSndSeq(); // be gone, compiler warnings - stopsound = 0; + stopsound = NO_SOUND; memset (SeqTrans, -1, sizeof(SeqTrans)); lastlump = 0; @@ -618,7 +618,7 @@ void S_ParseSndSeq (int levellump) Sequences.Push (NULL); } ScriptTemp.Clear(); - stopsound = 0; + stopsound = NO_SOUND; slot = NAME_None; if (seqtype == '[') { @@ -828,7 +828,7 @@ void DSeqNode::ActivateSequence (int sequence) m_Sequence = sequence; m_DelayTics = 0; m_StopSound = Sequences[sequence]->StopSound; - m_CurrentSoundID = 0; + m_CurrentSoundID = NO_SOUND; m_Volume = 1; // Start at max volume... m_Atten = ATTN_IDLE; // ...and idle attenuation } @@ -1214,7 +1214,7 @@ void DSeqNode::Tick () if (!IsPlaying()) { m_SequencePtr++; - m_CurrentSoundID = 0; + m_CurrentSoundID = NO_SOUND; } else { @@ -1273,13 +1273,13 @@ void DSeqNode::Tick () case SS_CMD_DELAY: m_DelayTics = GetData(*m_SequencePtr); m_SequencePtr++; - m_CurrentSoundID = 0; + m_CurrentSoundID = NO_SOUND; return; case SS_CMD_DELAYRAND: m_DelayTics = GetData(m_SequencePtr[0]) + pr_sndseq(m_SequencePtr[1]); m_SequencePtr += 2; - m_CurrentSoundID = 0; + m_CurrentSoundID = NO_SOUND; return; case SS_CMD_VOLUME: @@ -1383,7 +1383,7 @@ void SN_StopAllSequences (FLevelLocals *Level) for (node = Level->SequenceListHead; node; ) { DSeqNode *next = node->NextSequence(); - node->m_StopSound = 0; // don't play any stop sounds + node->m_StopSound = NO_SOUND; // don't play any stop sounds node->Destroy (); node = next; }