version 1.3 | | version 1.4 |
---|
| | |
| | /* |
| | * static char *rcsid_skill_util_c = |
| | * "$Id: skill_util.c,v 1.4 2000/04/13 06:30:44 cvs Exp $"; |
| | */ |
| | /* |
| | CrossFire, A Multiplayer game for X-windows |
| | |
| | Copryight (C) 2000 Mark Wedel |
| | Copyright (C) 1992 Frank Tore Johansen |
| | |
| | This program is free software; you can redistribute it and/or modify |
| | it under the terms of the GNU General Public License as published by |
| | the Free Software Foundation; either version 2 of the License, or |
| | (at your option) any later version. |
| | |
| | This program is distributed in the hope that it will be useful, |
| | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| | GNU General Public License for more details. |
| | |
| | You should have received a copy of the GNU General Public License |
| | along with this program; if not, write to the Free Software |
| | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | |
| | The author can be reached via e-mail to mwedel@scruz.net |
| | */ |
| | |
/* Created July 95 to separate skill utilities from actual skills -b.t. */ | | /* Created July 95 to separate skill utilities from actual skills -b.t. */ |
| | |
/* Reconfigured skills code to allow linking of skills to experience | | /* Reconfigured skills code to allow linking of skills to experience |
| | |
shoottype = range_horn; | | shoottype = range_horn; |
break; | | break; |
default: | | default: |
LOG(llevDebug,"Warning: bad call of check_skill_to_apply()"); | | LOG(llevDebug,"Warning: bad call of check_skill_to_apply()\n"); |
LOG(llevDebug,"No skill exists for item: %s",query_name(item)); | | LOG(llevDebug,"No skill exists for item: %s\n",query_name(item)); |
return 0; | | return 0; |
} | | } |
| | |
| | |
object *op=skillop?skillop->env:NULL; | | object *op=skillop?skillop->env:NULL; |
| | |
if(!op||op->type!=PLAYER) { | | if(!op||op->type!=PLAYER) { |
LOG(llevError,"Error: unlink_skill() called for non-player!"); | | LOG(llevError,"Error: unlink_skill() called for non-player!\n"); |
return; | | return; |
} | | } |
| | |
| | |
* level. | | * level. |
*/ | | */ |
| | |
int SK_level(object *op) { | | int SK_level(object *op) |
int level = op->head?op->head->level:op->level; | | { |
| | object *head = op->head ? op->head : op; |
| | int level; |
| | |
#ifdef ALLOW_SKILLS | | #ifdef ALLOW_SKILLS |
if(op->type==PLAYER && op->chosen_skill && op->chosen_skill->level!=0) { | | if(head->type==PLAYER && head->chosen_skill && head->chosen_skill->level!=0) { |
level = op->chosen_skill->level; | | level = head->chosen_skill->level; |
| | } else { |
| | level = head->level; |
} | | } |
| | #else |
| | level = head->level; |
#endif | | #endif |
if(level<=0) level = 1; /* safety */ | | |
| | if(level<=0) |
| | { |
| | LOG (llevError, "BUG: SK_level(arch %s, name %s): level <= 0\n", |
| | op->arch->name, op->name); |
| | level = 1; /* safety */ |
| | } |
| | |
return level; | | return level; |
} | | } |