version 1.130 | | version 1.131 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.130 2005/07/19 20:59:34 ryo_saeba Exp $"; | | * "$Id: apply.c,v 1.131 2005/07/19 22:52:39 akirschbaum Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
char* separator; | | char* separator; |
int yield; | | int yield; |
char got[ MAX_BUF ]; | | char got[ MAX_BUF ]; |
| | int len; |
| | |
if ( !pl || !transformer ) | | if ( !pl || !transformer ) |
return; | | return; |
| | |
new_draw_info_format( NDI_UNIQUE, 0, pl, "You can't use the %s with your %s!", query_name( transformer ), query_name( marked ) ); | | new_draw_info_format( NDI_UNIQUE, 0, pl, "You can't use the %s with your %s!", query_name( transformer ), query_name( marked ) ); |
return; | | return; |
} | | } |
memset( got, 0, MAX_BUF ); | | |
find += strlen( transformer->arch->name ) + 1; | | find += strlen( transformer->arch->name ) + 1; |
/* Item can be used, now find how many and what it yields */ | | /* Item can be used, now find how many and what it yields */ |
if ( isdigit( *( find ) ) ) | | if ( isdigit( *( find ) ) ) |
| | |
find++; | | find++; |
while ( *find == ' ' ) | | while ( *find == ' ' ) |
find++; | | find++; |
| | memset( got, 0, MAX_BUF ); |
if ( (separator = strchr( find, ';' ))!=NULL) | | if ( (separator = strchr( find, ';' ))!=NULL) |
{ | | { |
strncpy( got, find, MIN( separator - find, MAX_BUF ) ); | | len = separator - find; |
} | | } |
else | | else |
{ | | { |
strncpy( got, find, MAX_BUF ); | | len = strlen(find); |
} | | } |
| | if ( len > MAX_BUF-1) |
| | len = MAX_BUF-1; |
| | strcpy( got, find ); |
| | got[len] = '\0'; |
| | |
/* Now create new item, remove used ones when required. */ | | /* Now create new item, remove used ones when required. */ |
new_item = get_archetype( got ); | | new_item = get_archetype( got ); |