mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 16:41:13 +00:00
Made several classes trivially copyable,
Many had leftover non-default constructors/ assignment operators, and some were initialized, even though the initialized data was never used. In case of FCycler this even caused a default setting to be overwritten when used inside FDynamicLight.
This commit is contained in:
parent
31ebeaf833
commit
76ee658be4
16 changed files with 21 additions and 53 deletions
|
@ -1814,10 +1814,7 @@ struct TabData
|
|||
{
|
||||
}
|
||||
|
||||
TabData(const TabData &other)
|
||||
: UseCount(other.UseCount), TabName(other.TabName)
|
||||
{
|
||||
}
|
||||
TabData(const TabData &other) = default;
|
||||
};
|
||||
|
||||
static TArray<TabData> TabCommands (TArray<TabData>::NoInit);
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -99,10 +99,8 @@ extern TArray<sfxinfo_t> S_sfx;
|
|||
class FSoundID
|
||||
{
|
||||
public:
|
||||
FSoundID()
|
||||
{
|
||||
ID = 0;
|
||||
}
|
||||
FSoundID() = default;
|
||||
|
||||
FSoundID(int id)
|
||||
{
|
||||
ID = id;
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue