Unit: remove bar scaling overrides

See #7292, closes #2913. Apparently, this has never worked, and based on discussion in #7292, it's not even particularly useful. Plus, since it was removed from the schema two years ago, has been functionally deprecated since then.

The keys in unit_type remain untouched.
This commit is contained in:
Charles Dang 2025-01-26 13:50:46 -05:00
parent 88db38a406
commit 428f77f624
3 changed files with 15 additions and 19 deletions

View File

@ -13,6 +13,7 @@
### Units
### User interface
### WML Engine
* [unit] no longer accepts hp_bar_scaling and xp_bar_scaling keys
### Miscellaneous and Bug Fixes
## Version 1.19.8

View File

@ -304,8 +304,6 @@ unit::unit(const unit& o)
, modification_descriptions_(o.modification_descriptions_)
, anim_comp_(new unit_animation_component(*this, *o.anim_comp_))
, hidden_(o.hidden_)
, hp_bar_scaling_(o.hp_bar_scaling_)
, xp_bar_scaling_(o.xp_bar_scaling_)
, modifications_(o.modifications_)
, abilities_(o.abilities_)
, advancements_(o.advancements_)
@ -386,8 +384,6 @@ unit::unit(unit_ctor_t)
, modification_descriptions_()
, anim_comp_(new unit_animation_component(*this))
, hidden_(false)
, hp_bar_scaling_(0)
, xp_bar_scaling_(0)
, modifications_()
, abilities_()
, advancements_()
@ -418,8 +414,6 @@ void unit::init(const config& cfg, bool use_traits, const vconfig* vcfg)
//, facing_(map_location::direction::indeterminate)
//, anim_comp_(new unit_animation_component(*this))
hidden_ = cfg["hidden"].to_bool(false);
hp_bar_scaling_ = cfg["hp_bar_scaling"].blank() ? type_->hp_bar_scaling() : cfg["hp_bar_scaling"].to_double();
xp_bar_scaling_ = cfg["xp_bar_scaling"].blank() ? type_->xp_bar_scaling() : cfg["xp_bar_scaling"].to_double();
random_traits_ = true;
generate_name_ = true;
side_ = cfg["side"].to_int();
@ -1033,8 +1027,6 @@ void unit::advance_to(const unit_type& u_type, bool use_traits)
recall_cost_ = new_type.recall_cost();
alignment_ = new_type.alignment();
max_hit_points_ = new_type.hitpoints();
hp_bar_scaling_ = new_type.hp_bar_scaling();
xp_bar_scaling_ = new_type.xp_bar_scaling();
max_movement_ = new_type.movement();
vision_ = new_type.vision(true);
jamming_ = new_type.jamming();
@ -2787,6 +2779,16 @@ void unit::set_hidden(bool state) const
anim_comp_->clear_haloes();
}
double unit::hp_bar_scaling() const
{
return type().hp_bar_scaling();
}
double unit::xp_bar_scaling() const
{
return type().xp_bar_scaling();
}
void unit::set_image_halo(const std::string& halo)
{
appearance_changed_ = true;

View File

@ -727,21 +727,15 @@ public:
/**
* The factor by which the HP bar should be scaled.
* @todo: document further
* Convenience wrapper around the unit_type value.
*/
double hp_bar_scaling() const
{
return hp_bar_scaling_;
}
double hp_bar_scaling() const;
/**
* The factor by which the XP bar should be scaled.
* @todo: document further
* Convenience wrapper around the unit_type value.
*/
double xp_bar_scaling() const
{
return xp_bar_scaling_;
}
double xp_bar_scaling() const;
/**
* Whether the unit has been instructed to hold its position.
@ -2095,7 +2089,6 @@ private:
std::unique_ptr<unit_animation_component> anim_comp_;
mutable bool hidden_;
double hp_bar_scaling_, xp_bar_scaling_;
config modifications_;
config abilities_;