Hello, and happy new year! Playing with inscription skill, i found a small bug (there's another, crashing one, patch will follow as soon as i solve it :)). What happens is that, when you first use a skill you don't own (like inscription, or a skill with a talisman), give_skill_by_name gets called to insert the skill in inventory. But player's contr->last_skill_ob does not get updated. This field is often used to quickly find skills by number. So for instance using inscription two times, when you don't have exp the first, will give you TWO inscription skills in inventory! (and a third use gives a 3rd object). My patch changes give_skill_by_name to update contr->last_skill_ob after inserting skill item. Also, the first time you use a skill like that, you do get the skill object, but not the actual experience. This is because add_player_exp will not update newly inserted object in inventory. I fixed that also. Nicolas 'Ryo' -------------- next part -------------- Index: common/living.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/common/living.c,v retrieving revision 1.58 diff -u -r1.58 living.c --- common/living.c 28 Dec 2003 06:06:00 -0000 1.58 +++ common/living.c 3 Jan 2004 10:59:11 -0000 @@ -1491,6 +1491,16 @@ LOG(llevError, "add_player_exp: couldn't find skill %s\n", skill_name); return NULL; } + + /* Sanity check: if player knows the skill (in op->contr->last_skill_ob), + * don't do anything (except log something's weird) + */ + if ( ( skill_obj->subtype < NUM_SKILLS ) && ( op->contr->last_skill_ob[ skill_obj->subtype ] ) ) + { + LOG( llevError, "add_player_exp: last_skill_ob not NULL for skill %s (%d)\n", skill_name, skill_obj->subtype ); + return NULL; + } + /* clear the flag - exp goes into this bucket, but player * still doesn't know it. */ @@ -1498,6 +1508,8 @@ skill_obj->stats.exp = 0; skill_obj->level = 1; insert_ob_in_ob(skill_obj, op); + if ( skill_obj->subtype < NUM_SKILLS ) + op->contr->last_skill_ob[ skill_obj->subtype ] = skill_obj; return skill_obj; } @@ -1625,7 +1637,7 @@ if (!skill_obj) { if (flag == SK_EXP_NONE) return; else if (flag == SK_EXP_ADD_SKILL) - give_skill_by_name(op, skill_name); + skill_obj = give_skill_by_name(op, skill_name); } } } -------------- next part -------------- _______________________________________________ crossfire-devel mailing list crossfire-devel at lists.real-time.com https://mailman.real-time.com/mailman/listinfo/crossfire-devel