Browse Source

Removed the no-argument variant of Text:set() in favour of Text:clear(). Resolves issue #1126.

--HG--
branch : minor
Alex Szpakowski 9 years ago
parent
commit
daf13de4eb

+ 1 - 6
src/modules/graphics/opengl/Text.cpp

@@ -177,7 +177,7 @@ void Text::set(const std::vector<Font::ColoredString> &text)
 void Text::set(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align)
 void Text::set(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align)
 {
 {
 	if (text.empty() || (text.size() == 1 && text[0].str.empty()))
 	if (text.empty() || (text.size() == 1 && text[0].str.empty()))
-		return set();
+		return clear();
 
 
 	Font::ColoredCodepoints codepoints;
 	Font::ColoredCodepoints codepoints;
 	Font::getCodepointsFromString(text, codepoints);
 	Font::getCodepointsFromString(text, codepoints);
@@ -185,11 +185,6 @@ void Text::set(const std::vector<Font::ColoredString> &text, float wrap, Font::A
 	addTextData({codepoints, wrap, align, {}, false, false, Matrix3()});
 	addTextData({codepoints, wrap, align, {}, false, false, Matrix3()});
 }
 }
 
 
-void Text::set()
-{
-	clear();
-}
-
 int Text::add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 int Text::add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
 	return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, x, y, angle, sx, sy, ox, oy, kx, ky);
 	return addf(text, -1.0f, Font::ALIGN_MAX_ENUM, x, y, angle, sx, sy, ox, oy, kx, ky);

+ 0 - 1
src/modules/graphics/opengl/Text.h

@@ -43,7 +43,6 @@ public:
 
 
 	void set(const std::vector<Font::ColoredString> &text);
 	void set(const std::vector<Font::ColoredString> &text);
 	void set(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align);
 	void set(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align);
-	void set();
 
 
 	int add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);
 	int add(const std::vector<Font::ColoredString> &text, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);
 	int addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);
 	int addf(const std::vector<Font::ColoredString> &text, float wrap, Font::AlignMode align, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky);

+ 1 - 6
src/modules/graphics/opengl/wrap_Text.cpp

@@ -77,12 +77,7 @@ int w_Text_set(lua_State *L)
 {
 {
 	Text *t = luax_checktext(L, 1);
 	Text *t = luax_checktext(L, 1);
 
 
-	if (lua_isnoneornil(L, 2))
-	{
-		// No argument: clear all current text.
-		luax_catchexcept(L, [&](){ t->set(); });
-	}
-	else if (lua_isnoneornil(L, 3))
+	if (lua_isnoneornil(L, 3))
 	{
 	{
 		// Single argument: unformatted text.
 		// Single argument: unformatted text.
 		std::vector<Font::ColoredString> newtext;
 		std::vector<Font::ColoredString> newtext;