22 changes: 8 additions & 14 deletions src/terminal_chat_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ class TerminalChatConsole : public Thread {
public:

TerminalChatConsole() :
Thread("TerminalThread"),
m_log_level(LL_ACTION),
m_utf8_bytes_to_wait(0),
m_kill_requested(NULL),
m_esc_mode(false),
m_game_time(0),
m_time_of_day(0)
Thread("TerminalThread")
{}

void setup(
Expand All @@ -74,7 +68,7 @@ class TerminalChatConsole : public Thread {
virtual void *run();

// Highly required!
void clearKillStatus() { m_kill_requested = NULL; }
void clearKillStatus() { m_kill_requested = nullptr; }

void stopAndWaitforThread();

Expand Down Expand Up @@ -102,10 +96,10 @@ class TerminalChatConsole : public Thread {
~CursesInitHelper() { cons->deInitOfCurses(); }
};

int m_log_level;
int m_log_level = LL_ACTION;
std::string m_nick;

u8 m_utf8_bytes_to_wait;
u8 m_utf8_bytes_to_wait = 0;
std::string m_pending_utf8_bytes;

std::list<std::string> m_nicks;
Expand All @@ -114,16 +108,16 @@ class TerminalChatConsole : public Thread {
int m_rows;
bool m_can_draw_text;

bool *m_kill_requested;
bool *m_kill_requested = nullptr;
ChatBackend m_chat_backend;
ChatInterface *m_chat_interface;

TermLogOutput m_log_output;

bool m_esc_mode;
bool m_esc_mode = false;

u64 m_game_time;
u32 m_time_of_day;
u64 m_game_time = 0;
u32 m_time_of_day = 0;
};

extern TerminalChatConsole g_term_console;
Expand Down
23 changes: 8 additions & 15 deletions src/tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct ToolGroupCap
{
std::unordered_map<int, float> times;
int maxlevel;
int uses;
int maxlevel = 1;
int uses = 20;

ToolGroupCap():
maxlevel(1),
uses(20)
{}
ToolGroupCap() {}

bool getTime(int rating, float *time) const
{
Expand Down Expand Up @@ -118,15 +115,11 @@ HitParams getHitParams(const ItemGroupList &armor_groups,

struct PunchDamageResult
{
bool did_punch;
int damage;
int wear;

PunchDamageResult():
did_punch(false),
damage(0),
wear(0)
{}
bool did_punch = false;
int damage = 0;
int wear = 0;

PunchDamageResult() {}
};

struct ItemStack;
Expand Down
22 changes: 1 addition & 21 deletions src/touchscreengui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,10 @@ static void load_button_texture(button_info* btn, const char* path,

AutoHideButtonBar::AutoHideButtonBar(IrrlichtDevice *device,
IEventReceiver* receiver) :
m_texturesource(NULL),
m_driver(device->getVideoDriver()),
m_guienv(device->getGUIEnvironment()),
m_receiver(receiver),
m_active(false),
m_visible(true),
m_timeout(0),
m_timeout_value(3),
m_initialized(false),
m_dir(AHBB_Dir_Right_Left)
m_receiver(receiver)
{
m_screensize = device->getVideoDriver()->getScreenSize();

}

void AutoHideButtonBar::init(ISimpleTextureSource* tsrc,
Expand Down Expand Up @@ -416,16 +407,7 @@ void AutoHideButtonBar::show()
TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver):
m_device(device),
m_guienv(device->getGUIEnvironment()),
m_camera_yaw_change(0.0),
m_camera_pitch(0.0),
m_visible(false),
m_move_id(-1),
m_receiver(receiver),
m_move_has_really_moved(false),
m_move_downtime(0),
m_move_sent_as_mouse_event(false),
// use some downlocation way off screen as init value to avoid invalid behaviour
m_move_downlocation(v2s32(-10000, -10000)),
m_settingsbar(device, receiver),
m_rarecontrolsbar(device, receiver)
{
Expand Down Expand Up @@ -474,8 +456,6 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
u32 button_size = getGuiButtonSize();
m_visible = true;
m_texturesource = tsrc;
m_control_pad_rect = rect<s32>(0, m_screensize.Y - 3 * button_size,
3 * button_size, m_screensize.Y);
/*
draw control pad
0 1 2
Expand Down
36 changes: 15 additions & 21 deletions src/touchscreengui.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct button_info
float repeatdelay;
irr::EKEY_CODE keycode;
std::vector<int> ids;
IGUIButton *guibutton = NULL;
IGUIButton *guibutton = nullptr;
bool immediate_release;
};

Expand Down Expand Up @@ -114,27 +114,26 @@ class AutoHideButtonBar
void show();

private:
ISimpleTextureSource *m_texturesource;
ISimpleTextureSource *m_texturesource = nullptr;
irr::video::IVideoDriver *m_driver;
IGUIEnvironment *m_guienv;
IEventReceiver *m_receiver;
v2u32 m_screensize;
button_info m_starter;
std::vector<button_info *> m_buttons;

v2s32 m_upper_left;
v2s32 m_lower_right;

/* show settings bar */
bool m_active;
bool m_active = false;

bool m_visible;
bool m_visible = true;

/* settings bar timeout */
float m_timeout;
float m_timeout_value;
bool m_initialized;
autohide_button_bar_dir m_dir;
float m_timeout = 0.0f;
float m_timeout_value = 3.0f;
bool m_initialized = false;
autohide_button_bar_dir m_dir = AHBB_Dir_Right_Left;
};

class TouchScreenGUI
Expand Down Expand Up @@ -177,18 +176,16 @@ class TouchScreenGUI
bool m_visible; // is the gui visible

/* value in degree */
double m_camera_yaw_change;
double m_camera_pitch;
double m_camera_yaw_change = 0.0;
double m_camera_pitch = 0.0;

line3d<f32> m_shootline;

rect<s32> m_control_pad_rect;

int m_move_id;
bool m_move_has_really_moved;
s64 m_move_downtime;
bool m_move_sent_as_mouse_event;
v2s32 m_move_downlocation;
int m_move_id = -1;
bool m_move_has_really_moved = false;
s64 m_move_downtime = 0;
bool m_move_sent_as_mouse_event = false;
v2s32 m_move_downlocation = v2s32(-10000, -10000);

button_info m_buttons[after_last_element_id];

Expand All @@ -206,9 +203,6 @@ class TouchScreenGUI
std::wstring caption, bool immediate_release,
float repeat_delay = BUTTON_REPEAT_DELAY);

/* load texture */
void loadButtonTexture(button_info *btn, const char *path, rect<s32> button_rect);

struct id_status
{
int id;
Expand Down
8 changes: 3 additions & 5 deletions src/voxel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ u64 emerge_load_time = 0;
u64 clearflag_time = 0;


VoxelManipulator::VoxelManipulator():
m_data(NULL),
m_flags(NULL)
VoxelManipulator::VoxelManipulator()
{
}

Expand All @@ -49,9 +47,9 @@ void VoxelManipulator::clear()
// Reset area to volume=0
m_area = VoxelArea();
delete[] m_data;
m_data = NULL;
m_data = nullptr;
delete[] m_flags;
m_flags = NULL;
m_flags = nullptr;
}

void VoxelManipulator::print(std::ostream &o, INodeDefManager *ndef,
Expand Down
41 changes: 13 additions & 28 deletions src/voxel.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ class VoxelArea
{
public:
// Starts as zero sized
VoxelArea():
MinEdge(1,1,1),
MaxEdge(0,0,0)
{
}
VoxelArea() {}

VoxelArea(v3s16 min_edge, v3s16 max_edge):
MinEdge(min_edge),
MaxEdge(max_edge)
Expand Down Expand Up @@ -325,22 +322,22 @@ class VoxelArea
}

// Edges are inclusive
v3s16 MinEdge;
v3s16 MinEdge = v3s16(1,1,1);
v3s16 MaxEdge;
};

// unused
#define VOXELFLAG_UNUSED (1<<0)
// unused
#define VOXELFLAG_UNUSED (1 << 0)
// no data about that node
#define VOXELFLAG_NO_DATA (1<<1)
#define VOXELFLAG_NO_DATA (1 << 1)
// Algorithm-dependent
#define VOXELFLAG_CHECKED1 (1<<2)
#define VOXELFLAG_CHECKED1 (1 << 2)
// Algorithm-dependent
#define VOXELFLAG_CHECKED2 (1<<3)
#define VOXELFLAG_CHECKED2 (1 << 3)
// Algorithm-dependent
#define VOXELFLAG_CHECKED3 (1<<4)
#define VOXELFLAG_CHECKED3 (1 << 4)
// Algorithm-dependent
#define VOXELFLAG_CHECKED4 (1<<5)
#define VOXELFLAG_CHECKED4 (1 << 5)

enum VoxelPrintMode
{
Expand Down Expand Up @@ -570,29 +567,17 @@ class VoxelManipulator /*: public NodeContainer*/
VoxelArea m_area;

/*
NULL if data size is 0 (extent (0,0,0))
nullptr if data size is 0 (extent (0,0,0))
Data is stored as [z*h*w + y*h + x]
*/
MapNode *m_data;
MapNode *m_data = nullptr;

/*
Flags of all nodes
*/
u8 *m_flags;
u8 *m_flags = nullptr;

static const MapNode ContentIgnoreNode;

//TODO: Use these or remove them
//TODO: Would these make any speed improvement?
//bool m_pressure_route_valid;
//v3s16 m_pressure_route_surface;

/*
Some settings
*/
//bool m_disable_water_climb;

private:
};

#endif
Expand Down
9 changes: 2 additions & 7 deletions src/voxelalgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,14 +1402,9 @@ void repair_block_light(ServerMap *map, MapBlock *block,
modified_blocks);
}

VoxelLineIterator::VoxelLineIterator(
const v3f &start_position,
const v3f &line_vector) :
VoxelLineIterator::VoxelLineIterator(const v3f &start_position, const v3f &line_vector) :
m_start_position(start_position),
m_line_vector(line_vector),
m_next_intersection_multi(10000.0f, 10000.0f, 10000.0f),
m_intersection_multi_inc(10000.0f, 10000.0f, 10000.0f),
m_step_directions(1.0f, 1.0f, 1.0f)
m_line_vector(line_vector)
{
m_current_node_pos = floatToInt(m_start_position, 1);

Expand Down
6 changes: 3 additions & 3 deletions src/voxelalgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ struct VoxelLineIterator
* which multiplying the line's vector gives a vector that ends
* on the intersection of two nodes.
*/
v3f m_next_intersection_multi;
v3f m_next_intersection_multi = v3f(10000.0f, 10000.0f, 10000.0f);
/*!
* Each component stores the smallest positive number, by which
* m_next_intersection_multi's components can be increased.
*/
v3f m_intersection_multi_inc;
v3f m_intersection_multi_inc = v3f(10000.0f, 10000.0f, 10000.0f);
/*!
* Direction of the line. Each component can be -1 or 1 (if a
* component of the line's vector is 0, then there will be 1).
*/
v3s16 m_step_directions;
v3s16 m_step_directions = v3s16(1, 1, 1);
//! Position of the current node.
v3s16 m_current_node_pos;
//! If true, the next node will intersect the line, too.
Expand Down
34 changes: 15 additions & 19 deletions src/wieldmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ WieldMeshSceneNode::WieldMeshSceneNode(
bool lighting
):
scene::ISceneNode(parent, mgr, id),
m_meshnode(NULL),
m_material_type(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF),
m_lighting(lighting),
m_bounding_box(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
m_lighting(lighting)
{
m_enable_shaders = g_settings->getBool("enable_shaders");
m_anisotropic_filter = g_settings->getBool("anisotropic_filter");
Expand All @@ -211,7 +209,7 @@ WieldMeshSceneNode::WieldMeshSceneNode(

// If this is the first wield mesh scene node, create a cache
// for extrusion meshes (and a cube mesh), otherwise reuse it
if (g_extrusion_mesh_cache == NULL)
if (!g_extrusion_mesh_cache)
g_extrusion_mesh_cache = new ExtrusionMeshCache();
else
g_extrusion_mesh_cache->grab();
Expand All @@ -232,11 +230,11 @@ WieldMeshSceneNode::~WieldMeshSceneNode()
{
sanity_check(g_extrusion_mesh_cache);
if (g_extrusion_mesh_cache->drop())
g_extrusion_mesh_cache = NULL;
g_extrusion_mesh_cache = nullptr;
}

void WieldMeshSceneNode::setCube(const ContentFeatures &f,
v3f wield_scale, ITextureSource *tsrc)
v3f wield_scale)
{
scene::IMesh *cubemesh = g_extrusion_mesh_cache->createCube();
scene::SMesh *copy = cloneMesh(cubemesh);
Expand All @@ -252,7 +250,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
{
video::ITexture *texture = tsrc->getTexture(imagename);
if (!texture) {
changeToMesh(NULL);
changeToMesh(nullptr);
return;
}

Expand Down Expand Up @@ -335,13 +333,13 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
def.wield_scale * WIELD_SCALE_FACTOR
/ (BS * f.visual_scale));
} else if (f.drawtype == NDT_AIRLIKE) {
changeToMesh(NULL);
changeToMesh(nullptr);
} else if (f.drawtype == NDT_PLANTLIKE) {
setExtruded(tsrc->getTextureName(f.tiles[0].layers[0].texture_id),
def.wield_scale, tsrc,
f.tiles[0].layers[0].animation_frame_count);
} else if (f.drawtype == NDT_NORMAL || f.drawtype == NDT_ALLFACES) {
setCube(f, def.wield_scale, tsrc);
setCube(f, def.wield_scale);
} else {
MeshMakeData mesh_make_data(client, false);
MapNode mesh_make_node(id, 255, 0);
Expand Down Expand Up @@ -373,14 +371,14 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client)
}

// no wield mesh found
changeToMesh(NULL);
changeToMesh(nullptr);
}

void WieldMeshSceneNode::setColor(video::SColor c)
{
assert(!m_lighting);
scene::IMesh *mesh=m_meshnode->getMesh();
if (mesh == NULL)
scene::IMesh *mesh = m_meshnode->getMesh();
if (!mesh)
return;

u8 red = c.getRed();
Expand Down Expand Up @@ -408,7 +406,7 @@ void WieldMeshSceneNode::render()

void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
{
if (mesh == NULL) {
if (!mesh) {
scene::IMesh *dummymesh = g_extrusion_mesh_cache->createCube();
m_meshnode->setVisible(false);
m_meshnode->setMesh(dummymesh);
Expand Down Expand Up @@ -438,7 +436,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
g_extrusion_mesh_cache->grab();
}

scene::SMesh *mesh = NULL;
scene::SMesh *mesh = nullptr;

// Shading is on by default
result->needs_shading = true;
Expand Down Expand Up @@ -499,20 +497,18 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
rotateMeshXZby(mesh, -45);
rotateMeshYZby(mesh, -30);

postProcessNodeMesh(mesh, f, false, false, NULL,
&result->buffer_colors);
postProcessNodeMesh(mesh, f, false, false, nullptr, &result->buffer_colors);
}
result->mesh = mesh;
}



scene::SMesh * getExtrudedMesh(ITextureSource *tsrc,
const std::string &imagename)
scene::SMesh *getExtrudedMesh(ITextureSource *tsrc, const std::string &imagename)
{
video::ITexture *texture = tsrc->getTextureForMesh(imagename);
if (!texture) {
return NULL;
return nullptr;
}

core::dimension2d<u32> dim = texture->getSize();
Expand Down
16 changes: 8 additions & 8 deletions src/wieldmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ struct ItemPartColor
* will be used instead of the specific color of the
* buffer.
*/
bool override_base;
bool override_base = false;
/*!
* The color of the buffer.
*/
video::SColor color;
video::SColor color = 0;

ItemPartColor() : override_base(false), color(0) {}
ItemPartColor() {}

ItemPartColor(bool override, video::SColor color)
: override_base(override), color(color)
Expand All @@ -54,7 +54,7 @@ struct ItemPartColor

struct ItemMesh
{
scene::IMesh *mesh;
scene::IMesh *mesh = nullptr;
/*!
* Stores the color of each mesh buffer.
*/
Expand All @@ -63,9 +63,9 @@ struct ItemMesh
* If false, all faces of the item should have the same brightness.
* Disables shading based on normal vectors.
*/
bool needs_shading;
bool needs_shading = true;

ItemMesh() : mesh(NULL), buffer_colors(), needs_shading(true) {}
ItemMesh() {}
};

/*
Expand All @@ -78,7 +78,7 @@ class WieldMeshSceneNode : public scene::ISceneNode
s32 id = -1, bool lighting = false);
virtual ~WieldMeshSceneNode();

void setCube(const ContentFeatures &f, v3f wield_scale, ITextureSource *tsrc);
void setCube(const ContentFeatures &f, v3f wield_scale);
void setExtruded(const std::string &imagename, v3f wield_scale,
ITextureSource *tsrc, u8 num_frames);
void setItem(const ItemStack &item, Client *client);
Expand All @@ -97,7 +97,7 @@ class WieldMeshSceneNode : public scene::ISceneNode
void changeToMesh(scene::IMesh *mesh);

// Child scene node with the current wield mesh
scene::IMeshSceneNode *m_meshnode;
scene::IMeshSceneNode *m_meshnode = nullptr;
video::E_MATERIAL_TYPE m_material_type;

// True if EMF_LIGHTING should be enabled.
Expand Down