Ignore Pango markup in map descriptions.

Fixes bug #19210, patch provided by Shadow master.
This commit is contained in:
Mark de Wever 2012-03-18 14:57:32 +00:00
parent d4fcad4944
commit 49eb8c10b1
4 changed files with 9 additions and 6 deletions

View file

@ -68,6 +68,7 @@ Version 1.11.0-svn:
* Multiplayer:
* Fix an accidental terrain type change in Isar's Cross
* Fix attacker side being human in 6p_Team_Survival (bug #19400)
* Ignore Pango markup in map descriptions (bug #19210)
* Music and sound effects:
* Replaced some of the wolf hit sounds with lower-pitched ones
* Terrain:

View file

@ -475,7 +475,7 @@ void create::process_event()
}
if (!level["description"].empty()) {
tooltips::add_tooltip(minimap_rect_, level["description"]);
tooltips::add_tooltip(minimap_rect_, level["description"], "", false);
}
}
} else {

View file

@ -33,12 +33,13 @@ static const int text_width = 400;
struct tooltip
{
tooltip(const SDL_Rect& r, const std::string& msg, const std::string& act = "")
: rect(r), message(msg), action(act)
tooltip(const SDL_Rect& r, const std::string& msg, const std::string& act = "", bool use_markup = false)
: rect(r), message(msg), action(act), markup(use_markup)
{}
SDL_Rect rect;
std::string message;
std::string action;
bool markup;
};
std::vector<tooltip> tips;
@ -72,6 +73,7 @@ static void show_tooltip(const tooltip& tip)
unsigned int border = 10;
font::floating_label flabel(tip.message);
flabel.use_markup(tip.markup);
flabel.set_font_size(font_size);
flabel.set_color(font::NORMAL_COLOR);
flabel.set_clip_rect(area);
@ -137,7 +139,7 @@ void clear_tooltips(const SDL_Rect& rect)
}
}
void add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action)
void add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action, bool use_markup)
{
for(std::vector<tooltip>::iterator i = tips.begin(); i != tips.end(); ++i) {
if(rects_overlap(i->rect,rect)) {
@ -146,7 +148,7 @@ void add_tooltip(const SDL_Rect& rect, const std::string& message, const std::st
}
}
tips.push_back(tooltip(rect, message, action));
tips.push_back(tooltip(rect, message, action, use_markup));
current_tooltip = tips.end();
}

View file

@ -32,7 +32,7 @@ struct manager
void clear_tooltips();
void clear_tooltips(const SDL_Rect& rect);
void add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action ="");
void add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action ="", bool use_markup = true);
void process(int mousex, int mousey);
// Check if we clicked on a tooltip having an action.