summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/healthpad.py
diff options
context:
space:
mode:
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
-rw-r--r--asciifarm/client/display/healthpad.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py
index 2ca0a89..1b5c7e2 100644
--- a/asciifarm/client/display/healthpad.py
+++ b/asciifarm/client/display/healthpad.py
@@ -35,13 +35,13 @@ class HealthPad:
#return 2
def update(self, win, force=False):
- if not self.changed and not force:
+ if not self.changed and not force or not win:
return
#self.lastView = (x, y, xmax, ymax)
self.changed = False
height, width = win.getmaxyx()
width -= 1
- barEnd = round(self.health/self.maxHealth * width)
+ barEnd = round(self.health/self.maxHealth * width) if self.maxHealth > 0 else 0
win.erase()
win.addstr(0,0,"Health: {}/{}".format(self.health, self.maxHealth)[:width])
if self.colours: