[wmlunits] Treat negative defense values as if they were positive.

This commit is contained in:
Elias Pschernig 2012-03-11 23:24:53 +00:00
parent bcd94753e2
commit 216443b910

View File

@ -992,7 +992,13 @@ class HTMLOutput:
not_from_race, d = find_attr("defense", tid)
if d == "-": d = 100
try: d = "%d%%" % (100 - int(d))
try:
d = int(d)
# negative defense has something to do with best defense if
# there's multiple terrain types
if d < 0: d = -d
d = "%d%%" % (100 - d)
except ValueError:
error_message("Warning: Invalid defense %s for %s.\n" % (
d, uid))