diff options
author | Auke Kok <sofar@foo-projects.org> | 2016-03-13 14:25:54 -0700 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-03-14 05:05:04 +0100 |
commit | 5a40a7dad8cbf46320c3b5dd1122808eb4919b62 (patch) | |
tree | 734df3c725f78ecd1379f2ee0d4afcb4359d125c | |
parent | 089f9bbe817debc5c30f1d845170909f638c9642 (diff) | |
download | minetest-5a40a7dad8cbf46320c3b5dd1122808eb4919b62.tar.gz minetest-5a40a7dad8cbf46320c3b5dd1122808eb4919b62.tar.bz2 minetest-5a40a7dad8cbf46320c3b5dd1122808eb4919b62.zip |
Connected nodes: fix 2 minor bugs
1. Copy-paste error: properly test for back-connection.
In the case of two different connected nodebox types, we want to
assure that if A connects to B, that B also connects to A. This test
was accidentally not implemented correctly.
2. Clear the connects_to_ids before deserializing.
With each new connected node, the deserialization code added more
and more targets to the map, since the map wasn't cleared in between
deserialization steps. This caused e.g. wall blocks to connect to
things in the fence connects_to map.
-rw-r--r-- | src/nodedef.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index edd02d9f3..3a2cb00b1 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -479,6 +479,7 @@ void ContentFeatures::deSerialize(std::istream &is) collision_box.deSerialize(is); floodable = readU8(is); u16 connects_to_size = readU16(is); + connects_to_ids.clear(); for (u16 i = 0; i < connects_to_size; i++) connects_to_ids.insert(readU16(is)); connect_sides = readU8(is); @@ -1546,7 +1547,7 @@ bool CNodeDefManager::nodeboxConnects(MapNode from, MapNode to, u8 connect_face) const ContentFeatures &f2 = get(to); - if ((f2.drawtype == NDT_NODEBOX) && (f1.node_box.type == NODEBOX_CONNECTED)) + if ((f2.drawtype == NDT_NODEBOX) && (f2.node_box.type == NODEBOX_CONNECTED)) // ignores actually looking if back connection exists return (f2.connects_to_ids.find(from.param0) != f2.connects_to_ids.end()); |