1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

base stuff for item->object conversion

This commit is contained in:
Perttu Ahola 2010-12-24 03:08:05 +02:00
parent 10b06419ab
commit f15670379d
9 changed files with 583 additions and 194 deletions

View file

@ -66,6 +66,14 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is)
std::getline(is, inventorystring, '|');
return new MapBlockObjectItem(inventorystring);
}
else if(name == "ToolItem")
{
std::string toolname;
std::getline(is, toolname, ' ');
u16 wear;
is>>wear;
return new ToolItem(toolname, wear);
}
else
{
dstream<<"Unknown InventoryItem name=\""<<name<<"\""<<std::endl;
@ -126,6 +134,19 @@ MapBlockObject * MapBlockObjectItem::createObject
RatObject *obj = new RatObject(NULL, -1, pos);
return obj;
}
else if(name == "ItemObj")
{
/*
Now we are an inventory item containing the serialization
string of an object that contains the serialization
string of an inventory item. Fuck this.
*/
//assert(0);
dstream<<__FUNCTION_NAME<<": WARNING: Ignoring ItemObj "
<<"because an item-object should never be inside "
<<"an object-item."<<std::endl;
return NULL;
}
else
{
return NULL;