diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-16 16:47:20 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:47 +0200 |
commit | eabfb370acfcaf4c9be680419d7c97cf7418faf4 (patch) | |
tree | dc52c5e4dfee33793c45c8b873b8955b7469d1b7 /src/mapnode.cpp | |
parent | 62164d955ce739e87165bb90b1439807aca5ca55 (diff) | |
download | minetest-eabfb370acfcaf4c9be680419d7c97cf7418faf4.tar.gz minetest-eabfb370acfcaf4c9be680419d7c97cf7418faf4.tar.bz2 minetest-eabfb370acfcaf4c9be680419d7c97cf7418faf4.zip |
MapNode constructor to allow ndef+name
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index c5756e8ba..a757149b1 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -155,6 +155,20 @@ v3s16 unpackDir(u8 b) MapNode */ +// Create directly from a nodename +// If name is unknown, sets CONTENT_IGNORE +MapNode::MapNode(INodeDefManager *ndef, const std::string &name, + u8 a_param1, u8 a_param2) +{ + content_t id = CONTENT_IGNORE; + ndef->getId(name, id); + param1 = a_param1; + param2 = a_param2; + // Set content (param0 and (param2&0xf0)) after other params + // because this needs to override part of param2 + setContent(id); +} + void MapNode::setLight(enum LightBank bank, u8 a_light, INodeDefManager *nodemgr) { // If node doesn't contain light data, ignore this |