diff --git a/src/console/c_console.cpp b/src/console/c_console.cpp index f15989a6b..de2f14679 100644 --- a/src/console/c_console.cpp +++ b/src/console/c_console.cpp @@ -1814,10 +1814,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/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index c86f8016c..e01bbbe46 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -1007,7 +1007,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/gamedata/p_terrain.cpp b/src/gamedata/p_terrain.cpp index d1f6d7e3a..f8f89eec9 100644 --- a/src/gamedata/p_terrain.cpp +++ b/src/gamedata/p_terrain.cpp @@ -264,9 +264,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/gamedata/textures/anim_switches.cpp b/src/gamedata/textures/anim_switches.cpp index 160316c22..24ac8aad8 100644 --- a/src/gamedata/textures/anim_switches.cpp +++ b/src/gamedata/textures/anim_switches.cpp @@ -226,7 +226,7 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad) FSwitchDef::frame thisframe; FTextureID picnum; bool bad; - FSoundID sound; + FSoundID sound = 0; bad = false; diff --git a/src/p_conversation.h b/src/p_conversation.h index b9f18a24c..4b0497a51 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/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 504855421..606db2221 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -87,6 +87,7 @@ static FDynamicLight *GetLight(FLevelLocals *Level) } 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/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 46cb8191e..b9f30cdd4 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -5877,7 +5877,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/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 161238c4e..ca710e25d 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -2994,7 +2994,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/r_data/cycler.cpp b/src/r_data/cycler.cpp index dab4bab50..1d0d28486 100644 --- a/src/r_data/cycler.cpp +++ b/src/r_data/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/r_data/cycler.h b/src/r_data/cycler.h index 680a976f7..0b49e644d 100644 --- a/src/r_data/cycler.h +++ b/src/r_data/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/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index 8a7d10947..83715eef3 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -1949,13 +1949,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 2da4f0a73..da2b3d600 100644 --- a/src/sound/s_sndseq.cpp +++ b/src/sound/s_sndseq.cpp @@ -308,7 +308,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; @@ -797,7 +797,7 @@ static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, c } DSeqNode::DSeqNode (FLevelLocals *l, int sequence, int modenum) -: m_ModeNum(modenum), m_SequenceChoices(0) +: m_CurrentSoundID(0), m_ModeNum(modenum), m_SequenceChoices(0) { Level = l; ActivateSequence (sequence); diff --git a/src/sound/s_sound.h b/src/sound/s_sound.h index 5a7e8e0b9..f0aa22e94 100644 --- a/src/sound/s_sound.h +++ b/src/sound/s_sound.h @@ -99,10 +99,8 @@ extern TArray S_sfx; class FSoundID { public: - FSoundID() - { - ID = 0; - } + FSoundID() = default; + FSoundID(int id) { ID = id; diff --git a/src/utility/name.h b/src/utility/name.h index 8dbb63444..76324fe7c 100644 --- a/src/utility/name.h +++ b/src/utility/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/utility/sc_man.cpp b/src/utility/sc_man.cpp index 562d85448..986d41d7a 100644 --- a/src/utility/sc_man.cpp +++ b/src/utility/sc_man.cpp @@ -1148,11 +1148,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) { @@ -1166,13 +1161,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/utility/sc_man.h b/src/utility/sc_man.h index df391614f..b345ee15b 100644 --- a/src/utility/sc_man.h +++ b/src/utility/sc_man.h @@ -172,10 +172,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()