Hello. Tweaked my 'tell' improvement command, so it uses the ANSI strncasecmp function instead of the evil ms-only one. Here's the patch, feel free to tweak it. I'll commit it in a week if no one objects :) Nicolas 'Ryo' -------------- next part -------------- Index: server/c_chat.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/c_chat.c,v retrieving revision 1.15 diff -u -r1.15 c_chat.c --- server/c_chat.c 28 Jul 2003 05:19:35 -0000 1.15 +++ server/c_chat.c 3 Nov 2003 21:00:02 -0000 @@ -147,18 +147,20 @@ snprintf(buf,MAX_BUF-1, "%s tells you: %s",op->name, msg); - for(pl=first_player;pl!=NULL;pl=pl->next) - if(strncasecmp(pl->ob->name,name,MAX_NAME)==0) { + pl = find_player_partial_name( name ); + if ( pl ) + { new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf); new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op, - "You tell %s: %s", name, msg); + "You tell %s: %s", pl->ob->name, msg); /* Update last_tell value [mids 01/14/2002] */ strcpy(pl->last_tell, op->name); return 1; - } - new_draw_info(NDI_UNIQUE, 0,op,"No such player."); + } + + new_draw_info(NDI_UNIQUE, 0,op,"No such player or ambiguous name."); return 1; } Index: include/sproto.h =================================================================== RCS file: /cvsroot/crossfire/crossfire/include/sproto.h,v retrieving revision 1.96 diff -u -r1.96 sproto.h --- include/sproto.h 13 Sep 2003 05:01:34 -0000 1.96 +++ include/sproto.h 3 Nov 2003 21:03:01 -0000 @@ -474,6 +474,7 @@ int summon_object(object *op, object *caster, object *spell_ob, int dir); /* player.c */ player *find_player(char *plname); +player* find_player_partial_name( char* plname ); void display_motd(object *op); int playername_ok(char *cp); int add_player(NewSocket *ns); Index: server/player.c =================================================================== RCS file: /cvsroot/crossfire/crossfire/server/player.c,v retrieving revision 1.137 diff -u -r1.137 player.c --- server/player.c 17 Oct 2003 17:24:53 -0000 1.137 +++ server/player.c 3 Nov 2003 21:03:34 -0000 @@ -51,6 +51,27 @@ return NULL; } +player* find_player_partial_name( char* plname ) + { + player* pl; + player* found = NULL; + size_t namelen = strlen( plname ); + for ( pl = first_player; pl != NULL; pl = pl->next ) + { + if ( strlen( pl->ob->name ) < namelen ) + continue; + + if ( !strncasecmp( pl->ob->name, plname, namelen ) ) + { + if ( found ) + return NULL; + + found = pl; + } + } + return found; + } + void display_motd(object *op) { char buf[MAX_BUF]; FILE *fp; -------------- next part -------------- _______________________________________________ crossfire-devel mailing list crossfire-devel at lists.real-time.com https://mailman.real-time.com/mailman/listinfo/crossfire-devel