diff options
author | SmallJoker <mk939@ymail.com> | 2019-09-10 21:18:42 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2019-09-14 19:43:08 +0200 |
commit | 9acd36bf9981cf9cb8e82785508d6eb7f010cc77 (patch) | |
tree | 6f0fae04efa009e8fd0a13dd0ab613c8010ae764 /src/gui/guiFormSpecMenu.cpp | |
parent | b0baa698a495cc990ce5d9c22763957f1138aed3 (diff) | |
download | minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.tar.gz minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.tar.bz2 minetest-9acd36bf9981cf9cb8e82785508d6eb7f010cc77.zip |
Formspecs: Introduce formspec_version to mods
Diffstat (limited to 'src/gui/guiFormSpecMenu.cpp')
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index e02abf018..f291b4e87 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -2167,6 +2167,9 @@ void GUIFormSpecMenu::parseElement(parserData* data, const std::string &element) if (element.empty()) return; + if (parseVersionDirect(element)) + return; + std::vector<std::string> parts = split(element,'['); // ugly workaround to keep compatibility @@ -2503,7 +2506,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) } /* Copy of the "real_coordinates" element for after the form size. */ - mydata.real_coordinates = false; + mydata.real_coordinates = m_formspec_version >= 2; for (; i < elements.size(); i++) { std::vector<std::string> parts = split(elements[i], '['); std::string name = trim(parts[0]); @@ -2648,10 +2651,14 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) if (enable_prepends) { // Backup the coordinates so that prepends can use the coordinates of choice. bool rc_backup = mydata.real_coordinates; + bool version_backup = m_formspec_version; mydata.real_coordinates = false; // Old coordinates by default. + std::vector<std::string> prepend_elements = split(m_formspec_prepend, ']'); for (const auto &element : prepend_elements) parseElement(&mydata, element); + + m_formspec_version = version_backup; mydata.real_coordinates = rc_backup; // Restore coordinates } |