mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 18:13:46 +01:00
Fix loading of legacy MaterialItems (was loaded as a quite random type)
This commit is contained in:
parent
146be1f0b6
commit
3509714951
@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "gamedef.h"
|
#include "gamedef.h"
|
||||||
#include "scriptapi.h"
|
#include "scriptapi.h"
|
||||||
#include "strfnd.h"
|
#include "strfnd.h"
|
||||||
|
#include "nameidmapping.h" // For loading legacy MaterialItems
|
||||||
|
|
||||||
/*
|
/*
|
||||||
InventoryItem
|
InventoryItem
|
||||||
@ -250,8 +251,10 @@ MaterialItem::MaterialItem(IGameDef *gamedef, std::string nodename, u16 count):
|
|||||||
MaterialItem::MaterialItem(IGameDef *gamedef, content_t content, u16 count):
|
MaterialItem::MaterialItem(IGameDef *gamedef, content_t content, u16 count):
|
||||||
InventoryItem(gamedef, count)
|
InventoryItem(gamedef, count)
|
||||||
{
|
{
|
||||||
INodeDefManager *ndef = m_gamedef->ndef();
|
NameIdMapping legacy_nimap;
|
||||||
std::string nodename = ndef->get(content).name;
|
content_mapnode_get_name_id_mapping(&legacy_nimap);
|
||||||
|
std::string nodename;
|
||||||
|
legacy_nimap.getName(content, nodename);
|
||||||
if(nodename == "")
|
if(nodename == "")
|
||||||
nodename = "unknown_block";
|
nodename = "unknown_block";
|
||||||
m_nodename = nodename;
|
m_nodename = nodename;
|
||||||
|
Loading…
Reference in New Issue
Block a user