mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 20:02:54 +00:00
Fix bug #6272. Doesn't solve real issue though.
With experience_modifier=30, the unit Eraol (xp=18, max=60, * 30% == 18) should have already advanced, but it hasn't.
This commit is contained in:
parent
099d2219bd
commit
7aa313fc5b
@ -408,6 +408,11 @@ void ai::attack_analysis::analyze(const gamemap& map, unit_map& units,
|
||||
int xp_for_advance = up->second.max_experience() - up->second.experience();
|
||||
int kill_xp, fight_xp;
|
||||
|
||||
// See bug #6272... in some cases unit has already got enough xp to advance,
|
||||
// but hasn't (bug elsewhere?). Can cause divide by zero.
|
||||
if (xp_for_advance <= 0)
|
||||
xp_for_advance = 1;
|
||||
|
||||
fight_xp = defend_it->second.level();
|
||||
kill_xp = fight_xp * game_config::kill_experience;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user