diff options
author | DS <vorunbekannt75@web.de> | 2020-04-18 17:21:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 17:21:10 +0200 |
commit | 4fb6b6afa7329676166bbbccb897bd625155d038 (patch) | |
tree | ca6437170e246525c6273079a9757c9e3e896692 /src/gui/guiFormSpecMenu.cpp | |
parent | 241bf442608d27df0ce3c74889c357fb5589ab20 (diff) | |
download | minetest-4fb6b6afa7329676166bbbccb897bd625155d038.tar.gz minetest-4fb6b6afa7329676166bbbccb897bd625155d038.tar.bz2 minetest-4fb6b6afa7329676166bbbccb897bd625155d038.zip |
Formspec: allow lists to change size and existence while the formspec is open (#9700)
Fixes #9640.
Diffstat (limited to 'src/gui/guiFormSpecMenu.cpp')
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
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; |