summaryrefslogtreecommitdiff
path: root/src/inventorymanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventorymanager.cpp')
-rw-r--r--src/inventorymanager.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 25257238b..1369cb0d7 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -41,30 +41,25 @@ std::string InventoryLocation::dump() const
void InventoryLocation::serialize(std::ostream &os) const
{
- switch(type){
- case InventoryLocation::UNDEFINED:
- {
- os<<"undefined";
- }
+ switch(type){
+ case InventoryLocation::UNDEFINED:
+ os<<"undefined";
+ break;
+ case InventoryLocation::CURRENT_PLAYER:
+ os<<"current_player";
break;
- case InventoryLocation::CURRENT_PLAYER:
- {
- os<<"current_player";
- }
+ case InventoryLocation::PLAYER:
+ os<<"player:"<<name;
break;
- case InventoryLocation::PLAYER:
- {
- os<<"player:"<<name;
- }
+ case InventoryLocation::NODEMETA:
+ os<<"nodemeta:"<<p.X<<","<<p.Y<<","<<p.Z;
break;
- case InventoryLocation::NODEMETA:
- {
- os<<"nodemeta:"<<p.X<<","<<p.Y<<","<<p.Z;
- }
+ case InventoryLocation::DETACHED:
+ os<<"detached:"<<name;
break;
- default:
- assert(0);
- }
+ default:
+ assert(0);
+ }
}
void InventoryLocation::deSerialize(std::istream &is)
@@ -94,6 +89,11 @@ void InventoryLocation::deSerialize(std::istream &is)
p.Y = stoi(fn.next(","));
p.Z = stoi(fn.next(","));
}
+ else if(tname == "detached")
+ {
+ type = InventoryLocation::DETACHED;
+ std::getline(is, name, '\n');
+ }
else
{
infostream<<"Unknown InventoryLocation type=\""<<tname<<"\""<<std::endl;