summaryrefslogtreecommitdiff
path: root/src/mapnode.cpp
diff options
context:
space:
mode:
authorVitaliy <numzer0@yandex.ru>2018-12-22 19:36:24 +0300
committerLoïc Blot <nerzhul@users.noreply.github.com>2018-12-22 17:36:24 +0100
commit309e158fc818227aa08086a0478ba45d1ee3c769 (patch)
tree7b05605c6034ff1f37bf1b93709cf7d034f4f648 /src/mapnode.cpp
parent0990ddb3bb96ab2e4c7a1ee44ed79c4218477949 (diff)
downloadminetest-309e158fc818227aa08086a0478ba45d1ee3c769.tar.gz
minetest-309e158fc818227aa08086a0478ba45d1ee3c769.tar.bz2
minetest-309e158fc818227aa08086a0478ba45d1ee3c769.zip
mapnode: add const/noexcept (#8009)
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r--src/mapnode.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 4cc9985c0..3b19160e1 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -65,7 +65,7 @@ void MapNode::getColor(const ContentFeatures &f, video::SColor *color) const
*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)
@@ -84,8 +84,7 @@ void MapNode::setLight(enum LightBank bank, u8 a_light, const ContentFeatures &f
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));
}
@@ -106,7 +105,7 @@ bool MapNode::isLightDayNightEq(const NodeDefManager *nodemgr) const
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);
@@ -120,14 +119,14 @@ u8 MapNode::getLight(enum LightBank bank, const NodeDefManager *nodemgr) const
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);
@@ -530,7 +529,7 @@ static inline void getNeighborConnectingFace(
*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;
@@ -567,14 +566,14 @@ u8 MapNode::getNeighbors(v3s16 p, Map *map)
}
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())
@@ -584,7 +583,7 @@ void MapNode::getCollisionBoxes(const NodeDefManager *nodemgr,
}
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);
@@ -676,7 +675,7 @@ u32 MapNode::serializedLength(u8 version)
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");