version 1.18 | | version 1.19 |
---|
| | |
/* | | /* |
* static char *rcsid_arch_c = | | * static char *rcsid_arch_c = |
* "$Id: arch.c,v 1.18 2002/05/19 03:55:48 mwedel Exp $"; | | * "$Id: arch.c,v 1.19 2002/05/31 04:18:32 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
char *cp, local_name[MAX_BUF]; | | char *cp, local_name[MAX_BUF]; |
int count,retval=0; | | int count,retval=0; |
strcpy(local_name, name); /* strtok is destructive to name */ | | strcpy(local_name, name); /* strtok is destructive to name */ |
| | |
for (cp=strtok(local_name,","); cp; cp=strtok(NULL,",")) { | | for (cp=strtok(local_name,","); cp; cp=strtok(NULL,",")) { |
while (cp[0]==' ') ++cp; /* get rid of spaces */ | | while (cp[0]==' ') ++cp; /* get rid of spaces */ |
| | |
/* LOG(llevDebug,"Trying to match %s\n", cp);*/ | | /* LOG(llevDebug,"Trying to match %s\n", cp);*/ |
/* All is a very generic match - low match value */ | | /* All is a very generic match - low match value */ |
if (!strcmp(cp,"all")) return 1; | | if (!strcmp(cp,"all")) return 1; |
| | |
/* unpaid is a little more specific */ | | /* unpaid is a little more specific */ |
if (!strcmp(cp,"unpaid") && QUERY_FLAG(op,FLAG_UNPAID)) return 2; | | if (!strcmp(cp,"unpaid") && QUERY_FLAG(op,FLAG_UNPAID)) return 2; |
if (!strcmp(cp,"cursed") && QUERY_FLAG(op,FLAG_KNOWN_CURSED) && | | if (!strcmp(cp,"cursed") && QUERY_FLAG(op,FLAG_KNOWN_CURSED) && |
(QUERY_FLAG(op,FLAG_CURSED) ||QUERY_FLAG(op,FLAG_DAMNED))) | | (QUERY_FLAG(op,FLAG_CURSED) ||QUERY_FLAG(op,FLAG_DAMNED))) |
return 2; | | return 2; |
| | |
/* Allow for things like '100 arrows' */ | | /* Allow for things like '100 arrows' */ |
if ((count=atoi(cp))!=0) { | | if ((count=atoi(cp))!=0) { |
cp=strchr(cp, ' '); | | cp=strchr(cp, ' '); |
while (cp && cp[0]==' ') ++cp; /* get rid of spaces */ | | while (cp && cp[0]==' ') ++cp; /* get rid of spaces */ |
} | | } |
else | | else { |
{ | | |
if (pl->type==PLAYER) | | if (pl->type==PLAYER) |
{ | | |
count=pl->contr->count; | | count=pl->contr->count; |
} | | |
else | | else |
{ | | |
count = 0; | | count = 0; |
}; | | } |
}; | | |
if (!cp || cp[0]=='\0' || count<0) return 0; | | if (!cp || cp[0]=='\0' || count<0) return 0; |
| | |
/* base name matched - not bad */ | | /* base name matched - not bad */ |
if (strcasecmp(cp,op->name)==0 && !count) return 4; | | if (strcasecmp(cp,op->name)==0 && !count) return 4; |
| | |
else if (count>1) { /* Need to plurify name for proper match */ | | else if (count>1) { /* Need to plurify name for proper match */ |
char newname[MAX_BUF]; | | if (strcasecmp(cp,op->name_pl)) { |
strcpy(newname, op->name); | | |
if (QUERY_FLAG(op,FLAG_NEED_IE)) { | | |
char *cp1=strrchr(newname,'y'); | | |
if(cp1!=NULL) | | |
*cp1='\0'; /* Strip the 'y' */ | | |
strcat(newname,"ies"); | | |
} | | |
else strcat(newname,"s"); | | |
if (!strcasecmp(newname,cp)) { | | |
pl->contr->count=count; /* May not do anything */ | | pl->contr->count=count; /* May not do anything */ |
return 6; | | return 6; |
} | | } |
| | |
MIN(strlen(cp),strlen(query_base_name(op,1))))) retval=14; | | MIN(strlen(cp),strlen(query_base_name(op,1))))) retval=14; |
if (retval) { | | if (retval) { |
if (pl->type == PLAYER) | | if (pl->type == PLAYER) |
{ | | |
pl->contr->count=count; | | pl->contr->count=count; |
}; | | |
return retval; | | return retval; |
} | | } |
} | | } |