do_destroy, update clan

Posted by Zeno on Wed 09 Mar 2005 03:24 AM — 6 posts, 13,871 views.

USA #0
Is there anyway for do_destroy to update the clan if they are in one? It needs to clan->members-- since they are destroyed. The delete snippet uses do_destroy, so I really need a way for this to work.
USA #1
Does destroy load up the character data? If so, isn't it just a matter of getting their clan name, looking up the clan, reducing members by one, and that's all?
USA #2
Nope it doesn't, that's why I'm asking. I'd be simple if I was able to use victim->pcdata->clan.
USA #3
I should have guessed that it wouldn't be so simple. :P

Well, in that case you're going to have to open up the pfile and find the clan name. Isn't there a reduced character-opener that is used e.g. for the last command? You could always use load_char_obj or whichever function it is, just make sure you dispose of the char_data afterwards.
USA #4
Not that I know of.
void do_last( CHAR_DATA *ch, char *argument )
{
    char buf [MAX_STRING_LENGTH];
    char arg [MAX_INPUT_LENGTH];
    char name[MAX_INPUT_LENGTH];
    struct stat fst;

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
        send_to_char( "Usage: last <playername>\n\r", ch );
        return;
    }
    strcpy( name, capitalize(arg) );
    sprintf( buf, "%s%c/%s", PLAYER_DIR, tolower(arg[0]), name );
    if ( stat( buf, &fst ) != -1 && check_parse_name( capitalize(name), FALSE ))
      sprintf( buf, "%s was last on: %s\r", name, ctime( &fst.st_mtime ) );
    else
      sprintf( buf, "%s was not found.\n\r", name );
   send_to_char( buf, ch );
}


I'll just look over how loadup works.
Amended on Wed 09 Mar 2005 06:57 PM by Zeno
USA #5
Oh. The version of last on my MUD must have been extended. It loads up the pfile only partially, scanning for level, so that you can't use 'last' on somebody higher level than you.