*color = f.color;
}
-void MapNode::setLight(enum LightBank bank, u8 a_light, const ContentFeatures &f)
+void MapNode::setLight(LightBank bank, u8 a_light, const ContentFeatures &f) noexcept
{
// If node doesn't contain light data, ignore this
if(f.param_type != CPT_LIGHT)
assert("Invalid light bank" == NULL);
}
-void MapNode::setLight(enum LightBank bank, u8 a_light,
- const NodeDefManager *nodemgr)
+void MapNode::setLight(LightBank bank, u8 a_light, const NodeDefManager *nodemgr)
{
setLight(bank, a_light, nodemgr->get(*this));
}
return isEqual;
}
-u8 MapNode::getLight(enum LightBank bank, const NodeDefManager *nodemgr) const
+u8 MapNode::getLight(LightBank bank, const NodeDefManager *nodemgr) const
{
// Select the brightest of [light source, propagated light]
const ContentFeatures &f = nodemgr->get(*this);
return MYMAX(f.light_source, light);
}
-u8 MapNode::getLightRaw(enum LightBank bank, const ContentFeatures &f) const
+u8 MapNode::getLightRaw(LightBank bank, const ContentFeatures &f) const noexcept
{
if(f.param_type == CPT_LIGHT)
return bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f;
return 0;
}
-u8 MapNode::getLightNoChecks(enum LightBank bank, const ContentFeatures *f) const
+u8 MapNode::getLightNoChecks(LightBank bank, const ContentFeatures *f) const noexcept
{
return MYMAX(f->light_source,
bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f);
*neighbors |= bitmask;
}
-u8 MapNode::getNeighbors(v3s16 p, Map *map)
+u8 MapNode::getNeighbors(v3s16 p, Map *map) const
{
const NodeDefManager *nodedef = map->getNodeDefManager();
u8 neighbors = 0;
}
void MapNode::getNodeBoxes(const NodeDefManager *nodemgr,
- std::vector<aabb3f> *boxes, u8 neighbors)
+ std::vector<aabb3f> *boxes, u8 neighbors) const
{
const ContentFeatures &f = nodemgr->get(*this);
transformNodeBox(*this, f.node_box, nodemgr, boxes, neighbors);
}
void MapNode::getCollisionBoxes(const NodeDefManager *nodemgr,
- std::vector<aabb3f> *boxes, u8 neighbors)
+ std::vector<aabb3f> *boxes, u8 neighbors) const
{
const ContentFeatures &f = nodemgr->get(*this);
if (f.collision_box.fixed.empty())
}
void MapNode::getSelectionBoxes(const NodeDefManager *nodemgr,
- std::vector<aabb3f> *boxes, u8 neighbors)
+ std::vector<aabb3f> *boxes, u8 neighbors) const
{
const ContentFeatures &f = nodemgr->get(*this);
transformNodeBox(*this, f.selection_box, nodemgr, boxes, neighbors);
return 4;
}
-void MapNode::serialize(u8 *dest, u8 version)
+void MapNode::serialize(u8 *dest, u8 version) const
{
if(!ser_ver_supported(version))
throw VersionMismatchException("ERROR: MapNode format not supported");
MapNode() = default;
- MapNode(content_t content, u8 a_param1=0, u8 a_param2=0)
+ MapNode(content_t content, u8 a_param1=0, u8 a_param2=0) noexcept
: param0(content),
param1(a_param1),
param2(a_param2)
MapNode(const NodeDefManager *ndef, const std::string &name,
u8 a_param1=0, u8 a_param2=0);
- bool operator==(const MapNode &other)
+ bool operator==(const MapNode &other) const noexcept
{
return (param0 == other.param0
&& param1 == other.param1
}
// To be used everywhere
- content_t getContent() const
+ content_t getContent() const noexcept
{
return param0;
}
- void setContent(content_t c)
+ void setContent(content_t c) noexcept
{
param0 = c;
}
- u8 getParam1() const
+ u8 getParam1() const noexcept
{
return param1;
}
- void setParam1(u8 p)
+ void setParam1(u8 p) noexcept
{
param1 = p;
}
- u8 getParam2() const
+ u8 getParam2() const noexcept
{
return param2;
}
- void setParam2(u8 p)
+ void setParam2(u8 p) noexcept
{
param2 = p;
}
*/
void getColor(const ContentFeatures &f, video::SColor *color) const;
- void setLight(enum LightBank bank, u8 a_light, const ContentFeatures &f);
+ void setLight(LightBank bank, u8 a_light, const ContentFeatures &f) noexcept;
- void setLight(enum LightBank bank, u8 a_light,
- const NodeDefManager *nodemgr);
+ void setLight(LightBank bank, u8 a_light, const NodeDefManager *nodemgr);
/**
* Check if the light value for night differs from the light value for day.
*/
bool isLightDayNightEq(const NodeDefManager *nodemgr) const;
- u8 getLight(enum LightBank bank, const NodeDefManager *nodemgr) const;
+ u8 getLight(LightBank bank, const NodeDefManager *nodemgr) const;
/*!
* Returns the node's light level from param1.
* If the node emits light, it is ignored.
* \param f the ContentFeatures of this node.
*/
- u8 getLightRaw(enum LightBank bank, const ContentFeatures &f) const;
+ u8 getLightRaw(LightBank bank, const ContentFeatures &f) const noexcept;
/**
- * This function differs from getLight(enum LightBank bank, NodeDefManager *nodemgr)
+ * This function differs from getLight(LightBank bank, NodeDefManager *nodemgr)
* in that the ContentFeatures of the node in question are not retrieved by
* the function itself. Thus, if you have already called nodemgr->get() to
* get the ContentFeatures you pass it to this function instead of the
* @pre f != NULL
* @pre f->param_type == CPT_LIGHT
*/
- u8 getLightNoChecks(LightBank bank, const ContentFeatures *f) const;
+ u8 getLightNoChecks(LightBank bank, const ContentFeatures *f) const noexcept;
bool getLightBanks(u8 &lightday, u8 &lightnight,
const NodeDefManager *nodemgr) const;
return blend_light(daylight_factor, lightday, lightnight);
}
- u8 getFaceDir(const NodeDefManager *nodemgr,
- bool allow_wallmounted = false) const;
+ u8 getFaceDir(const NodeDefManager *nodemgr, bool allow_wallmounted = false) const;
u8 getWallMounted(const NodeDefManager *nodemgr) const;
v3s16 getWallMountedDir(const NodeDefManager *nodemgr) const;
*
* \param p coordinates of the node
*/
- u8 getNeighbors(v3s16 p, Map *map);
+ u8 getNeighbors(v3s16 p, Map *map) const;
/*
Gets list of node boxes (used for rendering (NDT_NODEBOX))
*/
void getNodeBoxes(const NodeDefManager *nodemgr, std::vector<aabb3f> *boxes,
- u8 neighbors = 0);
+ u8 neighbors = 0) const;
/*
Gets list of selection boxes
*/
void getSelectionBoxes(const NodeDefManager *nodemg,
- std::vector<aabb3f> *boxes, u8 neighbors = 0);
+ std::vector<aabb3f> *boxes, u8 neighbors = 0) const;
/*
Gets list of collision boxes
*/
void getCollisionBoxes(const NodeDefManager *nodemgr,
- std::vector<aabb3f> *boxes, u8 neighbors = 0);
+ std::vector<aabb3f> *boxes, u8 neighbors = 0) const;
/*
Liquid helpers
*/
static u32 serializedLength(u8 version);
- void serialize(u8 *dest, u8 version);
+ void serialize(u8 *dest, u8 version) const;
void deSerialize(u8 *source, u8 version);
// Serializes or deserializes a list of nodes in bulk format (first the