mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- defaulted constructors and assignment operators of several trivial types.
This commit is contained in:
parent
0c4e6f88a6
commit
5b7d3c91f9
14 changed files with 40 additions and 149 deletions
|
@ -468,7 +468,7 @@ public:
|
|||
TObjPtr<AActor*> MUSINFOactor = nullptr; // For MUSINFO purposes
|
||||
int8_t MUSINFOtics = 0;
|
||||
|
||||
bool settings_controller = false; // Player can control game settings.
|
||||
bool settings_controller = true; // Player can control game settings.
|
||||
int8_t crouching = 0;
|
||||
int8_t crouchdir = 0;
|
||||
|
||||
|
|
17
src/dobjgc.h
17
src/dobjgc.h
|
@ -167,22 +167,19 @@ class TObjPtr
|
|||
DObject *o;
|
||||
};
|
||||
public:
|
||||
TObjPtr() throw()
|
||||
{
|
||||
}
|
||||
TObjPtr() = default;
|
||||
TObjPtr(const TObjPtr<T> &q) = default;
|
||||
|
||||
TObjPtr(T q) throw()
|
||||
: pp(q)
|
||||
{
|
||||
}
|
||||
TObjPtr(const TObjPtr<T> &q) throw()
|
||||
: pp(q.pp)
|
||||
T operator=(T q)
|
||||
{
|
||||
pp = q;
|
||||
return *this;
|
||||
}
|
||||
T operator=(T q) throw()
|
||||
{
|
||||
return pp = q;
|
||||
// The caller must now perform a write barrier.
|
||||
}
|
||||
|
||||
operator T() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
|
|
|
@ -103,7 +103,7 @@ enum
|
|||
|
||||
struct PalEntry
|
||||
{
|
||||
PalEntry () {}
|
||||
PalEntry() = default;
|
||||
PalEntry (uint32_t argb) { d = argb; }
|
||||
operator uint32_t () const { return d; }
|
||||
void SetRGB(PalEntry other)
|
||||
|
@ -146,6 +146,7 @@ struct PalEntry
|
|||
{
|
||||
return (d & 0xffffff) == 0xffffff;
|
||||
}
|
||||
PalEntry &operator= (const PalEntry &other) = default;
|
||||
PalEntry &operator= (uint32_t other) { d = other; return *this; }
|
||||
PalEntry InverseColor() const { PalEntry nc; nc.a = a; nc.r = 255 - r; nc.g = 255 - g; nc.b = 255 - b; return nc; }
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
@ -205,7 +206,7 @@ class FTextureID
|
|||
friend void R_InitSpriteDefs();
|
||||
|
||||
public:
|
||||
FTextureID() throw() {}
|
||||
FTextureID() = default;
|
||||
bool isNull() const { return texnum == 0; }
|
||||
bool isValid() const { return texnum > 0; }
|
||||
bool Exists() const { return texnum >= 0; }
|
||||
|
|
|
@ -399,7 +399,6 @@ void GLHorizonPortal::DrawContents(HWDrawInfo *hwdi)
|
|||
Clocker c(PortalAll);
|
||||
|
||||
FMaterial * gltexture;
|
||||
PalEntry color;
|
||||
player_t * player=&players[consoleplayer];
|
||||
GLSectorPlane * sp = &origin->plane;
|
||||
auto &vp = di->Viewpoint;
|
||||
|
|
|
@ -228,7 +228,6 @@ int LevelAABBTree::GenerateTreeNode(int *lines, int num_lines, const FVector2 *c
|
|||
// Try sort at longest axis, then if that fails then the other one.
|
||||
// We place the sorted lines into work_buffer and then move the result back to the lines list when done.
|
||||
int left_count, right_count;
|
||||
FVector2 axis;
|
||||
for (int attempt = 0; attempt < 2; attempt++)
|
||||
{
|
||||
// Find the sort plane for axis
|
||||
|
|
|
@ -319,7 +319,6 @@ void FMaterial::SetSpriteRect()
|
|||
|
||||
bool FMaterial::TrimBorders(uint16_t *rect)
|
||||
{
|
||||
PalEntry col;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class FString;
|
|||
class FName
|
||||
{
|
||||
public:
|
||||
FName() = default;// : Index(0) {}
|
||||
FName() = default;
|
||||
FName (const char *text) { Index = NameData.FindName (text, false); }
|
||||
FName (const char *text, bool noCreate) { Index = NameData.FindName (text, noCreate); }
|
||||
FName (const char *text, size_t textlen, bool noCreate) { Index = NameData.FindName (text, textlen, noCreate); }
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
FName &operator = (const char *text) { Index = NameData.FindName (text, false); return *this; }
|
||||
FName &operator = (const FString &text);
|
||||
FName &operator = (const FName &other) { Index = other.Index; return *this; }
|
||||
FName &operator = (const FName &other) = default;
|
||||
FName &operator = (ENamedName index) { Index = index; return *this; }
|
||||
|
||||
int SetName (const char *text, bool noCreate=false) { return Index = NameData.FindName (text, noCreate); }
|
||||
|
|
|
@ -2345,7 +2345,6 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
{
|
||||
static int pushtime = 0;
|
||||
bool bForceSlide = !scroll.isZero();
|
||||
DAngle Angle;
|
||||
DVector2 ptry;
|
||||
player_t *player;
|
||||
DVector2 move;
|
||||
|
|
|
@ -306,7 +306,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
|
|||
{
|
||||
if (sec.Lines.Size() != 3) continue; // only works with triangular sectors
|
||||
|
||||
DVector3 vt1, vt2, vt3, cross;
|
||||
DVector3 vt1, vt2, vt3;
|
||||
DVector3 vec1, vec2;
|
||||
int vi1, vi2, vi3;
|
||||
|
||||
|
|
|
@ -114,15 +114,8 @@ public:
|
|||
{
|
||||
ID = S_FindSound(name.GetChars());
|
||||
}
|
||||
FSoundID(const FSoundID &other)
|
||||
{
|
||||
ID = other.ID;
|
||||
}
|
||||
FSoundID &operator=(const FSoundID &other)
|
||||
{
|
||||
ID = other.ID;
|
||||
return *this;
|
||||
}
|
||||
FSoundID(const FSoundID &other) = default;
|
||||
FSoundID &operator=(const FSoundID &other) = default;
|
||||
FSoundID &operator=(const char *name)
|
||||
{
|
||||
ID = S_FindSound(name);
|
||||
|
@ -168,19 +161,7 @@ class FSoundIDNoInit : public FSoundID
|
|||
{
|
||||
public:
|
||||
FSoundIDNoInit() : FSoundID(NoInit) {}
|
||||
|
||||
FSoundID &operator=(const FSoundID &other)
|
||||
{
|
||||
return FSoundID::operator=(other);
|
||||
}
|
||||
FSoundID &operator=(const char *name)
|
||||
{
|
||||
return FSoundID::operator=(name);
|
||||
}
|
||||
FSoundID &operator=(const FString &name)
|
||||
{
|
||||
return FSoundID::operator=(name);
|
||||
}
|
||||
using FSoundID::operator=;
|
||||
};
|
||||
|
||||
extern FRolloffInfo S_Rolloff;
|
||||
|
|
12
src/stats.h
12
src/stats.h
|
@ -57,12 +57,6 @@ public:
|
|||
class cycle_t
|
||||
{
|
||||
public:
|
||||
cycle_t &operator= (const cycle_t &o)
|
||||
{
|
||||
Sec = o.Sec;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Sec = 0;
|
||||
|
@ -153,12 +147,6 @@ inline uint64_t rdtsc()
|
|||
class cycle_t
|
||||
{
|
||||
public:
|
||||
cycle_t &operator= (const cycle_t &o)
|
||||
{
|
||||
Counter = o.Counter;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Counter = 0;
|
||||
|
|
|
@ -961,8 +961,6 @@ PalEntry FTexture::averageColor(const uint32_t *data, int size, int maxout)
|
|||
|
||||
PalEntry FTexture::GetSkyCapColor(bool bottom)
|
||||
{
|
||||
PalEntry col;
|
||||
|
||||
if (!bSWSkyColorDone)
|
||||
{
|
||||
bSWSkyColorDone = true;
|
||||
|
|
110
src/vectors.h
110
src/vectors.h
|
@ -66,19 +66,14 @@ struct TVector2
|
|||
{
|
||||
vec_t X, Y;
|
||||
|
||||
TVector2 ()
|
||||
{
|
||||
}
|
||||
TVector2() = default;
|
||||
|
||||
TVector2 (vec_t a, vec_t b)
|
||||
: X(a), Y(b)
|
||||
{
|
||||
}
|
||||
|
||||
TVector2 (const TVector2 &other)
|
||||
: X(other.X), Y(other.Y)
|
||||
{
|
||||
}
|
||||
TVector2(const TVector2 &other) = default;
|
||||
|
||||
TVector2 (const TVector3<vec_t> &other) // Copy the X and Y from the 3D vector and discard the Z
|
||||
: X(other.X), Y(other.Y)
|
||||
|
@ -95,18 +90,7 @@ struct TVector2
|
|||
return X == 0 && Y == 0;
|
||||
}
|
||||
|
||||
TVector2 &operator= (const TVector2 &other)
|
||||
{
|
||||
// This might seem backwards, but this helps produce smaller code when a newly
|
||||
// created vector is assigned, because the components can just be popped off
|
||||
// the FPU stack in order without the need for fxch. For platforms with a
|
||||
// more sensible registered-based FPU, of course, the order doesn't matter.
|
||||
// (And, yes, I know fxch can improve performance in the right circumstances,
|
||||
// but this isn't one of those times. Here, it's little more than a no-op that
|
||||
// makes the exe 2 bytes larger whenever you assign one vector to another.)
|
||||
Y = other.Y, X = other.X;
|
||||
return *this;
|
||||
}
|
||||
TVector2 &operator= (const TVector2 &other) = default;
|
||||
|
||||
// Access X and Y as an array
|
||||
vec_t &operator[] (int index)
|
||||
|
@ -317,9 +301,7 @@ struct TVector3
|
|||
|
||||
vec_t X, Y, Z;
|
||||
|
||||
TVector3 ()
|
||||
{
|
||||
}
|
||||
TVector3() = default;
|
||||
|
||||
TVector3 (vec_t a, vec_t b, vec_t c)
|
||||
: X(a), Y(b), Z(c)
|
||||
|
@ -331,10 +313,7 @@ struct TVector3
|
|||
{
|
||||
}
|
||||
|
||||
TVector3 (const TVector3 &other)
|
||||
: X(other.X), Y(other.Y), Z(other.Z)
|
||||
{
|
||||
}
|
||||
TVector3(const TVector3 &other) = default;
|
||||
|
||||
TVector3 (const Vector2 &xy, vec_t z)
|
||||
: X(xy.X), Y(xy.Y), Z(z)
|
||||
|
@ -353,11 +332,7 @@ struct TVector3
|
|||
return X == 0 && Y == 0 && Z == 0;
|
||||
}
|
||||
|
||||
TVector3 &operator= (const TVector3 &other)
|
||||
{
|
||||
Z = other.Z, Y = other.Y, X = other.X;
|
||||
return *this;
|
||||
}
|
||||
TVector3 &operator= (const TVector3 &other) = default;
|
||||
|
||||
// Access X and Y and Z as an array
|
||||
vec_t &operator[] (int index)
|
||||
|
@ -546,13 +521,12 @@ struct TVector3
|
|||
{
|
||||
right = { 0.f, 0.f, 1.f };
|
||||
}
|
||||
|
||||
if (major == 1 || (major == 2 && n[2] > 0.f))
|
||||
else if (major == 1 || (major == 2 && n[2] > 0.f))
|
||||
{
|
||||
right = { 1.f, 0.f, 0.f };
|
||||
}
|
||||
|
||||
if (major == 2 && n[2] < 0.0f)
|
||||
// Unconditional to ease static analysis
|
||||
else // major == 2 && n[2] <= 0.0f
|
||||
{
|
||||
right = { -1.f, 0.f, 0.f };
|
||||
}
|
||||
|
@ -662,9 +636,7 @@ struct TVector4
|
|||
|
||||
vec_t X, Y, Z, W;
|
||||
|
||||
TVector4()
|
||||
{
|
||||
}
|
||||
TVector4() = default;
|
||||
|
||||
TVector4(vec_t a, vec_t b, vec_t c, vec_t d)
|
||||
: X(a), Y(b), Z(c), W(d)
|
||||
|
@ -676,10 +648,7 @@ struct TVector4
|
|||
{
|
||||
}
|
||||
|
||||
TVector4(const TVector4 &other)
|
||||
: X(other.X), Y(other.Y), Z(other.Z), W(other.W)
|
||||
{
|
||||
}
|
||||
TVector4(const TVector4 &other) = default;
|
||||
|
||||
TVector4(const Vector3 &xyz, vec_t w)
|
||||
: X(xyz.X), Y(xyz.Y), Z(xyz.Z), W(w)
|
||||
|
@ -696,11 +665,7 @@ struct TVector4
|
|||
return X == 0 && Y == 0 && Z == 0 && W == 0;
|
||||
}
|
||||
|
||||
TVector4 &operator= (const TVector4 &other)
|
||||
{
|
||||
W = other.W, Z = other.Z, Y = other.Y, X = other.X;
|
||||
return *this;
|
||||
}
|
||||
TVector4 &operator= (const TVector4 &other) = default;
|
||||
|
||||
// Access X and Y and Z as an array
|
||||
vec_t &operator[] (int index)
|
||||
|
@ -939,16 +904,8 @@ struct TMatrix3x3
|
|||
|
||||
vec_t Cells[3][3];
|
||||
|
||||
TMatrix3x3()
|
||||
{
|
||||
}
|
||||
|
||||
TMatrix3x3(const TMatrix3x3 &other)
|
||||
{
|
||||
(*this)[0] = other[0];
|
||||
(*this)[1] = other[1];
|
||||
(*this)[2] = other[2];
|
||||
}
|
||||
TMatrix3x3() = default;
|
||||
TMatrix3x3(const TMatrix3x3 &other) = default;
|
||||
|
||||
TMatrix3x3(const Vector3 &row1, const Vector3 &row2, const Vector3 &row3)
|
||||
{
|
||||
|
@ -1151,32 +1108,15 @@ struct TAngle
|
|||
TAngle &operator= (long other) = delete;
|
||||
TAngle &operator= (unsigned long other) = delete;
|
||||
|
||||
TAngle ()
|
||||
{
|
||||
}
|
||||
TAngle() = default;
|
||||
|
||||
TAngle (vec_t amt)
|
||||
: Degrees(amt)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
TAngle (int amt)
|
||||
: Degrees(vec_t(amt))
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
TAngle (const TAngle &other)
|
||||
: Degrees(other.Degrees)
|
||||
{
|
||||
}
|
||||
|
||||
TAngle &operator= (const TAngle &other)
|
||||
{
|
||||
Degrees = other.Degrees;
|
||||
return *this;
|
||||
}
|
||||
TAngle(const TAngle &other) = default;
|
||||
TAngle &operator= (const TAngle &other) = default;
|
||||
|
||||
TAngle &operator= (double other)
|
||||
{
|
||||
|
@ -1491,25 +1431,15 @@ struct TRotator
|
|||
Angle Roll; // rotation about the forward axis.
|
||||
Angle CamRoll; // Roll specific to actor cameras. Used by quakes.
|
||||
|
||||
TRotator ()
|
||||
{
|
||||
}
|
||||
TRotator() = default;
|
||||
|
||||
TRotator (const Angle &p, const Angle &y, const Angle &r)
|
||||
: Pitch(p), Yaw(y), Roll(r)
|
||||
{
|
||||
}
|
||||
|
||||
TRotator (const TRotator &other)
|
||||
: Pitch(other.Pitch), Yaw(other.Yaw), Roll(other.Roll)
|
||||
{
|
||||
}
|
||||
|
||||
TRotator &operator= (const TRotator &other)
|
||||
{
|
||||
Roll = other.Roll, Yaw = other.Yaw, Pitch = other.Pitch;
|
||||
return *this;
|
||||
}
|
||||
TRotator(const TRotator &other) = default;
|
||||
TRotator &operator= (const TRotator &other) = default;
|
||||
|
||||
// Access angles as an array
|
||||
Angle &operator[] (int index)
|
||||
|
|
|
@ -580,7 +580,7 @@ long FString::LastIndexOfAny (const char *charset, long endIndex) const
|
|||
|
||||
long FString::LastIndexOf (const FString &substr) const
|
||||
{
|
||||
return LastIndexOf(substr.Chars, Len() - substr.Len(), substr.Len());
|
||||
return LastIndexOf(substr.Chars, long(Len() - substr.Len()), substr.Len());
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const FString &substr, long endIndex) const
|
||||
|
@ -590,7 +590,7 @@ long FString::LastIndexOf (const FString &substr, long endIndex) const
|
|||
|
||||
long FString::LastIndexOf (const char *substr) const
|
||||
{
|
||||
return LastIndexOf(substr, Len() - strlen(substr), strlen(substr));
|
||||
return LastIndexOf(substr, long(Len() - strlen(substr)), strlen(substr));
|
||||
}
|
||||
|
||||
long FString::LastIndexOf (const char *substr, long endIndex) const
|
||||
|
@ -602,7 +602,7 @@ long FString::LastIndexOf (const char *substr, long endIndex, size_t substrlen)
|
|||
{
|
||||
if ((size_t)endIndex + substrlen > Len())
|
||||
{
|
||||
endIndex = Len() - substrlen;
|
||||
endIndex = long(Len() - substrlen);
|
||||
}
|
||||
while (endIndex >= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue