aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-01 12:50:32 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-01 12:50:32 +0200
commit35097149515e80e9a11c51161f0138b68ee07a3e (patch)
treed8d1ca5d9d6056c10981b66ec1e1cb429d6cfe4a /src
parent146be1f0b6c058ad0e9fe0aa38e3c1f75a39823b (diff)
downloadminetest-35097149515e80e9a11c51161f0138b68ee07a3e.tar.gz
minetest-35097149515e80e9a11c51161f0138b68ee07a3e.tar.bz2
minetest-35097149515e80e9a11c51161f0138b68ee07a3e.zip
Fix loading of legacy MaterialItems (was loaded as a quite random type)
Diffstat (limited to 'src')
-rw-r--r--src/inventory.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index e8475b741..0600729c6 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gamedef.h"
#include "scriptapi.h"
#include "strfnd.h"
+#include "nameidmapping.h" // For loading legacy MaterialItems
/*
InventoryItem
@@ -250,8 +251,10 @@ MaterialItem::MaterialItem(IGameDef *gamedef, std::string nodename, u16 count):
MaterialItem::MaterialItem(IGameDef *gamedef, content_t content, u16 count):
InventoryItem(gamedef, count)
{
- INodeDefManager *ndef = m_gamedef->ndef();
- std::string nodename = ndef->get(content).name;
+ NameIdMapping legacy_nimap;
+ content_mapnode_get_name_id_mapping(&legacy_nimap);
+ std::string nodename;
+ legacy_nimap.getName(content, nodename);
if(nodename == "")
nodename = "unknown_block";
m_nodename = nodename;