]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/content_nodemeta.cpp
Update Lua API documentation to include minetest.get_modnames()
[dragonfireclient.git] / src / content_nodemeta.cpp
index a2a341ae0701742afa5c79ac0eb6f0af3ec4d9fb..12c8aa42667d090a64d1932e5434d1579e5867b1 100644 (file)
@@ -3,16 +3,16 @@ Minetest-c55
 Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@@ -20,7 +20,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_nodemeta.h"
 #include "inventory.h"
 #include "log.h"
-#include "utility.h"
+#include "util/serialize.h"
+#include "util/string.h"
+#include "constants.h" // MAP_BLOCKSIZE
+#include <sstream>
 
 #define NODEMETA_GENERIC 1
 #define NODEMETA_SIGN 14
@@ -56,11 +59,11 @@ static bool content_nodemeta_deserialize_legacy_body(
        }
        else if(id == NODEMETA_SIGN) // SignNodeMetadata
        {
-               meta->setString("text", deSerializeLongString(is));
+               meta->setString("text", deSerializeString(is));
                //meta->setString("infotext","\"${text}\"");
                meta->setString("infotext",
                                std::string("\"") + meta->getString("text") + "\"");
-               meta->setString("formspec","field[text;;${text}]");
+               meta->setString("formspec","hack:sign_text_input");
                return false;
        }
        else if(id == NODEMETA_CHEST) // ChestNodeMetadata
@@ -70,11 +73,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 +90,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;]");