--- deliantra/server/common/living.C 2006/09/01 17:16:47 1.4 +++ deliantra/server/common/living.C 2006/09/07 09:37:12 1.6 @@ -1,6 +1,6 @@ /* * static char *rcsid_living_c = - * "$Id: living.C,v 1.4 2006/09/01 17:16:47 elmex Exp $"; + * "$Id: living.C,v 1.6 2006/09/07 09:37:12 pippijn Exp $"; */ /* @@ -501,15 +501,10 @@ if ( QUERY_FLAG(op,FLAG_UNDEAD) != QUERY_FLAG(&refop,FLAG_UNDEAD)) { success=1; if(flag>0) { - if(op->race) free_string(op->race); - op->race=add_string("undead"); + op->race = "undead"; new_draw_info(NDI_UNIQUE, 0, op,"Your lifeforce drains away!"); } else { - if(op->race) free_string(op->race); - if(op->arch->clone.race) - op->race=add_string(op->arch->clone.race); - else - op->race = NULL; + op->race = op->arch->clone.race; new_draw_info(NDI_UNIQUE, 0, op,"Your lifeforce returns!"); } } @@ -768,7 +763,6 @@ void fix_player(object *op) { int i,j; - event *evt; float f,max=9,added_speed=0,bonus_speed=0, sp_tmp,speed_reduce_from_disease=1; int weapon_weight=0,weapon_speed=0; int best_wc=0, best_ac=0, wc=0, ac=0; @@ -802,10 +796,8 @@ } memcpy(op->body_used, op->body_info, sizeof(op->body_info)); - if(op->slaying!=NULL) { - free_string(op->slaying); - op->slaying=NULL; - } + op->slaying = 0; + if(!QUERY_FLAG(op,FLAG_WIZ)) { CLEAR_FLAG(op, FLAG_XRAYS); CLEAR_FLAG(op, FLAG_MAKE_INVIS); @@ -1013,7 +1005,7 @@ if (IS_COMBAT_SKILL(tmp->subtype)) wc_obj=tmp; if (op->chosen_skill) { - LOG(llevDebug, "fix_player, op %s has multiple skills applied\n", op->name); + LOG(llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); } op->chosen_skill = tmp; if(tmp->stats.dam>0) { /* skill is a 'weapon' */ @@ -1027,11 +1019,8 @@ if(tmp->stats.wc) wc-=(tmp->stats.wc+tmp->magic); - if(tmp->slaying!=NULL) { - if (op->slaying != NULL) - free_string (op->slaying); - add_refcount(op->slaying = tmp->slaying); - } + if (tmp->slaying!=NULL) + op->slaying = tmp->slaying; if(tmp->stats.ac) ac-=(tmp->stats.ac+tmp->magic); @@ -1043,7 +1032,7 @@ case SKILL_TOOL: if (op->chosen_skill) { - LOG(llevDebug, "fix_player, op %s has multiple skills applied\n", op->name); + LOG(llevDebug, "fix_player, op %s has multiple skills applied\n", &op->name); } op->chosen_skill = tmp; if (op->type == PLAYER) @@ -1076,11 +1065,7 @@ weapon_weight=tmp->weight; weapon_speed=((int)WEAPON_SPEED(tmp)*2-tmp->magic)/2; if(weapon_speed<0) weapon_speed=0; - if(tmp->slaying!=NULL) { - if (op->slaying != NULL) - free_string (op->slaying); - add_refcount(op->slaying = tmp->slaying); - } + op->slaying = tmp->slaying; /* If there is desire that two handed weapons should do * extra strength damage, this is where the code should * go. @@ -1549,7 +1534,7 @@ fix_player(who); if(op->level>1) { if (op->type!=PLAYER) - sprintf(buf,"You are now level %d in the %s skill.",op->level,op->name); + sprintf(buf,"You are now level %d in the %s skill.",op->level,&op->name); else sprintf(buf,"You are now level %d.",op->level); if(who) new_draw_info(NDI_UNIQUE|NDI_RED, 0, who,buf); @@ -1559,7 +1544,7 @@ op->level--; fix_player(who); if(op->type!=PLAYER) { - sprintf(buf,"You are now level %d in the %s skill.",op->level,op->name); + sprintf(buf,"You are now level %d in the %s skill.",op->level,&op->name); new_draw_info(NDI_UNIQUE|NDI_RED, 0, who,buf); } player_lvl_adj(who,op); /* To decrease more levels */ @@ -1601,7 +1586,7 @@ /* Cap permanent experience. */ if (op->perm_exp < 0) op->perm_exp = 0; - else if (op->perm_exp > MAX_EXPERIENCE) + else if (op->perm_exp > (sint64) MAX_EXPERIENCE) op->perm_exp = MAX_EXPERIENCE; } @@ -1724,7 +1709,7 @@ sint64 check_exp_adjust(const object *op, sint64 exp) { if (exp<0) return check_exp_loss(op, exp); - else return MIN(exp, MAX_EXPERIENCE - op->stats.exp); + else return MIN(exp, (sint64) MAX_EXPERIENCE - op->stats.exp); } @@ -1814,7 +1799,7 @@ * MAX_EXPERIENCE to prevent overflows. If the player somehow has * more than max exp, just return. */ - if (exp > 0 && ( op->stats.exp > (MAX_EXPERIENCE - exp))) { + if (exp > 0 && ( op->stats.exp > (sint64) (MAX_EXPERIENCE - exp))) { exp = MAX_EXPERIENCE - op->stats.exp; if (exp < 0) return; }