summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/healthpad.py
diff options
context:
space:
mode:
authortroido <troido@hotmail.com>2017-11-13 14:09:16 +0100
committertroido <troido@hotmail.com>2017-11-13 14:09:16 +0100
commitf2bc01bae95fa66b9ebbb0d7f14f851ca4a2c7fb (patch)
treed67d2da36cc607983323be7375d24b40349466eb /asciifarm/client/display/healthpad.py
parent8f614ac7812edf99e019bb318655f172d095f2f5 (diff)
fixed small terminal sizes
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: