Fix: it wasn't possible to remove invulnerability with the shorthand

The command ";unit invulnerable=false" didn't do anything to an
invulnerable unit.
This commit is contained in:
Jyrki Vesterinen 2016-08-26 06:34:25 +03:00
parent 8bd632f18c
commit c438a2a21a

View file

@ -564,9 +564,9 @@ unit::unit(const config &cfg, bool use_traits, const vconfig* vcfg)
hit_points_ = max_hit_points_;
}
if (cfg["invulnerable"].to_bool(false) == true)
if (const config::attribute_value *v = cfg.get("invulnerable"))
{
set_state("invulnerable", true);
set_state("invulnerable", v->to_bool());
}
goto_.x = cfg["goto_x"].to_int() - 1;