Re: [newbie code] correct possessive plural names in socials

From: Mike Breuer (mbreuer@new.rr.com)
Date: 07/23/01


----- Original Message -----
From: "Justin" <justinl@MAC.COM>

> I came asking for help with why the name is being saved to the player, and
> for help on returning text through act, not for help with my choice of
> English rules. If you (or anyone else now) who knows and wants to help, I
> would still appreciate it.

Not only a professional programmer, but I majored in English as well.  My
statement is correct, according to what I learned in school.  I even looked it
up.  Of course it's been a number of years and not only do rules change, but
they vary from country to country.  Since debates about the language have been
banned on this list, I'll confine the rest of my response to a few snippets
that will let you enforce the rules the way you want to:

#define PLURAL(name) ((LOWER((name)[strlen((name)) - 1]) == 's') ? "'" : "'s")

You use $x/$X in act to indicate possessive.  In perform_act in comm.c, add:

char temp_name[MAX_NAME_LENGTH+3]; /* NULL and ' or 's */

In the switch statement in that function, add cases for $x and $x:

case 'x':
  sprintf(temp_name, "%s%s", PERS(ch, to), PLURAL(PERS(ch, to)));
  i = temp_name;
  break;
case 'X':
   if (!vict_obj) {
     i = ACTNULL;
   } else {
     sprintf(temp_name, "%s%s", PERS((struct char_data *)vict_obj, to),
                                PLURAL(PERS((struct char_data *)vict_obj,
to)));
     i = temp_name;
   }
   break;

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST