Browse Source

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

nephele-craftmethods
Loïc Blot 5 years ago committed by GitHub
parent
commit
4faaadc8d5
  1. 18
      src/mesh_generator_thread.cpp
  2. 33
      src/mesh_generator_thread.h
  3. 4
      src/mg_biome.h
  4. 22
      src/mg_decoration.cpp
  5. 16
      src/mg_decoration.h
  6. 11
      src/mg_ore.cpp
  7. 14
      src/mg_ore.h
  8. 8
      src/mg_schematic.cpp
  9. 6
      src/mg_schematic.h
  10. 8
      src/minimap.cpp
  11. 22
      src/minimap.h
  12. 6
      src/modalMenu.h
  13. 4
      src/mods.cpp
  14. 14
      src/mods.h
  15. 1
      src/nameidmapping.h
  16. 5
      src/nodedef.cpp
  17. 28
      src/nodedef.h
  18. 22
      src/nodetimer.h
  19. 4
      src/noise.cpp
  20. 43
      src/noise.h
  21. 22
      src/object_properties.cpp
  22. 38
      src/object_properties.h
  23. 3
      src/particles.cpp
  24. 6
      src/particles.h
  25. 6
      src/player.cpp
  26. 50
      src/player.h
  27. 2
      src/profiler.cpp
  28. 8
      src/profiler.h
  29. 3
      src/reflowscan.cpp
  30. 6
      src/reflowscan.h
  31. 10
      src/remoteplayer.cpp
  32. 16
      src/remoteplayer.h
  33. 3
      src/rollback.cpp
  34. 4
      src/rollback.h
  35. 18
      src/rollback_interface.h
  36. 26
      src/server.cpp
  37. 48
      src/server.h
  38. 13
      src/serverenvironment.cpp
  39. 27
      src/serverenvironment.h

18
src/mesh_generator_thread.cpp

@ -28,14 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -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() @@ -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;

33
src/mesh_generator_thread.h

@ -27,25 +27,25 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -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 @@ private: @@ -101,14 +101,11 @@ private:
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

4
src/mg_biome.h

@ -117,10 +117,10 @@ public: @@ -117,10 +117,10 @@ public:
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;
};

22
src/mg_decoration.cpp

@ -67,21 +67,6 @@ size_t DecorationManager::placeAllDecos(Mapgen *mg, u32 blockseed, @@ -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() @@ -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

16
src/mg_decoration.h

@ -64,8 +64,8 @@ struct CutoffData { @@ -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 @@ public: @@ -76,13 +76,13 @@ public:
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 @@ public: @@ -104,13 +104,13 @@ public:
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;
};

11
src/mg_ore.cpp

@ -72,14 +72,6 @@ void OreManager::clear() @@ -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, @@ -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, @@ -385,7 +375,6 @@ void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
OreVein::OreVein() :
Ore()
{
noise2 = NULL;
}

14
src/mg_ore.h

@ -62,13 +62,13 @@ public: @@ -62,13 +62,13 @@ public:
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 @@ public: @@ -104,8 +104,8 @@ public:
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 @@ public: @@ -127,7 +127,7 @@ public:
static const bool NEEDS_NOISE = true;
float random_factor;
Noise *noise2;
Noise *noise2 = nullptr;
OreVein();
virtual ~OreVein();
@ -160,7 +160,7 @@ public: @@ -160,7 +160,7 @@ public:
case ORE_VEIN:
return new OreVein;
default:
return NULL;
return nullptr;
}
}

8
src/mg_schematic.cpp

@ -37,9 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -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() @@ -69,10 +69,6 @@ void SchematicManager::clear()
Schematic::Schematic()
{
schemdata = NULL;
slice_probs = NULL;
flags = 0;
size = v3s16(0, 0, 0);
}

6
src/mg_schematic.h

@ -117,10 +117,10 @@ public: @@ -117,10 +117,10 @@ public:
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 {

8
src/minimap.cpp

@ -204,8 +204,6 @@ Minimap::Minimap(IrrlichtDevice *device, Client *client) @@ -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() @@ -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()

22
src/minimap.h

@ -78,21 +78,19 @@ struct MinimapData { @@ -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 @@ public: @@ -105,7 +103,7 @@ public:
bool pushBlockUpdate(v3s16 pos, MinimapMapblock *data);
bool popBlockUpdate(QueuedMinimapUpdate *update);
MinimapData *data;
MinimapData *data = nullptr;
protected:
virtual void doUpdate();

6
src/modalMenu.h

@ -48,11 +48,7 @@ public: @@ -48,11 +48,7 @@ public:
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 @@ private: @@ -142,7 +138,7 @@ private:
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;
};

4
src/mods.cpp

@ -385,10 +385,8 @@ Json::Value getModstoreUrl(const std::string &url) @@ -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()

14
src/mods.h

@ -42,19 +42,13 @@ struct ModSpec @@ -42,19 +42,13 @@ struct ModSpec
std::unordered_set<std::string> optdepends;
std::unordered_set<std::string> unsatisfied_depends;
bool part_of_modpack;
bool is_modpack;
bool part_of_modpack = false;
bool is_modpack = false;
// if modpack:
std::map<std::string,ModSpec> modpack_content;
ModSpec(const std::string &name_="", const std::string &path_=""):
name(name_),
path(path_),
depends(),
optdepends(),
unsatisfied_depends(),
part_of_modpack(false),
is_modpack(false),
modpack_content()
path(path_)
{}
};
@ -235,7 +229,7 @@ public: @@ -235,7 +229,7 @@ public:
virtual bool setString(const std::string &name, const std::string &var);
private:
std::string m_mod_name;
bool m_modified;
bool m_modified = false;
};
#endif

1
src/nameidmapping.h

@ -56,6 +56,7 @@ public: @@ -56,6 +56,7 @@ public:
m_id_to_name.erase(id);
m_name_to_id.erase(name);
}
void eraseName(const std::string &name)
{
u16 id;

5
src/nodedef.cpp

@ -1923,11 +1923,6 @@ bool CNodeDefManager::nodeboxConnects(MapNode from, MapNode to, u8 connect_face) @@ -1923,11 +1923,6 @@ bool CNodeDefManager::nodeboxConnects(MapNode from, MapNode to, u8 connect_face)
NodeResolver::NodeResolver()
{
m_ndef = NULL;
m_nodenames_idx = 0;
m_nnlistsizes_idx = 0;
m_resolve_done = false;
m_nodenames.reserve(16);
m_nnlistsizes.reserve(4);
}

28
src/nodedef.h

@ -207,24 +207,18 @@ enum PlantlikeStyle { @@ -207,24 +207,18 @@ enum PlantlikeStyle {
struct TileDef
{
std::string name;
bool backface_culling; // Takes effect only in special cases
bool tileable_horizontal;
bool tileable_vertical;
std::string name = "";
bool backface_culling = true; // Takes effect only in special cases
bool tileable_horizontal = true;
bool tileable_vertical = true;
//! If true, the tile has its own color.
bool has_color;
bool has_color = false;
//! The color of the tile.
video::SColor color;
video::SColor color = video::SColor(0xFFFFFFFF);
struct TileAnimationParams animation;
TileDef() :
name(""),
backface_culling(true),
tileable_horizontal(true),
tileable_vertical(true),
has_color(false),
color(video::SColor(0xFFFFFFFF))
TileDef()
{
animation.type = TAT_NONE;
}
@ -514,12 +508,12 @@ public: @@ -514,12 +508,12 @@ public:
void nodeResolveInternal();
u32 m_nodenames_idx;
u32 m_nnlistsizes_idx;
u32 m_nodenames_idx = 0;
u32 m_nnlistsizes_idx = 0;
std::vector<std::string> m_nodenames;
std::vector<size_t> m_nnlistsizes;
INodeDefManager *m_ndef;
bool m_resolve_done;
INodeDefManager *m_ndef = nullptr;
bool m_resolve_done = false;
};
#endif

22
src/nodetimer.h

@ -36,18 +36,18 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -36,18 +36,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class NodeTimer
{
public:
NodeTimer(): timeout(0.), elapsed(0.) {}
NodeTimer() {}
NodeTimer(const v3s16 &position_):
timeout(0.), elapsed(0.), position(position_) {}
position(position_) {}
NodeTimer(f32 timeout_, f32 elapsed_, v3s16 position_):
timeout(timeout_), elapsed(elapsed_), position(position_) {}
~NodeTimer() {}
void serialize(std::ostream &os) const;
void deSerialize(std::istream &is);
f32 timeout;
f32 elapsed;
f32 timeout = 0.0f;
f32 elapsed = 0.0f;
v3s16 position;
};
@ -58,12 +58,12 @@ public: @@ -58,12 +58,12 @@ public:
class NodeTimerList
{
public:
NodeTimerList(): m_next_trigger_time(-1.), m_time(0.) {}
NodeTimerList() {}
~NodeTimerList() {}
void serialize(std::ostream &os, u8 map_format_version) const;
void deSerialize(std::istream &is, u8 map_format_version);
// Get timer
NodeTimer get(const v3s16 &p) {
std::map<v3s16, std::multimap<double, NodeTimer>::iterator>::iterator n =
@ -128,8 +128,8 @@ public: @@ -128,8 +128,8 @@ public:
private:
std::multimap<double, NodeTimer> m_timers;
std::map<v3s16, std::multimap<double, NodeTimer>::iterator> m_iterators;
double m_next_trigger_time;
double m_time;
double m_next_trigger_time = -1.0;
double m_time = 0.0;
};
#endif

4
src/noise.cpp

@ -433,10 +433,6 @@ Noise::Noise(NoiseParams *np_, s32 seed, u32 sx, u32 sy, u32 sz) @@ -433,10 +433,6 @@ Noise::Noise(NoiseParams *np_, s32 seed, u32 sx, u32 sy, u32 sz)
this->sy = sy;
this->sz = sz;
this->persist_buf = NULL;
this->gradient_buf = NULL;
this->result = NULL;
allocBuffers();
}

43
src/noise.h

@ -102,26 +102,16 @@ private: @@ -102,26 +102,16 @@ private:
#define NOISE_FLAG_SIMPLEX 0x10
struct NoiseParams {
float offset;
float scale;
v3f spread;
s32 seed;
u16 octaves;
float persist;
float lacunarity;
u32 flags;
float offset = 0.0f;
float scale = 1.0f;
v3f spread = v3f(250, 250, 250);
s32 seed = 12345;
u16 octaves = 3;
float persist = 0.6f;
float lacunarity = 2.0f;
u32 flags = NOISE_FLAG_DEFAULTS;
NoiseParams()
{
offset = 0.0f;
scale = 1.0f;
spread = v3f(250, 250, 250);
seed = 12345;
octaves = 3;
persist = 0.6f;
lacunarity = 2.0f;
flags = NOISE_FLAG_DEFAULTS;
}
NoiseParams() {}
NoiseParams(float offset_, float scale_, v3f spread_, s32 seed_,
u16 octaves_, float persist_, float lacunarity_,
@ -138,13 +128,6 @@ struct NoiseParams { @@ -138,13 +128,6 @@ struct NoiseParams {
}
};
// Convenience macros for getting/setting NoiseParams in Settings as a string
// WARNING: Deprecated, use Settings::getNoiseParamsFromValue() instead
#define NOISEPARAMS_FMT_STR "f,f,v3,s32,u16,f"
//#define getNoiseParams(x, y) getStruct((x), NOISEPARAMS_FMT_STR, &(y), sizeof(y))
//#define setNoiseParams(x, y) setStruct((x), NOISEPARAMS_FMT_STR, &(y))
class Noise {
public:
NoiseParams np;
@ -152,10 +135,10 @@ public: @@ -152,10 +135,10 @@ public:
u32 sx;
u32 sy;
u32 sz;
float *noise_buf;
float *gradient_buf;
float *persist_buf;
float *result;
float *noise_buf = nullptr;
float *gradient_buf = nullptr;
float *persist_buf = nullptr;
float *result = nullptr;
Noise(NoiseParams *np, s32 seed, u32 sx, u32 sy, u32 sz=1);
~Noise();

22
src/object_properties.cpp

@ -24,27 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -24,27 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/basic_macros.h"
#include <sstream>
ObjectProperties::ObjectProperties():
hp_max(1),
physical(false),
collideWithObjects(true),
weight(5),
collisionbox(-0.5,-0.5,-0.5, 0.5,0.5,0.5),
visual("sprite"),
mesh(""),
visual_size(1,1),
spritediv(1,1),
initial_sprite_basepos(0,0),
is_visible(true),
makes_footstep_sound(false),
automatic_rotate(0),
stepheight(0),
automatic_face_movement_dir(false),
automatic_face_movement_dir_offset(0.0),
backface_culling(true),
nametag(""),
nametag_color(255, 255, 255, 255),
automatic_face_movement_max_rotation_per_sec(-1)
ObjectProperties::ObjectProperties()
{
textures.push_back("unknown_object.png");
colors.push_back(video::SColor(255,255,255,255));

38
src/object_properties.h

@ -29,28 +29,28 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -29,28 +29,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct ObjectProperties
{
// Values are BS=1
s16 hp_max;
bool physical;
bool collideWithObjects;
float weight;
aabb3f collisionbox;
std::string visual;
std::string mesh;
v2f visual_size;
s16 hp_max = 1;
bool physical = false;
bool collideWithObjects = true;
float weight = 5.0f;
aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
std::string visual = "sprite";
std::string mesh = "";
v2f visual_size = v2f(1, 1);
std::vector<std::string> textures;
std::vector<video::SColor> colors;
v2s16 spritediv;
v2s16 spritediv = v2s16(1, 1);
v2s16 initial_sprite_basepos;
bool is_visible;
bool makes_footstep_sound;
float automatic_rotate;
f32 stepheight;
bool automatic_face_movement_dir;
f32 automatic_face_movement_dir_offset;
bool backface_culling;
std::string nametag;
video::SColor nametag_color;
f32 automatic_face_movement_max_rotation_per_sec;
bool is_visible = true;
bool makes_footstep_sound = false;
float automatic_rotate = 0.0f;
f32 stepheight = 0.0f;
bool automatic_face_movement_dir = false;
f32 automatic_face_movement_dir_offset = 0.0f;
bool backface_culling = true;
std::string nametag = "";
video::SColor nametag_color = video::SColor(255, 255, 255, 255);
f32 automatic_face_movement_max_rotation_per_sec = -1.0f;
std::string infotext;
//! For dropped items, this contains item information.
std::string wield_item;

3
src/particles.cpp

@ -76,8 +76,6 @@ Particle::Particle( @@ -76,8 +76,6 @@ Particle::Particle(
m_texpos = texpos;
m_texsize = texsize;
m_animation = anim;
m_animation_frame = 0;
m_animation_time = 0.0;
// Color
m_base_color = color;
@ -88,7 +86,6 @@ Particle::Particle( @@ -88,7 +86,6 @@ Particle::Particle(
m_velocity = velocity;
m_acceleration = acceleration;
m_expiration = expirationtime;
m_time = 0;
m_player = player;
m_size = size;
m_collisiondetection = collisiondetection;

6
src/particles.h

@ -86,7 +86,7 @@ private: @@ -86,7 +86,7 @@ private:
void updateVertices();
video::S3DVertex m_vertices[4];
float m_time;
float m_time = 0.0f;
float m_expiration;
ClientEnvironment *m_env;
@ -110,8 +110,8 @@ private: @@ -110,8 +110,8 @@ private:
bool m_vertical;
v3s16 m_camera_offset;
struct TileAnimationParams m_animation;
float m_animation_time;
int m_animation_frame;
float m_animation_time = 0.0f;
int m_animation_frame = 0;
u8 m_glow;
};

6
src/player.cpp

@ -30,11 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -30,11 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Player::Player(const char *name, IItemDefManager *idef):
inventory(idef),
peer_id(PEER_ID_INEXISTENT),
keyPressed(0),
// protected
m_speed(0,0,0)
inventory(idef)
{
strlcpy(m_name, name, PLAYERNAME_SIZE);

50
src/player.h

@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_bloated.h"
#include "inventory.h"
#include "constants.h"
#include <list>
#include <mutex>
@ -32,22 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -32,22 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct PlayerControl
{
PlayerControl()
{
up = false;
down = false;
left = false;
right = false;
jump = false;
aux1 = false;
sneak = false;
LMB = false;
RMB = false;
pitch = 0;
yaw = 0;
sidew_move_joystick_axis = .0f;
forw_move_joystick_axis = .0f;
}
PlayerControl() {}
PlayerControl(
bool a_up,
@ -81,20 +67,20 @@ struct PlayerControl @@ -81,20 +67,20 @@ struct PlayerControl
sidew_move_joystick_axis = a_sidew_move_joystick_axis;
forw_move_joystick_axis = a_forw_move_joystick_axis;
}
bool up;
bool down;
bool left;
bool right;
bool jump;
bool aux1;
bool sneak;
bool zoom;
bool LMB;
bool RMB;
float pitch;
float yaw;
float sidew_move_joystick_axis;
float forw_move_joystick_axis;
bool up = false;
bool down = false;
bool left = false;
bool right = false;
bool jump = false;
bool aux1 = false;
bool sneak = false;
bool zoom = false;
bool LMB = false;
bool RMB = false;
float pitch = 0.0f;
float yaw = 0.0f;
float sidew_move_joystick_axis = 0.0f;
float forw_move_joystick_axis = 0.0f;
};
class Map;
@ -161,14 +147,14 @@ public: @@ -161,14 +147,14 @@ public:
v2s32 local_animations[4];
float local_animation_speed;
u16 peer_id;
u16 peer_id = PEER_ID_INEXISTENT;
std::string inventory_formspec;
PlayerControl control;
const PlayerControl& getPlayerControl() { return control; }
u32 keyPressed;
u32 keyPressed = 0;
HudElement* getHud(u32 id);
u32 addHud(HudElement* hud);

2
src/profiler.cpp

@ -23,7 +23,7 @@ static Profiler main_profiler; @@ -23,7 +23,7 @@ static Profiler main_profiler;
Profiler *g_profiler = &main_profiler;
ScopeProfiler::ScopeProfiler(
Profiler *profiler, const std::string &name, ScopeProfilerType type)
: m_profiler(profiler), m_name(name), m_timer(NULL), m_type(type)
: m_profiler(profiler), m_name(name), m_type(type)
{
if (m_profiler)
m_timer = new TimeTaker(m_name);

8
src/profiler.h

@ -42,9 +42,7 @@ extern Profiler *g_profiler; @@ -42,9 +42,7 @@ extern Profiler *g_profiler;
class Profiler
{
public:
Profiler()
{
}
Profiler() {}
void add(const std::string &name, float value)
{
@ -195,9 +193,9 @@ public: @@ -195,9 +193,9 @@ public:
ScopeProfilerType type = SPT_ADD);
~ScopeProfiler();
private:
Profiler *m_profiler;
Profiler *m_profiler = nullptr;
std::string m_name;
TimeTaker *m_timer;
TimeTaker *m_timer = nullptr;
enum ScopeProfilerType m_type;
};

3
src/reflowscan.cpp

@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., @@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
ReflowScan::ReflowScan(Map *map, INodeDefManager *ndef) :
m_map(map),
m_ndef(ndef),
m_liquid_queue(nullptr)
m_ndef(ndef)
{
}

6
src/reflowscan.h

@ -39,10 +39,10 @@ private: @@ -39,10 +39,10 @@ private:
void scanColumn(int x, int z);
private:
Map *m_map;
INodeDefManager *m_ndef;
Map *m_map = nullptr;
INodeDefManager *m_ndef = nullptr;
v3s16 m_block_pos, m_rel_block_pos;
UniqueQueue<v3s16> *m_liquid_queue;
UniqueQueue<v3s16> *m_liquid_queue = nullptr;
MapBlock *m_lookup[3 * 3 * 3];
u32 m_lookup_state_bitset;
};

10
src/remoteplayer.cpp

@ -36,15 +36,7 @@ float RemotePlayer::m_setting_chat_message_limit_per_10sec = 0.0f; @@ -36,15 +36,7 @@ float RemotePlayer::m_setting_chat_message_limit_per_10sec = 0.0f;
u16 RemotePlayer::m_setting_chat_message_limit_trigger_kick = 0;
RemotePlayer::RemotePlayer(const char *name, IItemDefManager *idef):
Player(name, idef),
protocol_version(0),
m_sao(NULL),
m_dirty(false),
m_last_chat_message_sent(time(NULL)),
m_chat_message_allowance(5.0f),
m_message_rate_overhead(0),
hud_hotbar_image(""),
hud_hotbar_selected_image("")
Player(name, idef)
{
if (!RemotePlayer::m_setting_cache_loaded) {
RemotePlayer::m_setting_chat_message_limit_per_10sec =

16
src/remoteplayer.h

@ -134,7 +134,7 @@ public: @@ -134,7 +134,7 @@ public:
void setDirty(bool dirty) { m_dirty = true; }
u16 protocol_version;
u16 protocol_version = 0;
private:
/*
@ -145,21 +145,21 @@ private: @@ -145,21 +145,21 @@ private:
void serialize(std::ostream &os);
void serializeExtraAttributes(std::string &output);
PlayerSAO *m_sao;
bool m_dirty;
PlayerSAO *m_sao = nullptr;
bool m_dirty = false;
static bool m_setting_cache_loaded;
static float m_setting_chat_message_limit_per_10sec;
static u16 m_setting_chat_message_limit_trigger_kick;
u32 m_last_chat_message_sent;
float m_chat_message_allowance;
u16 m_message_rate_overhead;
u32 m_last_chat_message_sent = std::time(0);
float m_chat_message_allowance = 5.0f;
u16 m_message_rate_overhead = 0;
bool m_day_night_ratio_do_override;
float m_day_night_ratio;
std::string hud_hotbar_image;
std::string hud_hotbar_selected_image;
std::string hud_hotbar_image = "";
std::string hud_hotbar_selected_image = "";
std::string m_sky_type;
video::SColor m_sky_bgcolor;

3
src/rollback.cpp

@ -91,8 +91,7 @@ struct Entity { @@ -91,8 +91,7 @@ struct Entity {
RollbackManager::RollbackManager(const std::string & world_path,
IGameDef * gamedef_) :
gamedef(gamedef_),
current_actor_is_guess(false)
gamedef(gamedef_)
{
verbosestream << "RollbackManager::RollbackManager(" << world_path
<< ")" << std::endl;

4
src/rollback.h

@ -80,10 +80,10 @@ private: @@ -80,10 +80,10 @@ private:
time_t suspect_t, v3s16 action_p, time_t action_t);
IGameDef * gamedef;
IGameDef *gamedef = nullptr;
std::string current_actor;
bool current_actor_is_guess;
bool current_actor_is_guess = false;
std::list<RollbackAction> action_todisk_buffer;
std::list<RollbackAction> action_latest_buffer;

18
src/rollback_interface.h

@ -35,8 +35,8 @@ class InventoryManager; @@ -35,8 +35,8 @@ class InventoryManager;
struct RollbackNode
{
std::string name;
int param1;
int param2;
int param1 = 0;
int param2 = 0;
std::string meta;
bool operator == (const RollbackNode &other)
@ -46,11 +46,7 @@ struct RollbackNode @@ -46,11 +46,7 @@ struct RollbackNode
}
bool operator != (const RollbackNode &other) { return !(*this == other); }
RollbackNode():
param1(0),
param2(0)
{}
RollbackNode() {}
RollbackNode(Map *map, v3s16 p, IGameDef *gamedef);
};
@ -70,7 +66,7 @@ struct RollbackAction @@ -70,7 +66,7 @@ struct RollbackAction
v3s16 p;
RollbackNode n_old;
RollbackNode n_new;
std::string inventory_location;
std::string inventory_list;
u32 inventory_index;
@ -103,13 +99,13 @@ struct RollbackAction @@ -103,13 +99,13 @@ struct RollbackAction
inventory_add = add_;
inventory_stack = inventory_stack_;
}
// String should not contain newlines or nulls
std::string toString() const;
// Eg. flowing water level changes are not important
bool isImportant(IGameDef *gamedef) const;
bool getPosition(v3s16 *dst) const;
bool applyRevert(Map *map, InventoryManager *imgr, IGameDef *gamedef) const;

26
src/server.cpp

@ -156,41 +156,19 @@ Server::Server( @@ -156,41 +156,19 @@ Server::Server(
m_simple_singleplayer_mode(simple_singleplayer_mode),
m_dedicated(dedicated),
m_async_fatal_error(""),
m_env(NULL),
m_con(PROTOCOL_ID,
512,
CONNECTION_TIMEOUT,
ipv6,
this),
m_banmanager(NULL),
m_rollback(NULL),
m_enable_rollback_recording(false),
m_emerge(NULL),
m_script(NULL),
m_itemdef(createItemDefManager()),
m_nodedef(createNodeDefManager()),
m_craftdef(createCraftDefManager()),
m_event(new EventManager()),
m_thread(NULL),
m_time_of_day_send_timer(0),
m_uptime(0),
m_clients(&m_con),
m_shutdown_requested(false),
m_shutdown_ask_reconnect(false),
m_shutdown_timer(0.0f),
m_admin_chat(iface),
m_ignore_map_edit_events(false),
m_ignore_map_edit_events_peer_id(0),
m_next_sound_id(0),
m_mod_storage_save_timer(10.0f)
{
m_liquid_transform_timer = 0.0;
m_liquid_transform_every = 1.0;
m_masterserver_timer = 0.0;
m_emergethread_trigger_timer = 0.0;
m_savemap_timer = 0.0;
m_step_dtime = 0.0;
m_admin_chat(iface)
{
m_lag = g_settings->getFloat("dedicated_server_step");
if(path_world == "")

48
src/server.h

@ -113,8 +113,8 @@ struct ServerSoundParams @@ -113,8 +113,8 @@ struct ServerSoundParams
float fade = 0.0f;
float pitch = 1.0f;
bool loop = false;
float max_hear_distance = 32*BS;
v3f pos = v3f(0, 0, 0);
float max_hear_distance = 32 * BS;
v3f pos;
u16 object = 0;
std::string to_player = "";
@ -142,7 +142,7 @@ public: @@ -142,7 +142,7 @@ public:
bool simple_singleplayer_mode,
bool ipv6,
bool dedicated,
ChatInterface *iface = NULL
ChatInterface *iface = nullptr
);
~Server();
DISABLE_CLASS_COPY(Server);
@ -521,32 +521,32 @@ private: @@ -521,32 +521,32 @@ private:
MutexedVariable<std::string> m_async_fatal_error;
// Some timers
float m_liquid_transform_timer;
float m_liquid_transform_every;
float m_masterserver_timer;
float m_emergethread_trigger_timer;
float m_savemap_timer;
float m_liquid_transform_timer = 0.0f;
float m_liquid_transform_every = 1.0f;
float m_masterserver_timer = 0.0f;
float m_emergethread_trigger_timer = 0.0f;
float m_savemap_timer = 0.0f;
IntervalLimiter m_map_timer_and_unload_interval;
// Environment
ServerEnvironment *m_env;
ServerEnvironment *m_env = nullptr;
// server connection
con::Connection m_con;
// Ban checking
BanManager *m_banmanager;
BanManager *m_banmanager = nullptr;
// Rollback manager (behind m_env_mutex)
IRollbackManager *m_rollback;
bool m_enable_rollback_recording; // Updated once in a while
IRollbackManager *m_rollback = nullptr;
bool m_enable_rollback_recording = false; // Updated once in a while
// Emerge manager
EmergeManager *m_emerge;
EmergeManager *m_emerge = nullptr;
// Scripting
// Envlock and conlock should be locked when using Lua
ServerScripting *m_script;
ServerScripting *m_script = nullptr;
// Item definition manager
IWritableItemDefManager *m_itemdef;
@ -569,21 +569,21 @@ private: @@ -569,21 +569,21 @@ private:
// A buffer for time steps
// step() increments and AsyncRunStep() run by m_thread reads it.
float m_step_dtime;
float m_step_dtime = 0.0f;
std::mutex m_step_dtime_mutex;
// current server step lag counter
float m_lag;
// The server mainly operates in this thread
ServerThread *m_thread;
ServerThread *m_thread = nullptr;
/*
Time related stuff
*/
// Timer for sending time of day over network
float m_time_of_day_send_timer;
float m_time_of_day_send_timer = 0.0f;
// Uptime of server in seconds
MutexedVariable<double> m_uptime;
/*
@ -602,10 +602,10 @@ private: @@ -602,10 +602,10 @@ private:
Random stuff
*/
bool m_shutdown_requested;