summaryrefslogtreecommitdiff
path: root/src/xtra1.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2013-09-08 16:29:01 +0200
committerBardur Arantsson <bardur@scientician.net>2013-09-27 14:46:43 +0200
commite639beb074dec2d641b13bdb4f2d080b50dd55cb (patch)
treec191c1b81de7c5aa3679c5ad398e7095b48f888f /src/xtra1.cc
parent5a60ce1f8ab8a6a34cf55b637dd601b5d4422197 (diff)
Fix undefined behavior for HP calculation at birth
Diffstat (limited to 'src/xtra1.cc')
-rw-r--r--src/xtra1.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/xtra1.cc b/src/xtra1.cc
index 821fe508..e38c719d 100644
--- a/src/xtra1.cc
+++ b/src/xtra1.cc
@@ -1872,6 +1872,8 @@ void calc_hitpoints(void)
bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128);
/* Calculate hitpoints */
+ assert(p_ptr->lev - 1 >= 0);
+ assert(p_ptr->lev - 1 < PY_MAX_LEVEL);
mhp = player_hp[p_ptr->lev - 1] + (bonus * p_ptr->lev / 2);
/* Always have at least one hitpoint per level */