aboutsummaryrefslogtreecommitdiff
path: root/src/util/pointedthing.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 16:19:54 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 16:19:54 +0100
commitad148587dcf5244c2d2011dba339786c765c54c4 (patch)
treebdd914121cd326da2ed26679838878e3edffc841 /src/util/pointedthing.cpp
parent1145b05ea0bda87dc0827821385810eced08f774 (diff)
downloaddragonfireclient-ad148587dcf5244c2d2011dba339786c765c54c4.tar.xz
Make Lint Happy
Diffstat (limited to 'src/util/pointedthing.cpp')
-rw-r--r--src/util/pointedthing.cpp64
1 files changed, 26 insertions, 38 deletions
diff --git a/src/util/pointedthing.cpp b/src/util/pointedthing.cpp
index b906264d0..89cf91f22 100644
--- a/src/util/pointedthing.cpp
+++ b/src/util/pointedthing.cpp
@@ -24,26 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sstream>
PointedThing::PointedThing(const v3s16 &under, const v3s16 &above,
- const v3s16 &real_under, const v3f &point, const v3s16 &normal,
- u16 box_id, f32 distSq):
- type(POINTEDTHING_NODE),
- node_undersurface(under),
- node_abovesurface(above),
- node_real_undersurface(real_under),
- intersection_point(point),
- intersection_normal(normal),
- box_id(box_id),
- distanceSq(distSq)
-{}
+ const v3s16 &real_under, const v3f &point, const v3s16 &normal,
+ u16 box_id, f32 distSq) :
+ type(POINTEDTHING_NODE),
+ node_undersurface(under), node_abovesurface(above),
+ node_real_undersurface(real_under), intersection_point(point),
+ intersection_normal(normal), box_id(box_id), distanceSq(distSq)
+{
+}
-PointedThing::PointedThing(s16 id, const v3f &point, const v3s16 &normal,
- f32 distSq) :
- type(POINTEDTHING_OBJECT),
- object_id(id),
- intersection_point(point),
- intersection_normal(normal),
- distanceSq(distSq)
-{}
+PointedThing::PointedThing(s16 id, const v3f &point, const v3s16 &normal, f32 distSq) :
+ type(POINTEDTHING_OBJECT), object_id(id), intersection_point(point),
+ intersection_normal(normal), distanceSq(distSq)
+{
+}
std::string PointedThing::dump() const
{
@@ -52,14 +46,12 @@ std::string PointedThing::dump() const
case POINTEDTHING_NOTHING:
os << "[nothing]";
break;
- case POINTEDTHING_NODE:
- {
+ case POINTEDTHING_NODE: {
const v3s16 &u = node_undersurface;
const v3s16 &a = node_abovesurface;
- os << "[node under=" << u.X << "," << u.Y << "," << u.Z << " above="
- << a.X << "," << a.Y << "," << a.Z << "]";
- }
- break;
+ os << "[node under=" << u.X << "," << u.Y << "," << u.Z
+ << " above=" << a.X << "," << a.Y << "," << a.Z << "]";
+ } break;
case POINTEDTHING_OBJECT:
os << "[object " << object_id << "]";
break;
@@ -89,9 +81,9 @@ void PointedThing::serialize(std::ostream &os) const
void PointedThing::deSerialize(std::istream &is)
{
int version = readU8(is);
- if (version != 0) throw SerializationError(
- "unsupported PointedThing version");
- type = (PointedThingType) readU8(is);
+ if (version != 0)
+ throw SerializationError("unsupported PointedThing version");
+ type = (PointedThingType)readU8(is);
switch (type) {
case POINTEDTHING_NOTHING:
break;
@@ -109,19 +101,15 @@ void PointedThing::deSerialize(std::istream &is)
bool PointedThing::operator==(const PointedThing &pt2) const
{
- if (type != pt2.type)
- {
+ if (type != pt2.type) {
return false;
}
- if (type == POINTEDTHING_NODE)
- {
- if ((node_undersurface != pt2.node_undersurface)
- || (node_abovesurface != pt2.node_abovesurface)
- || (node_real_undersurface != pt2.node_real_undersurface))
+ if (type == POINTEDTHING_NODE) {
+ if ((node_undersurface != pt2.node_undersurface) ||
+ (node_abovesurface != pt2.node_abovesurface) ||
+ (node_real_undersurface != pt2.node_real_undersurface))
return false;
- }
- else if (type == POINTEDTHING_OBJECT)
- {
+ } else if (type == POINTEDTHING_OBJECT) {
if (object_id != pt2.object_id)
return false;
}