summaryrefslogtreecommitdiff
path: root/src/client/tile.h
diff options
context:
space:
mode:
authorVincent Glize <vincentglize@hotmail.fr>2017-06-21 08:04:45 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-21 08:04:45 +0200
commitaf3badf7a9307acd4993764cd805718849e4f942 (patch)
tree0e096b45eebc2e20ae8a5be3faaedc9234217934 /src/client/tile.h
parent76074ad81abe68aa2b7af4d072b659f60f1af38c (diff)
downloadminetest-af3badf7a9307acd4993764cd805718849e4f942.tar.gz
minetest-af3badf7a9307acd4993764cd805718849e4f942.tar.bz2
minetest-af3badf7a9307acd4993764cd805718849e4f942.zip
C++11 cleanup on constructors dir client (#6012)
* C++11 cleanup on constructors dir client
Diffstat (limited to 'src/client/tile.h')
-rw-r--r--src/client/tile.h79
1 files changed, 28 insertions, 51 deletions
diff --git a/src/client/tile.h b/src/client/tile.h
index 23255c461..a810aa8e5 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -69,7 +69,7 @@ void clearTextureNameCache();
namespace irr {namespace scene {class IMesh;}}
struct TextureFromMeshParams
{
- scene::IMesh *mesh;
+ scene::IMesh *mesh = nullptr;
core::dimension2d<u32> dim;
std::string rtt_texture_name;
bool delete_texture_on_shutdown;
@@ -92,7 +92,7 @@ public:
ISimpleTextureSource(){}
virtual ~ISimpleTextureSource(){}
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL) = 0;
+ const std::string &name, u32 *id = nullptr) = 0;
};
class ITextureSource : public ISimpleTextureSource
@@ -104,9 +104,9 @@ public:
virtual std::string getTextureName(u32 id)=0;
virtual video::ITexture* getTexture(u32 id)=0;
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL)=0;
+ const std::string &name, u32 *id = nullptr)=0;
virtual video::ITexture* getTextureForMesh(
- const std::string &name, u32 *id = NULL) = 0;
+ const std::string &name, u32 *id = nullptr) = 0;
/*!
* Returns a palette from the given texture name.
* The pointer is valid until the texture source is
@@ -132,7 +132,7 @@ public:
virtual std::string getTextureName(u32 id)=0;
virtual video::ITexture* getTexture(u32 id)=0;
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL)=0;
+ const std::string &name, u32 *id = nullptr)=0;
virtual IrrlichtDevice* getDevice()=0;
virtual bool isKnownSourceImage(const std::string &name)=0;
virtual video::ITexture* generateTextureFromMesh(
@@ -180,17 +180,11 @@ enum MaterialType{
*/
struct FrameSpec
{
- FrameSpec():
- texture_id(0),
- texture(NULL),
- normal_texture(NULL),
- flags_texture(NULL)
- {
- }
- u32 texture_id;
- video::ITexture *texture;
- video::ITexture *normal_texture;
- video::ITexture *flags_texture;
+ FrameSpec() {}
+ u32 texture_id = 0;
+ video::ITexture *texture = nullptr;
+ video::ITexture *normal_texture = nullptr;
+ video::ITexture *flags_texture = nullptr;
};
#define MAX_TILE_LAYERS 2
@@ -198,25 +192,7 @@ struct FrameSpec
//! Defines a layer of a tile.
struct TileLayer
{
- TileLayer():
- texture(NULL),
- normal_texture(NULL),
- flags_texture(NULL),
- shader_id(0),
- texture_id(0),
- animation_frame_length_ms(0),
- animation_frame_count(1),
- material_type(TILE_MATERIAL_BASIC),
- material_flags(
- //0 // <- DEBUG, Use the one below
- MATERIAL_FLAG_BACKFACE_CULLING |
- MATERIAL_FLAG_TILEABLE_HORIZONTAL|
- MATERIAL_FLAG_TILEABLE_VERTICAL
- ),
- has_color(false),
- color()
- {
- }
+ TileLayer() {}
/*!
* Two layers are equal if they can be merged.
@@ -287,22 +263,26 @@ struct TileLayer
// Ordered for size, please do not reorder
- video::ITexture *texture;
- video::ITexture *normal_texture;
- video::ITexture *flags_texture;
+ video::ITexture *texture = nullptr;
+ video::ITexture *normal_texture = nullptr;
+ video::ITexture *flags_texture = nullptr;
- u32 shader_id;
+ u32 shader_id = 0;
- u32 texture_id;
+ u32 texture_id = 0;
- u16 animation_frame_length_ms;
- u8 animation_frame_count;
+ u16 animation_frame_length_ms = 0;
+ u8 animation_frame_count = 1;
- u8 material_type;
- u8 material_flags;
+ u8 material_type = TILE_MATERIAL_BASIC;
+ u8 material_flags =
+ //0 // <- DEBUG, Use the one below
+ MATERIAL_FLAG_BACKFACE_CULLING |
+ MATERIAL_FLAG_TILEABLE_HORIZONTAL|
+ MATERIAL_FLAG_TILEABLE_VERTICAL;
//! If true, the tile has its own color.
- bool has_color;
+ bool has_color = false;
std::vector<FrameSpec> frames;
@@ -318,10 +298,7 @@ struct TileLayer
*/
struct TileSpec
{
- TileSpec():
- rotation(0),
- emissive_light(0)
- {
+ TileSpec() {
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++)
layers[layer] = TileLayer();
}
@@ -341,9 +318,9 @@ struct TileSpec
&& emissive_light == other.emissive_light;
}
- u8 rotation;
+ u8 rotation = 0;
//! This much light does the tile emit.
- u8 emissive_light;
+ u8 emissive_light = 0;
//! The first is base texture, the second is overlay.
TileLayer layers[MAX_TILE_LAYERS];
};