aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-01 19:51:45 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 22:31:00 +0300
commitff8d2bbc3682b12d40d1dfb212d39a50c498fb93 (patch)
treeae4ca4840e52b43044889b1fe9a05b20e9f97f52 /src
parent70c98c997221e81993e12815afa0ed8bf371fda9 (diff)
downloadminetest-ff8d2bbc3682b12d40d1dfb212d39a50c498fb93.tar.gz
minetest-ff8d2bbc3682b12d40d1dfb212d39a50c498fb93.tar.bz2
minetest-ff8d2bbc3682b12d40d1dfb212d39a50c498fb93.zip
Convert legacy chest inventory list "0" to "main"
Diffstat (limited to 'src')
-rw-r--r--src/content_nodemeta.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index 18690612d..ba4a0e513 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -64,8 +64,17 @@ static bool content_nodemeta_deserialize_legacy_body(
else if(id == NODEMETA_CHEST) // ChestNodeMetadata
{
meta->getInventory()->deSerialize(is);
+
+ // Rename inventory list "0" to "main"
+ Inventory *inv = meta->getInventory();
+ if(!inv->getList("main") && inv->getList("0")){
+ inv->addList("main", 8*4);
+ *inv->getList("main") = *inv->getList("0");
+ inv->deleteList("0");
+ }
+
meta->setString("formspec","invsize[8,9;]"
- "list[current_name;0;0,0;8,4;]"
+ "list[current_name;main;0,0;8,4;]"
"list[current_player;main;0,5;8,4;]");
return false;
}
@@ -73,8 +82,17 @@ static bool content_nodemeta_deserialize_legacy_body(
{
meta->setString("owner", deSerializeString(is));
meta->getInventory()->deSerialize(is);
+
+ // Rename inventory list "0" to "main"
+ Inventory *inv = meta->getInventory();
+ if(!inv->getList("main") && inv->getList("0")){
+ inv->addList("main", 8*4);
+ *inv->getList("main") = *inv->getList("0");
+ inv->deleteList("0");
+ }
+
meta->setString("formspec","invsize[8,9;]"
- "list[current_name;0;0,0;8,4;]"
+ "list[current_name;main;0,0;8,4;]"
"list[current_player;main;0,5;8,4;]");
return false;
}