version 1.119 | | version 1.120 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.119 2005/04/15 20:56:38 ryo_saeba Exp $"; | | * "$Id: apply.c,v 1.120 2005/04/27 06:25:15 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
#define CONV_NR(xyz) (unsigned char) xyz->stats.sp | | #define CONV_NR(xyz) (unsigned char) xyz->stats.sp |
#define CONV_NEED(xyz) (unsigned long) xyz->stats.food | | #define CONV_NEED(xyz) (unsigned long) xyz->stats.food |
| | |
| | /* Takes one items and makes another. |
| | * converter is the object that is doing the conversion. |
| | * item is the object that triggered the converter - if it is not |
| | * what the converter wants, this will not do anything. |
| | */ |
int convert_item(object *item, object *converter) { | | int convert_item(object *item, object *converter) { |
int nr=0; | | int nr=0; |
object *tmp; | | object *tmp; |
| | |
if(item->type==PLAYER||CONV_FROM(converter)!=item->arch->name|| | | if(item->type==PLAYER||CONV_FROM(converter)!=item->arch->name|| |
(CONV_NEED(converter)&&CONV_NEED(converter)>item->nrof)) | | (CONV_NEED(converter)&&CONV_NEED(converter)>item->nrof)) |
return 0; | | return 0; |
| | |
if(CONV_NEED(converter)) { | | if(CONV_NEED(converter)) { |
nr=item->nrof/CONV_NEED(converter); | | nr=item->nrof/CONV_NEED(converter); |
decrease_ob_nr(item,nr*CONV_NEED(converter)); | | decrease_ob_nr(item,nr*CONV_NEED(converter)); |
| | |
converter->name, converter->map->path, converter->x, converter->y); | | converter->name, converter->map->path, converter->x, converter->y); |
return 0; | | return 0; |
} | | } |
| | fix_generated_item(item, converter, 0, 0, GT_MINIMAL); |
if(CONV_NR(converter)) | | if(CONV_NR(converter)) |
item->nrof=CONV_NR(converter); | | item->nrof=CONV_NR(converter); |
if(nr) | | if(nr) |
| | |
find++; | | find++; |
while ( *find == ' ' ) | | while ( *find == ' ' ) |
find++; | | find++; |
if ( separator = strchr( find, ';' ) ) | | if ( (separator = strchr( find, ';' ))!=NULL) |
{ | | { |
strncpy( got, find, MIN( separator - find, MAX_BUF ) ); | | strncpy( got, find, MIN( separator - find, MAX_BUF ) ); |
} | | } |