From 4fb6b6afa7329676166bbbccb897bd625155d038 Mon Sep 17 00:00:00 2001 From: DS Date: Sat, 18 Apr 2020 17:21:10 +0200 Subject: Formspec: allow lists to change size and existence while the formspec is open (#9700) Fixes #9640. --- src/gui/guiFormSpecMenu.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/gui/guiFormSpecMenu.cpp') diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index b0255cf1b..85ab2eb50 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -489,38 +489,10 @@ void GUIFormSpecMenu::parseList(parserData *data, const std::string &element) start_i = stoi(startindex); if (geom.X < 0 || geom.Y < 0 || start_i < 0) { - errorstream<< "Invalid list element: '" << element << "'" << std::endl; + errorstream << "Invalid list element: '" << element << "'" << std::endl; return; } - // check for the existence of inventory and list - Inventory *inv = m_invmgr->getInventory(loc); - if (!inv) { - warningstream << "GUIFormSpecMenu::parseList(): " - << "The inventory location " - << "\"" << loc.dump() << "\" doesn't exist" - << std::endl; - return; - } - InventoryList *ilist = inv->getList(listname); - if (!ilist) { - warningstream << "GUIFormSpecMenu::parseList(): " - << "The inventory list \"" << listname << "\" " - << "@ \"" << loc.dump() << "\" doesn't exist" - << std::endl; - return; - } - - // trim geom if it is larger than the actual inventory size - s32 list_size = (s32)ilist->getSize(); - if (list_size < geom.X * geom.Y + start_i) { - list_size -= MYMAX(start_i, 0); - geom.Y = list_size / geom.X; - geom.Y += list_size % geom.X > 0 ? 1 : 0; - if (geom.Y <= 1) - geom.X = list_size; - } - if (!data->explicit_size) warningstream << "invalid use of list without a size[] element" << std::endl; -- cgit v1.2.3