Re: [CODE]Title

From: Welcor (welcor@dune.net)
Date: 03/01/02


From: "Kevin Dethlefs" <Demortes@MSN.COM>
> Somewhere in the code is attaching the name automatically before the
title.
> You see, my coder is trying to make a function to where you can put your
> name in your title, and it justs stay's there. He can't find it, and
niether
> can I (which isn't a bit suprising, I'm too new to coding), anyway. I will
> give you an example.
>
> >title The dark master, Demortes
>
> Then my title on who and in rooms should be 'The dark master, Demortes'.
But
> it is currently 'Demortes The dark master, Demortes' How do i get rid of
the
> first 'demortes'?
> Loving Kilara, and you know I love every moment of this.
> Kevin
>
You'll want to completely rewrite the way titles are handled.
Currently (in stock), the title is just a text, which is displayed after
the name - as you yourself wrote above;

void set_title(struct char_data * ch, char *title)
{
  if (title == NULL) {
    if (GET_SEX(ch) == SEX_FEMALE)
      title = title_female(GET_CLASS(ch), GET_LEVEL(ch));
    else
      title = title_male(GET_CLASS(ch), GET_LEVEL(ch));
  }

+  /* if there isn't a %s inthere, make sure it's put in front */
+  if (!strstr(title, "%s"))
+    title = strcat("%s ", title);

  if (strlen(title) > MAX_TITLE_LENGTH)
    title[MAX_TITLE_LENGTH] = '\0';

  if (GET_TITLE(ch) != NULL)
    free(GET_TITLE(ch));

  GET_TITLE(ch) = str_dup(title);
}

Now, everywhere you use GET_TITLE(ch) for display
(do_title, list_char_to_char, etc.) change it like this:

- sprintf(buf, "%s %s", GET_NAME(ch), GET_TITLE(ch));
+ sprintf(buf, GET_TITLE(ch), GET_NAME(ch));

This is all Mailer Code (i believe that's a (tm) :P),
and I haven't tested it.

Welcor

--
   +---------------------------------------------------------------+
   | 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