fix broken tooltip in the status bar for plague(argument)

This commit is contained in:
Benoît Timbert 2005-12-15 06:43:00 +00:00
parent d42fda0a77
commit da6d72a321
3 changed files with 18 additions and 5 deletions

View file

@ -66,6 +66,7 @@ SVN trunk (1.1.x):
* better movement highlighting (patch #488)
* stop save dialog complaining about bad name when pressing cancel (#4835)
* pressing 'n' wont take you out of path selection mode (#4833, patch #490)
* fix broken tooltip in the status bar for plague(argument)
* graphics:
* units can now have colors redefined to match team colors:
* team color can be defined in the side tag with "team_rgb=r,g,b"

View file

@ -113,6 +113,9 @@ When used offensively, this attack always has at least a 60% chance to hit."
weapon_special_plague_description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit identical to and on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
weapon_special_plague_arg_description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit of the specified type on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
weapon_special_poison_description= _ "Poison:
This attack poisons the target. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP."

View file

@ -282,13 +282,22 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
str << "<166,146,117> ";
static const std::string swarm_string("swarm");
if (!at_it->special().empty()) {
if(at_it->special() == swarm_string){
str << gettext(at_it->special().c_str())<<"("<<at_it->num_swarm_attacks(u->second.hitpoints(),u->second.max_hitpoints())<<"/"<< at_it->num_attacks() <<")" << "\n";
const std::string special = at_it->special();
if (!special.empty()) {
if(special == swarm_string){
str << gettext(special.c_str())<<"("<<at_it->num_swarm_attacks(u->second.hitpoints(),u->second.max_hitpoints())<<"/"<< at_it->num_attacks() <<")" << "\n";
tooltip << string_table["weapon_special_" + special + "_description"];
}else{
str << gettext(at_it->special().c_str());
//check if we use special(argument)
const std::string::size_type parindex = special.find('(',0);
if (parindex != std::string::npos) {
// If there is an argument, we use weapon_special_specialname_arg_description instead
tooltip << string_table["weapon_special_" + special.substr(0,parindex) + "_arg_description"];
} else {
tooltip << string_table["weapon_special_" + special + "_description"];
}
str << gettext(special.c_str());
}
tooltip << string_table["weapon_special_" + at_it->special() + "_description"];
str<<"\n";
res.add_text(str,tooltip);
}