summaryrefslogtreecommitdiff
path: root/src/content_nodemeta.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-03 00:32:49 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 22:31:01 +0300
commit81c5e5200bcc20be6b1513a440b2c45985fe3c49 (patch)
treea82c21e853b297203e278b97f5752a08b14be848 /src/content_nodemeta.cpp
parent9c3830dd35e7fdf601d83fcd969b67dd3fe189d3 (diff)
downloadminetest-81c5e5200bcc20be6b1513a440b2c45985fe3c49.tar.gz
minetest-81c5e5200bcc20be6b1513a440b2c45985fe3c49.tar.bz2
minetest-81c5e5200bcc20be6b1513a440b2c45985fe3c49.zip
Fix loading of legacy chests
Diffstat (limited to 'src/content_nodemeta.cpp')
-rw-r--r--src/content_nodemeta.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index a2a341ae0..2f32cf16a 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventory.h"
#include "log.h"
#include "utility.h"
+#include <sstream>
#define NODEMETA_GENERIC 1
#define NODEMETA_SIGN 14
@@ -70,11 +71,10 @@ static bool content_nodemeta_deserialize_legacy_body(
// 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");
+ inv->getList("0")->setName("main");
}
-
+ assert(inv->getList("main") && !inv->getList("0"));
+
meta->setString("formspec","invsize[8,9;]"
"list[current_name;main;0,0;8,4;]"
"list[current_player;main;0,5;8,4;]");
@@ -88,11 +88,10 @@ static bool content_nodemeta_deserialize_legacy_body(
// 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");
+ inv->getList("0")->setName("main");
}
-
+ assert(inv->getList("main") && !inv->getList("0"));
+
meta->setString("formspec","invsize[8,9;]"
"list[current_name;main;0,0;8,4;]"
"list[current_player;main;0,5;8,4;]");