Just personal preference, but I would urge you to use the old isname function by Jvrgen Zigge Sigvardsson (in the utils/OLD directory). It seems far far too dangerous to be able to type any part of a name. I can't imagine it wouldn't get terribly confused about what you mean if the last few letters of your name matched the first few letters of your opponents name matched the middle letters of some other mobile name in the same room. Your name is "roberTO", your fighting a "TOy doll" and there is a "barTOk" in the room. You say "look to". How can it possibly know what you really mean? There are three valid choices! Right now it just takes the first one in the list, which means it is effectively random. This is a Bad Thing (tm). Granted, Jvrgen's code could have the same problem if your name was "TOm" and you were fighting a "TOy doll" and there was a "TOltec warrior" in the room, but that is much less likely to happen then the first example, and when it does it is less surprising. i.e. Jvrgen's code yields more intuitive results. Not that Rob's code couldn't be useful elsewhere, but it seems far too dangerous for general purpose name searching IMO. To be certain with Rob's code, you still have to type a large enough portion of the name to insure uniqueness against anything else in the room so you haven't really saved yourself a whole lot of effort. I was actually surprised that Jvrgen's code was moved to the OLD directory - they should both be maintained as current, with Rob's being given a different name to reflect its more generalized searching results. >int isname(const char *str, const char *namelist) >{ > const char *newlist; > const char *curtok; > > newlist = strdup(namelist); /* make a copy since strtok 'modifies' strings >*/ > > for(curtok = strtok(newlist, WHITESPACE); curtok; curtok = strtok(NULL, >WHITESPACE)) > if(curtok && is_apart(str, curtok)) >/* was if(curtok && is_abbrev(str, curtok)) in Jvrgen's code */ > free(newlist); > return 1; > > free(newlist); > return 0; >} > Is your boss reading your email? ....Probably Keep your messages private by using Lycos Mail. Sign up today at http://mail.lycos.com -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT