From 78ff5c193683fc643fbec85dc398da91d91a9e44 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 7 Aug 2016 14:32:31 +0100 Subject: Fix background formspec elements from interfering with each other Fixes #4397 --- src/guiFormSpecMenu.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/guiFormSpecMenu.cpp') diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 2564671a3..084a53c9d 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -637,17 +637,17 @@ void GUIFormSpecMenu::parseBackground(parserData* data,std::string element) geom.X = stof(v_geom[0]) * (float)spacing.X; geom.Y = stof(v_geom[1]) * (float)spacing.Y; - if (parts.size() == 4) { - m_clipbackground = is_yes(parts[3]); - if (m_clipbackground) { - pos.X = stoi(v_pos[0]); //acts as offset - pos.Y = stoi(v_pos[1]); //acts as offset - } + if (!data->explicit_size) + warningstream<<"invalid use of background without a size[] element"<explicit_size) - warningstream<<"invalid use of background without a size[] element"< rect = imgrect + spec.pos; - if (m_clipbackground) { + if (spec.clip) { core::dimension2d absrec_size = AbsoluteRect.getSize(); rect = core::rect(AbsoluteRect.UpperLeftCorner.X - spec.pos.X, AbsoluteRect.UpperLeftCorner.Y - spec.pos.Y, @@ -2358,8 +2357,7 @@ void GUIFormSpecMenu::drawMenu() core::rect(core::position2d(0,0), core::dimension2di(texture->getOriginalSize())), NULL/*&AbsoluteClippingRect*/, colors, true); - } - else { + } else { errorstream << "GUIFormSpecMenu::drawMenu() Draw backgrounds unable to load texture:" << std::endl; errorstream << "\t" << spec.name << std::endl; } -- cgit v1.2.3