add the names of the abilities used as weapons in the attack prediction window (#5864)
Now, if a weapon is affected by an ability used as a weapon, the name will appear as if it was a classic special.
This commit is contained in:
parent
f1698ccd51
commit
1c37b377cb
2 changed files with 40 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
* Updated translations: Bulgarian, Chinese (Traditional), Czech, Italian, Portuguese (Brazil), Russian, Spanish, Turkish
|
||||
### Units
|
||||
### User interface
|
||||
* The names of the abilities used as specials appear in the attack prediction window with specials weapons
|
||||
* Added a prompt to allow migrating settings and redownloading add-ons used in a previous version of Wesnoth when starting a new versions for the first time.
|
||||
### WML Engine
|
||||
### Miscellaneous and Bug Fixes
|
||||
|
|
|
@ -854,6 +854,45 @@ std::string attack_type::weapon_specials(bool only_active, bool is_backstab) con
|
|||
}
|
||||
}
|
||||
|
||||
assert(display::get_singleton());
|
||||
const unit_map& units = display::get_singleton()->get_units();
|
||||
if(self_){
|
||||
std::set<std::string> checking_name;
|
||||
for (const config::any_child sp : (*self_).abilities().all_children_range()){
|
||||
const bool active = check_self_abilities_impl(shared_from_this(), other_attack_, sp.cfg, self_, self_loc_, AFFECT_EITHER, sp.key);
|
||||
|
||||
const std::string& name = active ? sp.cfg["name"].str() : "";
|
||||
|
||||
if (!name.empty() && checking_name.count(name) == 0) {
|
||||
checking_name.insert(name);
|
||||
if (!res.empty()){
|
||||
res += ", ";
|
||||
}
|
||||
res += name;
|
||||
}
|
||||
}
|
||||
const auto adjacent = get_adjacent_tiles(self_loc_);
|
||||
for(unsigned i = 0; i < adjacent.size(); ++i) {
|
||||
const unit_map::const_iterator it = units.find(adjacent[i]);
|
||||
if (it == units.end() || it->incapacitated())
|
||||
continue;
|
||||
if(&*it == self_.get())
|
||||
continue;
|
||||
for (const config::any_child sp : (*it).abilities().all_children_range()){
|
||||
const bool active = check_adj_abilities_impl(shared_from_this(), other_attack_, sp.cfg, self_, *it, i, self_loc_, AFFECT_EITHER, sp.key);
|
||||
|
||||
const std::string& name = active ? sp.cfg["name"].str() : "";
|
||||
|
||||
if (!name.empty() && checking_name.count(name) == 0) {
|
||||
checking_name.insert(name);
|
||||
if (!res.empty()){
|
||||
res += ", ";
|
||||
}
|
||||
res += name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue