diff --git a/src/c_console.cpp b/src/c_console.cpp index 8635e6096..e0ea7e3cd 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1935,10 +1935,7 @@ struct TabData { } - TabData(const TabData &other) - : UseCount(other.UseCount), TabName(other.TabName) - { - } + TabData(const TabData &other) = default; }; static TArray TabCommands (TArray::NoInit); diff --git a/src/cycler.cpp b/src/cycler.cpp index dab4bab50..1d0d28486 100644 --- a/src/cycler.cpp +++ b/src/cycler.cpp @@ -60,22 +60,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FCycler &c, FCycler *d return arc; } -//========================================================================== -// -// -// -//========================================================================== - -FCycler::FCycler() -{ - m_cycle = 0.; - m_cycleType = CYCLE_Linear; - m_shouldCycle = false; - m_start = m_current = 0.; - m_end = 0.; - m_increment = true; -} - //========================================================================== // diff --git a/src/cycler.h b/src/cycler.h index 680a976f7..0b49e644d 100644 --- a/src/cycler.h +++ b/src/cycler.h @@ -20,7 +20,10 @@ class FCycler friend FSerializer &Serialize(FSerializer &arc, const char *key, FCycler &c, FCycler *def); public: - FCycler(); + FCycler() = default; + FCycler(const FCycler &other) = default; + FCycler &operator=(const FCycler &other) = default; + void Update(double diff); void SetParams(double start, double end, double cycle, bool update = false); void ShouldCycle(bool sc) { m_shouldCycle = sc; } @@ -28,8 +31,7 @@ public: double GetVal() { return m_current; } inline operator double () const { return m_current; } - -protected: + double m_start, m_end, m_current; double m_time, m_cycle; bool m_increment, m_shouldCycle; diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 90f9f0867..2b34852a0 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1017,7 +1017,7 @@ static int PatchThing (int thingy) } else if (stricmp (Line1 + linelen - 6, " sound") == 0) { - FSoundID snd; + FSoundID snd = 0; if (val == 0 || val >= SoundMap.Size()) { diff --git a/src/g_shared/a_dynlight.cpp b/src/g_shared/a_dynlight.cpp index 1336e4533..4590310e0 100644 --- a/src/g_shared/a_dynlight.cpp +++ b/src/g_shared/a_dynlight.cpp @@ -119,6 +119,7 @@ static FDynamicLight *GetLight() } else ret = (FDynamicLight*)DynLightArena.Alloc(sizeof(FDynamicLight)); memset(ret, 0, sizeof(*ret)); + ret->m_cycler.m_increment = true; ret->next = level.lights; level.lights = ret; if (ret->next) ret->next->prev = ret; diff --git a/src/name.h b/src/name.h index 8dbb63444..76324fe7c 100644 --- a/src/name.h +++ b/src/name.h @@ -52,7 +52,7 @@ public: FName (const char *text, size_t textlen, bool noCreate) { Index = NameData.FindName (text, textlen, noCreate); } FName (const FString &text); FName (const FString &text, bool noCreate); - FName (const FName &other) { Index = other.Index; } + FName (const FName &other) = default; FName (ENamedName index) { Index = index; } // ~FName () {} // Names can be added but never removed. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2377673b4..e11982c89 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -6011,7 +6011,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args) case ACSF_PlayActorSound: // PlaySound(tid, "SoundName", channel, volume, looping, attenuation, local) { - FSoundID sid; + FSoundID sid = 0; if (funcIndex == ACSF_PlaySound) { diff --git a/src/p_conversation.h b/src/p_conversation.h index ad1465841..d199922f5 100644 --- a/src/p_conversation.h +++ b/src/p_conversation.h @@ -29,7 +29,7 @@ struct FStrifeDialogueNode PClassActor *SpeakerType = nullptr; FString SpeakerName; - FSoundID SpeakerVoice; + FSoundID SpeakerVoice = 0; FString Backdrop; FString Dialogue; FString Goodbye; // must init to null for binary scripts to work as intended diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index b256241c3..754f9bcd3 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3001,7 +3001,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain) if (self->player && self->player->morphTics == 0) { const char *pain_amount; - FSoundID sfx_id; + FSoundID sfx_id = 0; if (self->health < 25) pain_amount = "*pain25"; diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index 118958cf4..feeac2172 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -268,9 +268,8 @@ void P_InitTerrainTypes () static void MakeDefaultTerrain () { - FTerrainDef def; + FTerrainDef def = {}; - memset (&def, 0, sizeof(def)); def.Name = "Solid"; def.Splash = -1; Terrains.Push (def); diff --git a/src/sc_man.cpp b/src/sc_man.cpp index f1f415ea4..396777ef8 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -1149,11 +1149,6 @@ int FScriptPosition::WarnCounter; bool FScriptPosition::StrictErrors; // makes all OPTERROR messages real errors. bool FScriptPosition::errorout; // call I_Error instead of printing the error itself. -FScriptPosition::FScriptPosition(const FScriptPosition &other) -{ - FileName = other.FileName; - ScriptLine = other.ScriptLine; -} FScriptPosition::FScriptPosition(FString fname, int line) { @@ -1167,13 +1162,6 @@ FScriptPosition::FScriptPosition(FScanner &sc) ScriptLine = sc.GetMessageLine(); } -FScriptPosition &FScriptPosition::operator=(const FScriptPosition &other) -{ - FileName = other.FileName; - ScriptLine = other.ScriptLine; - return *this; -} - FScriptPosition &FScriptPosition::operator=(FScanner &sc) { FileName = sc.ScriptName; diff --git a/src/sc_man.h b/src/sc_man.h index 35122654a..029363b94 100644 --- a/src/sc_man.h +++ b/src/sc_man.h @@ -170,10 +170,10 @@ struct FScriptPosition FileName = NAME_None; ScriptLine=0; } - FScriptPosition(const FScriptPosition &other); + FScriptPosition(const FScriptPosition &other) = default; FScriptPosition(FString fname, int line); FScriptPosition(FScanner &sc); - FScriptPosition &operator=(const FScriptPosition &other); + FScriptPosition &operator=(const FScriptPosition &other) = default; FScriptPosition &operator=(FScanner &sc); void Message(int severity, const char *message,...) const GCCPRINTF(3,4); static void ResetErrorCounter() diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index e4cf6c7d4..72271491e 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -1956,13 +1956,12 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid) int S_FindSkinnedSoundEx (AActor *actor, const char *name, const char *extendedname) { FString fullname; - FSoundID id; // Look for "name-extendedname"; fullname = name; fullname += '-'; fullname += extendedname; - id = fullname; + FSoundID id = fullname; if (id == 0) { // Look for "name" diff --git a/src/sound/s_sndseq.cpp b/src/sound/s_sndseq.cpp index ee0798f6e..7f22dd738 100644 --- a/src/sound/s_sndseq.cpp +++ b/src/sound/s_sndseq.cpp @@ -317,7 +317,7 @@ void DSeqNode::Serialize(FSerializer &arc) unsigned int i; FName seqName = NAME_None; int delayTics = 0; - FSoundID id; + FSoundID id = 0; float volume; float atten = ATTN_NORM; int seqnum; @@ -805,7 +805,7 @@ static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, c } DSeqNode::DSeqNode (int sequence, int modenum) -: m_ModeNum(modenum), m_SequenceChoices(0) +: m_CurrentSoundID(0), m_ModeNum(modenum), m_SequenceChoices(0) { ActivateSequence (sequence); if (!SequenceListHead) diff --git a/src/sound/s_sound.h b/src/sound/s_sound.h index 389e08312..275b57f49 100644 --- a/src/sound/s_sound.h +++ b/src/sound/s_sound.h @@ -98,10 +98,8 @@ extern TArray S_sfx; class FSoundID { public: - FSoundID() - { - ID = 0; - } + FSoundID() = default; + FSoundID(int id) { ID = id; diff --git a/src/textures/anim_switches.cpp b/src/textures/anim_switches.cpp index ab53210fe..455e4ebbf 100644 --- a/src/textures/anim_switches.cpp +++ b/src/textures/anim_switches.cpp @@ -229,7 +229,7 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad) FSwitchDef::frame thisframe; FTextureID picnum; bool bad; - FSoundID sound; + FSoundID sound = 0; bad = false;