 Voltecs system for player birthdays...
-======================================-
              Version 2.0

Updates scince version 1.0
--------------------------
Fixed a nasty typo in update_birthday, so it now only sends info
to people you want it to!

now reports the charcaters age,

example of a replacement get_age() function so that players
ages should report properly.

added this bit!

and re-wrote the bit of text at the end...

---- CODE STARTS HERE ----

add the following to yer pcdata structure in merc.h

TIME_INFO_DATA  birthday;

and add the following to nanny in comm.c in the section
that sets up all a newbies stats etc..  Ie the bit that
starts...

if (ch->level == 0)
   {
   ch->level = 1;
   ch->Plevel = 1;
   ....

   ch->birthday = time_info;  /* Added for player birthdays - Voltec 98*/
   }

we also need to add some code to save.c to save the birthday data...
so in fwrite_char()...

/* Voltecs Player Birthdays */
fprintf(fp, "BDay %d %d %d %d", ch->birthday.hour, ch->birthday.day, ch->birthday.month, ch->birthday.year);

and now for some code to read it back in again...
so in fread_char()...

case 'B' :
         KEY( "Bamfin", ch->pcdata->bamfin, fread_string(fp));
         ....
         if (!strcmp(word, "BDay")) /* Voltecs player birthdays! */
            {
            ch->birthday.hour  = fread_number(fp);
            ch->birthday.day   = fread_number(fp);
            ch->birthday.month = fread_number(fp);
            ch->birthday.year  = fread_number(fp);
            fMatch = TRUE;
            break;
            }


then add the following code to update.c in the function weather_update...

in the case statement add the following...

switch (++time_info.hour)
   {
   case 5:
      .....

      update_birthday; /* Voltecs player Birthdays */
      break;

And then add the following function to the bottom of update.c

void update_birthday(void)
{

 /* Voltecs player birthday system... - Voltec 98 *
  * Email voltec@cyberdude.com                    */

 char                   buf[MAX_STRING_LENGTH];
 DESCRIPTOR_DATA        d;

 for ( d=descriptor_list; d !=NULL; d=d->next)
     {
     if (d->connected == CON_PLAYING &&
         d->character->birthday.day == time_info.day && 
         d->character->birthday.month == time_info.month )
         {
         sprintf(buf, "%s is %d today! Happy Birthday %s!\n\r",
                 d->character->name, get_age(d->character), d->character->name );
         info(buf, ch, NULL, INFO_BIRTHDAY, 0); /*Voltecs Info channel, add yer own if you prefer */
         }
     }
 return;
}

now whenever the game reaches a players birthday in the calendar, it reports
it over the info channel.

It is a bit of a philisophical matter as to how you deal with ages
in your mud. 

What happens to players when they log out?  do they cease to be, (and as
such stop aging?) or do they "vist another place?" (and as such keep aging)

I'll leave it up to you to decide how you want to deal with the situation
but the code as outlined above reports the players age in the same way that
score does.  if this doesn't suit you, change the get_age function in
handler.c.  that way ages are consistant accross the game.

eg you might want get age to look like something like this...

/*
 * Retrieve a character's age - Voltecs version - 1999.
 */

int get_age( CHAR_DATA *ch )
{
    return 17 + (time_info.year - ch->birthday.year);
}

I dont know if this works, as it is largely untested...

NB If you are using Voltecs info channel, don't forget to add a section
for INFO_BIRTHDAY in merc.h etc.  instructions on what you need to add
are included with voltecs info.c source...

If you don't like the idea of using an info channel do it with gecho's...

Usual "if you use it let me know" type stuff, and leave my comments in
the code if you would be so kind!

Have fun!

-Voltec
