fix fallaback to unit alignment for filter and formulas.
This commit is contained in:
parent
174be0f8c4
commit
995d67cf77
2 changed files with 10 additions and 1 deletions
|
@ -82,6 +82,15 @@ attack_type::attack_type(const config& cfg) :
|
|||
}
|
||||
}
|
||||
|
||||
std::string attack_type::alignment_str() const
|
||||
{
|
||||
if (alignment()){
|
||||
return unit_alignments::get_string(*alignment());
|
||||
}
|
||||
//if not alignment() fallback to unit alignment or return empty string if not available.
|
||||
return (self_ ? unit_alignments::get_string(self_->alignment()) : "");
|
||||
}
|
||||
|
||||
std::string attack_type::accuracy_parry_description() const
|
||||
{
|
||||
if(accuracy_ == 0 && parry_ == 0) {
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
utils::optional<unit_alignments::type> alignment() const {return unit_alignments::get_enum(alignment_str_);}
|
||||
/** Returns alignment specified by alignment() for filtering when exist.
|
||||
*/
|
||||
std::string alignment_str() const {return (alignment() ? unit_alignments::get_string(*alignment()) : "");}
|
||||
std::string alignment_str() const;
|
||||
|
||||
/** Calculates the number of attacks this weapon has, considering specials. */
|
||||
void modified_attacks(unsigned & min_attacks,
|
||||
|
|
Loading…
Add table
Reference in a new issue