Removed unused function font::text_to_lines.
This commit is contained in:
parent
3344673aea
commit
258342d55d
2 changed files with 0 additions and 50 deletions
|
@ -516,52 +516,5 @@ SDL_Rect draw_wrapped_text(CVideo* gui, const SDL_Rect& area, int font_size,
|
|||
return font::draw_text(gui, area, font_size, colour, wrapped_text, x, y, false);
|
||||
}
|
||||
|
||||
size_t text_to_lines(std::string& message, size_t max_length)
|
||||
{
|
||||
std::string starting_markup;
|
||||
bool at_start = true;
|
||||
|
||||
size_t cur_line = 0, longest_line = 0;
|
||||
for(std::string::iterator i = message.begin(); i != message.end(); ++i) {
|
||||
if(at_start) {
|
||||
if(font::is_format_char(*i)) {
|
||||
starting_markup.push_back(*i);
|
||||
} else {
|
||||
at_start = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(*i == '\n') {
|
||||
at_start = true;
|
||||
starting_markup = "";
|
||||
}
|
||||
|
||||
if(*i == ' ' && cur_line > max_length) {
|
||||
*i = '\n';
|
||||
const size_t index = i - message.begin();
|
||||
message.insert(index+1,starting_markup);
|
||||
i = message.begin() + index + starting_markup.size();
|
||||
|
||||
if(cur_line > longest_line)
|
||||
longest_line = cur_line;
|
||||
|
||||
cur_line = 0;
|
||||
}
|
||||
|
||||
if(*i == '\n' || i+1 == message.end()) {
|
||||
if(cur_line > longest_line)
|
||||
longest_line = cur_line;
|
||||
|
||||
cur_line = 0;
|
||||
|
||||
} else {
|
||||
++cur_line;
|
||||
}
|
||||
}
|
||||
|
||||
return longest_line;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace font
|
||||
|
||||
|
|
|
@ -117,9 +117,6 @@ SDL_Rect draw_wrapped_text(CVideo* gui, const SDL_Rect& area, int font_size,
|
|||
const SDL_Color& colour, const std::string& text,
|
||||
int x, int y, int max_width);
|
||||
|
||||
/** Chop up one long string of text into lines. */
|
||||
size_t text_to_lines(std::string& text, size_t max_length);
|
||||
|
||||
} // end namespace font
|
||||
|
||||
#endif // MARKED_UP_TEXT_HPP_INCLUDED
|
||||
|
|
Loading…
Add table
Reference in a new issue