diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-04 08:29:48 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-04 08:29:48 +0000 |
commit | e878ffbb8924a9523c3757a659adbe1a517474a0 (patch) | |
tree | b026c7bde1dbda0403ee5191af4277bf1f880355 | |
parent | 18ff7bbcf7ea103b44b585b208191df882b0fba3 (diff) | |
download | crawl-ref-e878ffbb8924a9523c3757a659adbe1a517474a0.tar.gz crawl-ref-e878ffbb8924a9523c3757a659adbe1a517474a0.zip |
Fixed divide-by-zero when the player had zero max MP. Oops.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@551 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/output.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index d10f59bf13..5e13a43e1a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -97,8 +97,11 @@ void print_stats(void) if (you.redraw_magic_points) { - - const int mp_percent = (you.magic_points * 100) / you.max_magic_points; + int mp_percent; + if ( you.max_magic_points ) + mp_percent = (you.magic_points * 100) / you.max_magic_points; + else + mp_percent = 100; for ( unsigned int i = 0; i < Options.mp_colour.size(); ++i ) { if ( i+1 == Options.mp_colour.size() || |