Skip to content

Commit

Permalink
- removed the string assignment operators.
Browse files Browse the repository at this point in the history
These all caught literal 0's as well
  • Loading branch information
coelckers committed Nov 24, 2022
1 parent d173c04 commit b89c4af
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 27 deletions.
10 changes: 0 additions & 10 deletions src/common/audio/sound/s_soundinternal.h
Expand Up @@ -44,16 +44,6 @@ class FSoundID
}
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;
Expand Down
4 changes: 2 additions & 2 deletions src/common/engine/serializer.cpp
Expand Up @@ -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++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/p_terrain.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/textures/anim_switches.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/maploader/strifedialogue.cpp
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/playsim/p_map.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/r_data/sprites.cpp
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/sound/s_advsound.cpp
Expand Up @@ -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.
}
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
14 changes: 7 additions & 7 deletions src/sound/s_sndseq.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -618,7 +618,7 @@ void S_ParseSndSeq (int levellump)
Sequences.Push (NULL);
}
ScriptTemp.Clear();
stopsound = 0;
stopsound = NO_SOUND;
slot = NAME_None;
if (seqtype == '[')
{
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -1214,7 +1214,7 @@ void DSeqNode::Tick ()
if (!IsPlaying())
{
m_SequencePtr++;
m_CurrentSoundID = 0;
m_CurrentSoundID = NO_SOUND;
}
else
{
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b89c4af

Please sign in to comment.