- removed the string assignment operators.

These all caught literal 0's as well
This commit is contained in:
Christoph Oelckers 2022-11-24 15:52:02 +01:00
parent d173c0453c
commit b89c4affae
9 changed files with 17 additions and 27 deletions

View file

@ -44,16 +44,6 @@ public:
} }
FSoundID(const FSoundID &other) = default; FSoundID(const FSoundID &other) = default;
FSoundID &operator=(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 bool operator !=(FSoundID other) const
{ {
return ID != other.ID; return ID != other.ID;

View file

@ -1358,12 +1358,12 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
} }
else if (val->IsNull()) else if (val->IsNull())
{ {
sid = 0; sid = NO_SOUND;
} }
else else
{ {
Printf(TEXTCOLOR_RED "string type expected for '%s'\n", key); Printf(TEXTCOLOR_RED "string type expected for '%s'\n", key);
sid = 0; sid = NO_SOUND;
arc.mErrors++; arc.mErrors++;
} }
} }

View file

@ -355,7 +355,7 @@ static void ParseOuter (FScanner &sc)
static void SetSplashDefaults (FSplashDef *splashdef) static void SetSplashDefaults (FSplashDef *splashdef)
{ {
splashdef->SmallSplashSound = splashdef->SmallSplashSound =
splashdef->NormalSplashSound = 0; splashdef->NormalSplashSound = NO_SOUND;
splashdef->SmallSplash = splashdef->SmallSplash =
splashdef->SplashBase = splashdef->SplashBase =
splashdef->SplashChunk = NULL; splashdef->SplashChunk = NULL;

View file

@ -87,7 +87,7 @@ void FTextureAnimator::InitSwitchList ()
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef)); def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def1->PreTexture = def2->frames[0].Texture = TexMan.CheckForTexture (list_p /* .name1 */, ETextureType::Wall, texflags); 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); 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->NumFrames = def2->NumFrames = 1;
def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0; def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0;
def1->frames[0].TimeRnd = def2->frames[0].TimeRnd = 0; def1->frames[0].TimeRnd = def2->frames[0].TimeRnd = 0;

View file

@ -419,7 +419,7 @@ FStrifeDialogueNode *MapLoader::ReadTeaserNode (const char *name, FileReader &lu
} }
else else
{ {
node->SpeakerVoice = 0; node->SpeakerVoice = NO_SOUND;
} }
// The speaker's name, if any. // The speaker's name, if any.

View file

@ -3489,7 +3489,7 @@ bool FSlide::BounceWall(AActor *mo)
if (line->special == Line_Horizon || ((mo->BounceFlags & BOUNCE_NotOnSky) && line->hitSkyWall(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(); mo->Destroy();
return true; return true;
} }

View file

@ -886,7 +886,7 @@ void R_InitSkins (void)
} }
// Register any sounds this skin provides // Register any sounds this skin provides
aliasid = 0; aliasid = NO_SOUND;
for (j = 0; j < NUMSKINSOUNDS; j++) for (j = 0; j < NUMSKINSOUNDS; j++)
{ {
if (sndlumps[j] != -1) if (sndlumps[j] != -1)

View file

@ -337,7 +337,7 @@ void S_CheckIntegrity()
auto& sfx = *soundEngine->GetWritableSfx(FSoundID::fromInt(i)); auto& sfx = *soundEngine->GetWritableSfx(FSoundID::fromInt(i));
Printf(TEXTCOLOR_RED "Sound %s has been disabled\n", sfx.name.GetChars()); Printf(TEXTCOLOR_RED "Sound %s has been disabled\n", sfx.name.GetChars());
sfx.bRandomHeader = false; 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); FRandomSoundList* rnd = soundEngine->ResolveRandomSound(sfx);
rnd->Choices.Reset(); rnd->Choices.Reset();
rnd->Owner = 0; rnd->Owner = NO_SOUND;
} }
sfx->lumpnum = lumpnum; sfx->lumpnum = lumpnum;
sfx->bRandomHeader = false; sfx->bRandomHeader = false;
@ -668,7 +668,7 @@ static void S_AddSNDINFO (int lump)
ambient->periodmax = 0; ambient->periodmax = 0;
ambient->volume = 0; ambient->volume = 0;
ambient->attenuation = 0; ambient->attenuation = 0;
ambient->sound = 0; ambient->sound = NO_SOUND;
sc.MustGetString (); sc.MustGetString ();
ambient->sound = FSoundID(soundEngine->FindSoundTentative(sc.String)); ambient->sound = FSoundID(soundEngine->FindSoundTentative(sc.String));

View file

@ -581,7 +581,7 @@ void S_ParseSndSeq (int levellump)
S_ClearSndSeq(); S_ClearSndSeq();
// be gone, compiler warnings // be gone, compiler warnings
stopsound = 0; stopsound = NO_SOUND;
memset (SeqTrans, -1, sizeof(SeqTrans)); memset (SeqTrans, -1, sizeof(SeqTrans));
lastlump = 0; lastlump = 0;
@ -618,7 +618,7 @@ void S_ParseSndSeq (int levellump)
Sequences.Push (NULL); Sequences.Push (NULL);
} }
ScriptTemp.Clear(); ScriptTemp.Clear();
stopsound = 0; stopsound = NO_SOUND;
slot = NAME_None; slot = NAME_None;
if (seqtype == '[') if (seqtype == '[')
{ {
@ -828,7 +828,7 @@ void DSeqNode::ActivateSequence (int sequence)
m_Sequence = sequence; m_Sequence = sequence;
m_DelayTics = 0; m_DelayTics = 0;
m_StopSound = Sequences[sequence]->StopSound; m_StopSound = Sequences[sequence]->StopSound;
m_CurrentSoundID = 0; m_CurrentSoundID = NO_SOUND;
m_Volume = 1; // Start at max volume... m_Volume = 1; // Start at max volume...
m_Atten = ATTN_IDLE; // ...and idle attenuation m_Atten = ATTN_IDLE; // ...and idle attenuation
} }
@ -1214,7 +1214,7 @@ void DSeqNode::Tick ()
if (!IsPlaying()) if (!IsPlaying())
{ {
m_SequencePtr++; m_SequencePtr++;
m_CurrentSoundID = 0; m_CurrentSoundID = NO_SOUND;
} }
else else
{ {
@ -1273,13 +1273,13 @@ void DSeqNode::Tick ()
case SS_CMD_DELAY: case SS_CMD_DELAY:
m_DelayTics = GetData(*m_SequencePtr); m_DelayTics = GetData(*m_SequencePtr);
m_SequencePtr++; m_SequencePtr++;
m_CurrentSoundID = 0; m_CurrentSoundID = NO_SOUND;
return; return;
case SS_CMD_DELAYRAND: case SS_CMD_DELAYRAND:
m_DelayTics = GetData(m_SequencePtr[0]) + pr_sndseq(m_SequencePtr[1]); m_DelayTics = GetData(m_SequencePtr[0]) + pr_sndseq(m_SequencePtr[1]);
m_SequencePtr += 2; m_SequencePtr += 2;
m_CurrentSoundID = 0; m_CurrentSoundID = NO_SOUND;
return; return;
case SS_CMD_VOLUME: case SS_CMD_VOLUME:
@ -1383,7 +1383,7 @@ void SN_StopAllSequences (FLevelLocals *Level)
for (node = Level->SequenceListHead; node; ) for (node = Level->SequenceListHead; node; )
{ {
DSeqNode *next = node->NextSequence(); 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->Destroy ();
node = next; node = next;
} }