diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-25 22:45:55 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:52 +0200 |
commit | 1f53ca5f4c2736ab060d93885d9bd956f14ae430 (patch) | |
tree | d64746cbb7e7f4457bcd414cbe96c74f969f121b /src | |
parent | 425db289d59d6c9b9be29334a42c1bbb82fab87f (diff) | |
download | minetest-1f53ca5f4c2736ab060d93885d9bd956f14ae430.tar.gz minetest-1f53ca5f4c2736ab060d93885d9bd956f14ae430.tar.bz2 minetest-1f53ca5f4c2736ab060d93885d9bd956f14ae430.zip |
Modify CONTENT_AIR and CONTENT_IGNORE handling in nodedef.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/nodedef.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 52d9fc8bf..7855ffef7 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -330,7 +330,10 @@ public: f.diggable = false; f.buildable_to = true; f.air_equivalent = true; - set(CONTENT_AIR, f); + // Insert directly into containers + content_t c = CONTENT_AIR; + m_content_features[c] = f; + m_name_id_mapping.set(c, f.name); } // Set CONTENT_IGNORE { @@ -346,7 +349,10 @@ public: // A way to remove accidental CONTENT_IGNOREs f.buildable_to = true; f.air_equivalent = true; - set(CONTENT_IGNORE, f); + // Insert directly into containers + content_t c = CONTENT_IGNORE; + m_content_features[c] = f; + m_name_id_mapping.set(c, f.name); } } // CONTENT_IGNORE = not found @@ -415,6 +421,12 @@ public: infostream<<"registerNode: registering content id \""<<c <<"\": name=\""<<def.name<<"\""<<std::endl; assert(c <= MAX_CONTENT); + // Don't allow redefining CONTENT_IGNORE (but allow air) + if(def.name == "ignore" || c == CONTENT_IGNORE){ + infostream<<"registerNode: WARNING: Ignoring " + <<"CONTENT_IGNORE redefinition"<<std::endl; + return; + } // Check that the special contents are not redefined as different id // because it would mess up everything if((def.name == "ignore" && c != CONTENT_IGNORE) || |