Skip to content

Commit

Permalink
Fix weapon specials marked as inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
DisherProject authored and CelticMinstrel committed Jun 26, 2018
1 parent 0aa60a7 commit 902cf6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/reports.cpp
Expand Up @@ -813,7 +813,7 @@ static int attack_info(reports::context & rc, const attack_type &at, config &res
}

{
auto ctx = at.specials_context_for_listing();
auto ctx = at.specials_context_for_listing(u.side() == rc.screen().playing_side());
boost::dynamic_bitset<> active;
const std::vector<std::pair<t_string, t_string>> &specials = at.special_tooltips(&active);
const std::size_t specials_size = specials.size();
Expand Down
3 changes: 2 additions & 1 deletion src/units/attack_type.cpp
Expand Up @@ -561,10 +561,11 @@ attack_type::specials_context_t::specials_context_t(
weapon.is_for_listing_ = false;
}

attack_type::specials_context_t::specials_context_t(const attack_type& weapon)
attack_type::specials_context_t::specials_context_t(const attack_type& weapon, bool attacking)
: parent(weapon.shared_from_this())
{
weapon.is_for_listing_ = true;
weapon.is_attacker_ = attacking;
}

attack_type::specials_context_t::~specials_context_t()
Expand Down
6 changes: 3 additions & 3 deletions src/units/attack_type.hpp
Expand Up @@ -114,7 +114,7 @@ class attack_type : public std::enable_shared_from_this<attack_type>
std::shared_ptr<const attack_type> parent;
friend class attack_type;
/// Initialize weapon specials context for listing
explicit specials_context_t(const attack_type& weapon);
explicit specials_context_t(const attack_type& weapon, bool attacking);
/// Initialize weapon specials context for a unit type
specials_context_t(const attack_type& weapon, const unit_type& self_type, const map_location& loc, bool attacking = true);
/// Initialize weapon specials context for a single unit
Expand Down Expand Up @@ -144,8 +144,8 @@ class attack_type : public std::enable_shared_from_this<attack_type>
specials_context_t specials_context(const unit_type& self_type, const map_location& loc, bool attacking = true) const {
return specials_context_t(*this, self_type, loc, attacking);
}
specials_context_t specials_context_for_listing() const {
return specials_context_t(*this);
specials_context_t specials_context_for_listing(bool attacking = true) const {
return specials_context_t(*this, attacking);
}
private:

Expand Down

0 comments on commit 902cf6d

Please sign in to comment.