From d6a9bec8430e39b380d3fc7b1f92683d4d02c33e Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 31 Jul 2011 02:20:40 +0300 Subject: Added MaterialItem conversion from old content type namespace to new --- src/inventory.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/inventory.cpp') diff --git a/src/inventory.cpp b/src/inventory.cpp index ca050614f..30a43e37f 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -46,6 +46,18 @@ InventoryItem::~InventoryItem() { } +content_t content_translate_from_19_to_internal(content_t c_from) +{ + for(u32 i=0; i>material; + u16 count; + is>>count; + // Convert old materials + if(material <= 0xff) + { + material = content_translate_from_19_to_internal(material); + } + if(material > MAX_CONTENT) + throw SerializationError("Too large material number"); + return new MaterialItem(material, count); + } + else if(name == "MaterialItem2") + { u16 material; is>>material; u16 count; -- cgit v1.2.3