Skip to content

Use default member initializer to simplify ctors #1017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions code/Ragl/graph_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -1145,9 +1145,7 @@ class graph_vs : public ratl::ratl_base
////////////////////////////////////////////////////////////////////////////////
search_node(int Node=-1, int Parent=-1) :
mNode(Node),
mParentVisit(Parent),
mCostToGoal(-1),
mCostFromStart(0)
mParentVisit(Parent)
{}
search_node(const search_node& t) :
mNode(t.mNode),
Expand Down Expand Up @@ -1197,8 +1195,8 @@ class graph_vs : public ratl::ratl_base
int mNode; // Which Node Is This (Index To Pool mNodes)
int mParentVisit; // Which Search Node (In Visited)

float mCostToGoal; // How Far From The Start Of The Search Are We?
float mCostFromStart; // How Far From The End Of The Search Are We?
float mCostToGoal{-1}; // How Far From The Start Of The Search Are We?
float mCostFromStart{0}; // How Far From The End Of The Search Are We?
};


Expand Down
8 changes: 4 additions & 4 deletions code/Ratl/map_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -129,8 +129,8 @@ class tree_base

private:
pool_base<TStorageTraits> mPool; // The Allocation Data Pool
int mRoot;
int mLastAdd;
int mRoot{tree_node::NULL_NODE};
int mLastAdd{-1};


void link_left(int node,int left)
Expand Down Expand Up @@ -716,7 +716,7 @@ class tree_base
////////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////////
tree_base() : mRoot(tree_node::NULL_NODE), mLastAdd(-1)
tree_base()
{
}

Expand Down
6 changes: 3 additions & 3 deletions code/Ratl/pool_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -75,7 +75,7 @@ class pool_root : public ratl_base
array_base<TStorageTraits> mData;
queue_vs<int, CAPACITY> mFree;
bits_base<CAPACITY> mUsed;
int mSize;
int mSize{0};


void FillFreeList()
Expand Down Expand Up @@ -105,7 +105,7 @@ class pool_root : public ratl_base
////////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////////
pool_root() : mSize(0)
pool_root()
{
FillFreeList();
}
Expand Down
10 changes: 5 additions & 5 deletions code/Ratl/queue_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -74,9 +74,9 @@ class queue_base : public ratl_base
// Data
////////////////////////////////////////////////////////////////////////////////////
array_base<TStorageTraits> mData; // The Memory
int mPush; // Address Of Next Add Location
int mPop; // Address Of Next Remove Location
int mSize;
int mPush{0}; // Address Of Next Add Location
int mPop{0}; // Address Of Next Remove Location
int mSize{0};


int push_low()
Expand Down Expand Up @@ -104,7 +104,7 @@ class queue_base : public ratl_base
////////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////////
queue_base() : mPush(0), mPop(0), mSize(0)
queue_base()
{
}

Expand Down
6 changes: 3 additions & 3 deletions code/Ratl/stack_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -69,14 +69,14 @@ class stack_base : public ratl_base
// Data
////////////////////////////////////////////////////////////////////////////////////
array_base<TStorageTraits> mData; // The Memory
int mSize;
int mSize{0};

public:

////////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////////
stack_base() : mSize(0)
stack_base()
{
}

Expand Down
6 changes: 3 additions & 3 deletions code/Ratl/string_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -307,7 +307,7 @@ class string_vs : public ratl_base
public:
// Constructors
//--------------
tokenizer() : mLoc(0)
tokenizer()
{}
tokenizer(const char* t, const char* gap)
{
Expand Down Expand Up @@ -352,7 +352,7 @@ class string_vs : public ratl_base
// Data
//------
private:
char* mLoc;
char* mLoc{0};
char mGap[TOKEN_GAP_LEN];
};

Expand Down
14 changes: 7 additions & 7 deletions code/Ratl/vector_vs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -466,13 +466,13 @@ class vector_base : public ratl_base
friend class const_iterator;
// Data
//------
int mLoc;
vector_base<T>* mOwner;
int mLoc{0};
vector_base<T>* mOwner{0};

public:
// Constructors
//--------------
iterator() : mOwner(0), mLoc(0)
iterator()
{}
iterator(vector_base<T>* p, int t) : mOwner(p), mLoc(t)
{}
Expand Down Expand Up @@ -551,13 +551,13 @@ class vector_base : public ratl_base
{
friend class vector_base<T>;

int mLoc;
const vector_base<T>* mOwner;
int mLoc{0};
const vector_base<T>* mOwner{0};

public:
// Constructors
//--------------
const_iterator() : mOwner(0), mLoc(0)
const_iterator()
{}
const_iterator(const vector_base<T>* p, int t) : mOwner(p), mLoc(t)
{}
Expand Down
10 changes: 4 additions & 6 deletions code/cgame/FxScheduler.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
===========================================================================
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Expand Down Expand Up @@ -396,7 +396,6 @@ class PoolAllocator
: pool (new T[N])
, freeAndAllocated (new int[N])
, numFree (N)
, highWatermark (0)
{
for ( int i = 0; i < N; i++ )
{
Expand Down Expand Up @@ -486,16 +485,15 @@ class PoolAllocator
int *freeAndAllocated;
int numFree;

int highWatermark;
int highWatermark{0};
};

template<typename T, int N>
class PagedPoolAllocator
{
public:
PagedPoolAllocator ()
: numPages (1)
, pages (new PoolAllocator<T, N>[1]())
: pages (new PoolAllocator<T, N>[1]())
{
}

Expand Down Expand Up @@ -559,7 +557,7 @@ class PagedPoolAllocator
}

private:
int numPages;
int numPages{1};
PoolAllocator<T, N> *pages;
};

Expand Down
Loading