Skip to content
Permalink
Browse files

Cpp11 patchset 11: continue working on constructor style migration (#…

  • Loading branch information...
nerzhul committed Jun 18, 2017
1 parent 8f77857 commit 4faaadc8d50d6ab7a19d22bd5a760c4b8321a51f
@@ -28,14 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
CachedMapBlockData
*/

CachedMapBlockData::CachedMapBlockData():
p(-1337,-1337,-1337),
data(NULL),
refcount_from_queue(0),
last_used_timestamp(time(0))
{
}

CachedMapBlockData::~CachedMapBlockData()
{
assert(refcount_from_queue == 0);
@@ -47,16 +39,6 @@ CachedMapBlockData::~CachedMapBlockData()
QueuedMeshUpdate
*/

QueuedMeshUpdate::QueuedMeshUpdate():
p(-1337,-1337,-1337),
ack_block_to_server(false),
urgent(false),
crack_level(-1),
crack_pos(0,0,0),
data(NULL)
{
}

QueuedMeshUpdate::~QueuedMeshUpdate()
{
delete data;
@@ -27,25 +27,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,

struct CachedMapBlockData
{
v3s16 p;
MapNode *data; // A copy of the MapBlock's data member
int refcount_from_queue;
int last_used_timestamp;
v3s16 p = v3s16(-1337, -1337, -1337);
MapNode *data = nullptr; // A copy of the MapBlock's data member
int refcount_from_queue = 0;
int last_used_timestamp = std::time(0);

CachedMapBlockData();
CachedMapBlockData() {}
~CachedMapBlockData();
};

struct QueuedMeshUpdate
{
v3s16 p;
bool ack_block_to_server;
bool urgent;
int crack_level;
v3s16 p = v3s16(-1337, -1337, -1337);
bool ack_block_to_server = false;
bool urgent = false;
int crack_level = -1;
v3s16 crack_pos;
MeshMakeData *data; // This is generated in MeshUpdateQueue::pop()
MeshMakeData *data = nullptr; // This is generated in MeshUpdateQueue::pop()

QueuedMeshUpdate();
QueuedMeshUpdate(){};
~QueuedMeshUpdate();
};

@@ -101,14 +101,11 @@ class MeshUpdateQueue

struct MeshUpdateResult
{
v3s16 p;
MapBlockMesh *mesh;
bool ack_block_to_server;
v3s16 p = v3s16(-1338, -1338, -1338);
MapBlockMesh *mesh = nullptr;
bool ack_block_to_server = false;

MeshUpdateResult()
: p(-1338, -1338, -1338), mesh(NULL), ack_block_to_server(false)
{
}
MeshUpdateResult() {}
};

class MeshUpdateThread : public UpdateThread
@@ -117,10 +117,10 @@ class BiomeGen {
virtual Biome *getBiomeAtIndex(size_t index, s16 y) const = 0;

// Result of calcBiomes bulk computation.
biome_t *biomemap;
biome_t *biomemap = nullptr;

protected:
BiomeManager *m_bmgr;
BiomeManager *m_bmgr = nullptr;
v3s16 m_pmin;
v3s16 m_csize;
};
@@ -67,21 +67,6 @@ size_t DecorationManager::placeAllDecos(Mapgen *mg, u32 blockseed,

///////////////////////////////////////////////////////////////////////////////


Decoration::Decoration()
{
mapseed = 0;
fill_ratio = 0;
sidelen = 1;
flags = 0;
}


Decoration::~Decoration()
{
}


void Decoration::resolveNodeNames()
{
getIdsFromNrBacklog(&c_place_on);
@@ -330,13 +315,6 @@ int DecoSimple::getHeight()

///////////////////////////////////////////////////////////////////////////////


DecoSchematic::DecoSchematic()
{
schematic = NULL;
}


size_t DecoSchematic::generate(MMVManip *vm, PcgRandom *pr, v3s16 p)
{
// Schematic could have been unloaded but not the decoration
@@ -64,8 +64,8 @@ struct CutoffData {

class Decoration : public ObjDef, public NodeResolver {
public:
Decoration();
virtual ~Decoration();
Decoration() {};
virtual ~Decoration() {};

virtual void resolveNodeNames();

@@ -76,13 +76,13 @@ class Decoration : public ObjDef, public NodeResolver {
virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p) = 0;
virtual int getHeight() = 0;

u32 flags;
int mapseed;
u32 flags = 0;
int mapseed = 0;
std::vector<content_t> c_place_on;
s16 sidelen;
s16 sidelen = 1;
s16 y_min;
s16 y_max;
float fill_ratio;
float fill_ratio = 0.0f;
NoiseParams np;
std::vector<content_t> c_spawnby;
s16 nspawnby;
@@ -104,13 +104,13 @@ class DecoSimple : public Decoration {

class DecoSchematic : public Decoration {
public:
DecoSchematic();
DecoSchematic() {};

virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p);
virtual int getHeight();

Rotation rotation;
Schematic *schematic;
Schematic *schematic = nullptr;
};


@@ -72,14 +72,6 @@ void OreManager::clear()

///////////////////////////////////////////////////////////////////////////////


Ore::Ore()
{
flags = 0;
noise = NULL;
}


Ore::~Ore()
{
delete noise;
@@ -232,8 +224,6 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
OrePuff::OrePuff() :
Ore()
{
noise_puff_top = NULL;
noise_puff_bottom = NULL;
}


@@ -385,7 +375,6 @@ void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
OreVein::OreVein() :
Ore()
{
noise2 = NULL;
}


@@ -62,13 +62,13 @@ class Ore : public ObjDef, public NodeResolver {
s16 y_min;
s16 y_max;
u8 ore_param2; // to set node-specific attributes
u32 flags; // attributes for this ore
u32 flags = 0; // attributes for this ore
float nthresh; // threshold for noise at which an ore is placed
NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering)
Noise *noise;
Noise *noise = nullptr;
std::unordered_set<u8> biomes;

Ore();
Ore() {};
virtual ~Ore();

virtual void resolveNodeNames();
@@ -104,8 +104,8 @@ class OrePuff : public Ore {

NoiseParams np_puff_top;
NoiseParams np_puff_bottom;
Noise *noise_puff_top;
Noise *noise_puff_bottom;
Noise *noise_puff_top = nullptr;
Noise *noise_puff_bottom = nullptr;

OrePuff();
virtual ~OrePuff();
@@ -127,7 +127,7 @@ class OreVein : public Ore {
static const bool NEEDS_NOISE = true;

float random_factor;
Noise *noise2;
Noise *noise2 = nullptr;

OreVein();
virtual ~OreVein();
@@ -160,7 +160,7 @@ class OreManager : public ObjDefManager {
case ORE_VEIN:
return new OreVein;
default:
return NULL;
return nullptr;
}
}

@@ -37,9 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,


SchematicManager::SchematicManager(Server *server) :
ObjDefManager(server, OBJDEF_SCHEMATIC)
ObjDefManager(server, OBJDEF_SCHEMATIC),
m_server(server)
{
m_server = server;
}


@@ -69,10 +69,6 @@ void SchematicManager::clear()

Schematic::Schematic()
{
schemdata = NULL;
slice_probs = NULL;
flags = 0;
size = v3s16(0, 0, 0);
}


@@ -117,10 +117,10 @@ class Schematic : public ObjDef, public NodeResolver {
std::vector<std::pair<s16, u8> > *splist);

std::vector<content_t> c_nodes;
u32 flags;
u32 flags = 0;
v3s16 size;
MapNode *schemdata;
u8 *slice_probs;
MapNode *schemdata = nullptr;
u8 *slice_probs = nullptr;
};

class SchematicManager : public ObjDefManager {
@@ -204,8 +204,6 @@ Minimap::Minimap(IrrlichtDevice *device, Client *client)
data->mode = MINIMAP_MODE_OFF;
data->is_radar = false;
data->map_invalidated = true;
data->heightmap_image = NULL;
data->minimap_image = NULL;
data->texture = NULL;
data->heightmap_texture = NULL;
data->minimap_shape_round = g_settings->getBool("minimap_shape_round");
@@ -275,14 +273,14 @@ void Minimap::toggleMinimapShape()
void Minimap::setMinimapShape(MinimapShape shape)
{
MutexAutoLock lock(m_mutex);

if (shape == MINIMAP_SHAPE_SQUARE)
data->minimap_shape_round = false;
else if (shape == MINIMAP_SHAPE_ROUND)
data->minimap_shape_round = true;

g_settings->setBool("minimap_shape_round", data->minimap_shape_round);
m_minimap_update_thread->deferUpdate();
m_minimap_update_thread->deferUpdate();
}

MinimapShape Minimap::getMinimapShape()
@@ -78,21 +78,19 @@ struct MinimapData {
MinimapPixel minimap_scan[MINIMAP_MAX_SX * MINIMAP_MAX_SY];
bool map_invalidated;
bool minimap_shape_round;
video::IImage *minimap_image;
video::IImage *heightmap_image;
video::IImage *minimap_mask_round;
video::IImage *minimap_mask_square;
video::ITexture *texture;
video::ITexture *heightmap_texture;
video::ITexture *minimap_overlay_round;
video::ITexture *minimap_overlay_square;
video::ITexture *player_marker;
video::ITexture *object_marker_red;
video::IImage *minimap_mask_round = nullptr;
video::IImage *minimap_mask_square = nullptr;
video::ITexture *texture = nullptr;
video::ITexture *heightmap_texture = nullptr;
video::ITexture *minimap_overlay_round = nullptr;
video::ITexture *minimap_overlay_square = nullptr;
video::ITexture *player_marker = nullptr;
video::ITexture *object_marker_red = nullptr;
};

struct QueuedMinimapUpdate {
v3s16 pos;
MinimapMapblock *data;
MinimapMapblock *data = nullptr;
};

class MinimapUpdateThread : public UpdateThread {
@@ -105,7 +103,7 @@ class MinimapUpdateThread : public UpdateThread {
bool pushBlockUpdate(v3s16 pos, MinimapMapblock *data);
bool popBlockUpdate(QueuedMinimapUpdate *update);

MinimapData *data;
MinimapData *data = nullptr;

protected:
virtual void doUpdate();
@@ -48,11 +48,7 @@ class GUIModalMenu : public gui::IGUIElement
IGUIElement(gui::EGUIET_ELEMENT, env, parent, id,
core::rect<s32>(0,0,100,100))
{
//m_force_regenerate_gui = false;

m_menumgr = menumgr;
m_allow_focus_removal = false;
m_screensize_old = v2u32(0,0);

setVisible(true);
Environment->setFocus(this);
@@ -142,7 +138,7 @@ class GUIModalMenu : public gui::IGUIElement
IMenuManager *m_menumgr;
// This might be necessary to expose to the implementation if it
// wants to launch other menus
bool m_allow_focus_removal;
bool m_allow_focus_removal = false;
};


@@ -385,10 +385,8 @@ Json::Value getModstoreUrl(const std::string &url)
#endif

ModMetadata::ModMetadata(const std::string &mod_name):
m_mod_name(mod_name),
m_modified(false)
m_mod_name(mod_name)
{
m_stringvars.clear();
}

void ModMetadata::clear()
Oops, something went wrong.

0 comments on commit 4faaadc

Please sign in to comment.
You can’t perform that action at this time.