version 1.29 | | version 1.30 |
---|
| | |
/* | | /* |
* static char *rcsid_arch_c = | | * static char *rcsid_arch_c = |
* "$Id: arch.c,v 1.29 2003/10/27 07:24:13 mwedel Exp $"; | | * "$Id: arch.c,v 1.30 2005/05/03 18:31:04 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
* Return value: | | * Return value: |
* - the archetype found or null if nothing was found. | | * - the archetype found or null if nothing was found. |
*/ | | */ |
archetype *find_archetype_by_object_name(char *name) { | | archetype *find_archetype_by_object_name(const char *name) { |
archetype *at; | | archetype *at; |
| | |
if (name == NULL) | | if (name == NULL) |
| | |
* against (eg, to only match against skills or only skill objects for example). | | * against (eg, to only match against skills or only skill objects for example). |
* If type is -1, ew don't match on type. | | * If type is -1, ew don't match on type. |
*/ | | */ |
object *get_archetype_by_skill_name(char *skill, int type) { | | object *get_archetype_by_skill_name(const char *skill, int type) { |
archetype *at; | | archetype *at; |
| | |
if (skill == NULL) | | if (skill == NULL) |
| | |
* doesn't malloc it each time - not that this function is used much, | | * doesn't malloc it each time - not that this function is used much, |
* but it otherwise had a big memory leak. | | * but it otherwise had a big memory leak. |
*/ | | */ |
object *get_archetype_by_object_name(char *name) { | | object *get_archetype_by_object_name(const char *name) { |
archetype *at; | | archetype *at; |
char tmpname[MAX_BUF]; | | char tmpname[MAX_BUF]; |
int i; | | int i; |
| | |
} | | } |
| | |
/* GROS - find_best_weapon_used_match and item_matched_string moved there */ | | /* GROS - find_best_weapon_used_match and item_matched_string moved there */ |
object *find_best_weapon_used_match(object *pl, char *params) | | object *find_best_weapon_used_match(object *pl, const char *params) |
{ | | { |
object *tmp, *best=NULL; | | object *tmp, *best=NULL; |
int match_val=0,tmpmatch; | | int match_val=0,tmpmatch; |
| | |
* IF count is >1, we need to make plural name. Return if match. | | * IF count is >1, we need to make plural name. Return if match. |
* Last, make a check on the full name. | | * Last, make a check on the full name. |
*/ | | */ |
int item_matched_string(object *pl, object *op, char *name) | | int item_matched_string(object *pl, object *op, const char *name) |
{ | | { |
char *cp, local_name[MAX_BUF]; | | char *cp, local_name[MAX_BUF]; |
int count,retval=0; | | int count,retval=0; |
| | |
* an object, and never NULL. | | * an object, and never NULL. |
*/ | | */ |
| | |
object *create_singularity(char *name) { | | object *create_singularity(const char *name) { |
object *op; | | object *op; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
sprintf(buf,"singluarity (%s)",name); | | sprintf(buf,"singluarity (%s)",name); |
| | |
* object containing a copy of the archetype. | | * object containing a copy of the archetype. |
*/ | | */ |
| | |
object *get_archetype(char *name) { | | object *get_archetype(const char *name) { |
archetype *at; | | archetype *at; |
at = find_archetype(name); | | at = find_archetype(name); |
if (at == NULL) | | if (at == NULL) |
| | |
*/ | | */ |
| | |
unsigned long | | unsigned long |
hasharch(char *str, int tablesize) { | | hasharch(const char *str, int tablesize) { |
unsigned long hash = 0; | | unsigned long hash = 0; |
int i = 0, rot = 0; | | int i = 0, rot = 0; |
char *p; | | const char *p; |
| | |
for (p = str; i < MAXSTRING && *p; p++, i++) { | | for (p = str; i < MAXSTRING && *p; p++, i++) { |
hash ^= (unsigned long) *p << rot; | | hash ^= (unsigned long) *p << rot; |
| | |
* returns a pointer to the found archetype, otherwise NULL. | | * returns a pointer to the found archetype, otherwise NULL. |
*/ | | */ |
| | |
archetype *find_archetype(char *name) { | | archetype *find_archetype(const char *name) { |
archetype *at; | | archetype *at; |
unsigned long index; | | unsigned long index; |
| | |