version 1.26 | | version 1.27 |
---|
| | |
/* | | /* |
* static char *rcsid_skill_util_c = | | * static char *rcsid_skill_util_c = |
* "$Id: skill_util.c,v 1.26 2002/03/03 20:05:58 avogl Exp $"; | | * "$Id: skill_util.c,v 1.27 2002/03/20 06:27:46 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
Copryight (C) 2000 Mark Wedel | | Copryight (C) 2002 Mark Wedel & Crossfire Development Team |
Copyright (C) 1992 Frank Tore Johansen | | Copyright (C) 1992 Frank Tore Johansen |
| | |
This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify |
| | |
along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | |
The author can be reached via e-mail to mwedel@scruz.net | | The author can be reached via e-mail to crossfire-devel@real-time.com |
*/ | | */ |
| | |
/* Created July 95 to separate skill utilities from actual skills -b.t. */ | | /* Created July 95 to separate skill utilities from actual skills -b.t. */ |
| | |
* return 0 on success, 1 on failure. | | * return 0 on success, 1 on failure. |
*/ | | */ |
| | |
int change_skill_to_skill (object *who, object *skill) | | int change_skill_to_skill (object *who, object *skl) |
{ | | { |
if (!skill) return 1; /* Quick sanity check */ | | if (!skl) return 1; /* Quick sanity check */ |
| | |
if (who->chosen_skill == skill) | | if (who->chosen_skill == skl) |
{ | | { |
/* optimization for changing skill to current skill */ | | /* optimization for changing skill to current skill */ |
if (who->type == PLAYER) | | if (who->type == PLAYER) |
| | |
return 0; | | return 0; |
} | | } |
| | |
if (skill->env != who) { | | if (skl->env != who) { |
LOG(llevError,"change_skill_to_skill: skill is not in players inventory\n"); | | LOG(llevError,"change_skill_to_skill: skill is not in players inventory\n"); |
return 1; | | return 1; |
} | | } |
| | |
if (apply_special (who, skill, AP_APPLY)) { | | if (apply_special (who, skl, AP_APPLY)) { |
LOG (llevError, "BUG: change_skill(): can't apply new skill\n"); | | LOG (llevError, "BUG: change_skill(): can't apply new skill\n"); |
return 1; | | return 1; |
} | | } |
| | |
if (tmp->type == SKILL && strcmp(tmp->name, skname)==0) | | if (tmp->type == SKILL && strcmp(tmp->name, skname)==0) |
return tmp; | | return tmp; |
} | | } |
| | return NULL; |
} | | } |