1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Improve item serialization

This commit is contained in:
Perttu Ahola 2011-11-16 22:47:37 +02:00
parent 564c3a9c96
commit 8dd3622c6d
4 changed files with 61 additions and 28 deletions

View file

@ -139,22 +139,11 @@ public:
}
virtual void serialize(std::ostream &os) const
{
std::string nodename = m_nodename;
if(nodename == "")
nodename = "unknown_block";
os<<"MaterialItem3";
os<<"NodeItem";
os<<" \"";
os<<nodename;
os<<m_nodename;
os<<"\" ";
os<<m_count;
// Old
/*os<<"MaterialItem2";
os<<" ";
os<<(unsigned int)m_content;
os<<" ";
os<<m_count;*/
}
virtual InventoryItem* clone()
{
@ -225,9 +214,9 @@ public:
virtual void serialize(std::ostream &os) const
{
os<<getName();
os<<" ";
os<<" \"";
os<<m_subname;
os<<" ";
os<<"\" ";
os<<m_count;
}
virtual InventoryItem* clone()
@ -304,9 +293,9 @@ public:
virtual void serialize(std::ostream &os) const
{
os<<getName();
os<<" ";
os<<" \"";
os<<m_toolname;
os<<" ";
os<<"\" ";
os<<m_wear;
}
virtual InventoryItem* clone()