Unit/Type: drop bar_scaling keys as well

As suggested by soliton in #9806
This commit is contained in:
Charles Dang 2025-01-26 22:36:17 -05:00
parent 4092f01988
commit fc8e8eb09e
7 changed files with 3 additions and 37 deletions

View File

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

View File

@ -19,7 +19,6 @@
{SIMPLE_KEY healed_sound string}
{SIMPLE_KEY hide_help bool}
{SIMPLE_KEY hitpoints int}
{SIMPLE_KEY hp_bar_scaling real}
{SIMPLE_KEY ignore_race_traits bool}
{SIMPLE_KEY image string}
{SIMPLE_KEY image_icon string}
@ -36,7 +35,6 @@
{SIMPLE_KEY undead_variation string}
{SIMPLE_KEY usage ai_usage}
{SIMPLE_KEY vision int}
{SIMPLE_KEY xp_bar_scaling real}
{SIMPLE_KEY bar_offset_x int}
{SIMPLE_KEY bar_offset_y int}
{SIMPLE_KEY zoc bool}

View File

@ -373,7 +373,7 @@ void unit_drawer::redraw_unit(const unit& u) const
if(u.max_hitpoints() > 0) {
bars.AGGREGATE_EMPLACE(
energy_bar::get_height(u.max_hitpoints(), u.hp_bar_scaling()),
energy_bar::get_height(u.max_hitpoints(), game_config::hp_bar_scaling),
energy_bar::get_filled(u.hitpoints(), u.max_hitpoints()),
energy_bar::get_color(u.hp_color(), bar_focus)
);
@ -381,7 +381,7 @@ void unit_drawer::redraw_unit(const unit& u) const
if(u.experience() > 0 && u.can_advance()) {
bars.AGGREGATE_EMPLACE(
energy_bar::get_height(u.max_experience(), u.xp_bar_scaling() / std::max(u.level(), 1)),
energy_bar::get_height(u.max_experience(), game_config::xp_bar_scaling / std::max(u.level(), 1)),
energy_bar::get_filled(u.experience(), u.max_experience()),
energy_bar::get_color(u.xp_color(), bar_focus)
);

View File

@ -59,8 +59,6 @@ unit_type::unit_type(const unit_type& o)
, type_name_(o.type_name_)
, description_(o.description_)
, hitpoints_(o.hitpoints_)
, hp_bar_scaling_(o.hp_bar_scaling_)
, xp_bar_scaling_(o.xp_bar_scaling_)
, level_(o.level_)
, recall_cost_(o.recall_cost_)
, movement_(o.movement_)
@ -110,8 +108,6 @@ unit_type::unit_type(defaut_ctor_t, const config& cfg, const std::string & paren
, type_name_()
, description_()
, hitpoints_(0)
, hp_bar_scaling_(0.0)
, xp_bar_scaling_(0.0)
, level_(0)
, recall_cost_()
, movement_(0)
@ -217,9 +213,6 @@ void unit_type::build_full(
game_config::add_color_info(game_config_view::wrap(get_cfg()));
hp_bar_scaling_ = get_cfg()["hp_bar_scaling"].to_double(game_config::hp_bar_scaling);
xp_bar_scaling_ = get_cfg()["xp_bar_scaling"].to_double(game_config::xp_bar_scaling);
// Propagate the build to the variations.
for(variations_map::value_type& variation : variations_) {
variation.second.build_full(mv_types, races, traits);

View File

@ -159,8 +159,6 @@ public:
*/
std::vector<t_string> special_notes() const;
int hitpoints() const { return hitpoints_; }
double hp_bar_scaling() const { return hp_bar_scaling_; }
double xp_bar_scaling() const { return xp_bar_scaling_; }
int level() const { return level_; }
int recall_cost() const { return recall_cost_;}
int movement() const { return movement_; }
@ -330,7 +328,6 @@ private:
t_string description_;
std::vector<t_string> special_notes_;
int hitpoints_;
double hp_bar_scaling_, xp_bar_scaling_;
int level_;
int recall_cost_;
int movement_;

View File

@ -2779,16 +2779,6 @@ 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

@ -725,18 +725,6 @@ public:
/** Sets whether the unit is hidden on the map. */
void set_hidden(bool state) const;
/**
* The factor by which the HP bar should be scaled.
* Convenience wrapper around the unit_type value.
*/
double hp_bar_scaling() const;
/**
* The factor by which the XP bar should be scaled.
* Convenience wrapper around the unit_type value.
*/
double xp_bar_scaling() const;
/**
* Whether the unit has been instructed to hold its position.
* This excludes it from the unit cycling function.