aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodedef.h')
-rw-r--r--src/nodedef.h38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/nodedef.h b/src/nodedef.h
index 8c817179d..edd8d00a7 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -99,17 +99,8 @@ enum NodeBoxType
NODEBOX_CONNECTED, // optionally draws nodeboxes if a neighbor node attaches
};
-struct NodeBox
+struct NodeBoxConnected
{
- enum NodeBoxType type;
- // NODEBOX_REGULAR (no parameters)
- // NODEBOX_FIXED
- std::vector<aabb3f> fixed;
- // NODEBOX_WALLMOUNTED
- aabb3f wall_top;
- aabb3f wall_bottom;
- aabb3f wall_side; // being at the -X side
- // NODEBOX_CONNECTED
std::vector<aabb3f> connect_top;
std::vector<aabb3f> connect_bottom;
std::vector<aabb3f> connect_front;
@@ -124,9 +115,35 @@ struct NodeBox
std::vector<aabb3f> disconnected_right;
std::vector<aabb3f> disconnected;
std::vector<aabb3f> disconnected_sides;
+};
+
+struct NodeBox
+{
+ enum NodeBoxType type;
+ // NODEBOX_REGULAR (no parameters)
+ // NODEBOX_FIXED
+ std::vector<aabb3f> fixed;
+ // NODEBOX_WALLMOUNTED
+ aabb3f wall_top;
+ aabb3f wall_bottom;
+ aabb3f wall_side; // being at the -X side
+ // NODEBOX_CONNECTED
+ // (kept externally to not bloat the structure)
+ std::shared_ptr<NodeBoxConnected> connected;
NodeBox()
{ reset(); }
+ ~NodeBox() = default;
+
+ inline NodeBoxConnected &getConnected() {
+ if (!connected)
+ connected = std::make_shared<NodeBoxConnected>();
+ return *connected;
+ }
+ inline const NodeBoxConnected &getConnected() const {
+ assert(connected);
+ return *connected;
+ }
void reset();
void serialize(std::ostream &os, u16 protocol_version) const;
@@ -290,7 +307,6 @@ struct ContentFeatures
// up down right left back front
TileSpec tiles[6];
// Special tiles
- // - Currently used for flowing liquids
TileSpec special_tiles[CF_SPECIAL_COUNT];
u8 solidness; // Used when choosing which face is drawn
u8 visual_solidness; // When solidness=0, this tells how it looks like