Date: Thursday August 24, 2000 @ 23:23 Author: cvs Update of /home/cvs/CVS/crossfire/server In directory boltzmann.eecs.berkeley.edu:/tmp/cvs-serv13404/server Modified Files: skill_util.c Log Message: common/living.c, server/skill_util.c: Patches by Garth Denley: Fixes divide by zero crash, sets up perm exp when a new player is loaded, seperates permanent exp code/calculations into another function. checked in by MSW, 8/24/2000 **************************************** Index: crossfire/server/skill_util.c diff -u crossfire/server/skill_util.c:1.7 crossfire/server/skill_util.c:1.8 --- crossfire/server/skill_util.c:1.7 Tue Aug 1 23:04:50 2000 +++ crossfire/server/skill_util.c Thu Aug 24 23:23:28 2000 @@ -1,6 +1,6 @@ /* * static char *rcsid_skill_util_c = - * "$Id: skill_util.c,v 1.7 2000/08/02 06:04:50 cvs Exp $"; + * "$Id: skill_util.c,v 1.8 2000/08/25 06:23:28 cvs Exp $"; */ /* CrossFire, A Multiplayer game for X-windows @@ -753,6 +753,9 @@ for(i=0;i<exp_index;i++) { if(!QUERY_FLAG(exp_ob[i],FLAG_APPLIED)) SET_FLAG(exp_ob[i],FLAG_APPLIED); + /* GD: Update perm exp when loading player. */ + if (settings.use_permanent_experience) + calc_perm_exp(exp_ob[i]); pl->stats.exp += exp_ob[i]->stats.exp; player_lvl_adj(NULL, exp_ob[i]); } @@ -1006,8 +1009,11 @@ { int rv; - rv = (a*100)/b; + if (b <= 0) + return 0; + rv = (int)((100.0f * ((float)a) / ((float)b) ) + 0.5f); + if (rv < 0) return 0; else if (rv > 100)