/* **************************************************************
  December 27th, 1997
  Gothar's Clan Systems Version 1.0
  1997 Copyright <* FREEWARE *>
  If you use this code:
     1.Keep all the credits in the code.
     2.Use the help entry for bank
     3.Send a bug report,any comments or ideas
       Ian McCormick (aka Gothar)
       mcco0055@algonquinc.on.ca

Here is a listing of what the code does:

************************************************************** */
/* N.B: READ this code before you ADD anything!!
 *      This is clan.c plus a patch file for other files.
 */

#include "merc.h"

/* Clan commands */
DECLARE_DO_FUN( do_cguild	);
DECLARE_DO_FUN( do_clanlist);
DECLARE_DO_FUN( do_cleader	);

  { "cguild",	do_cguild,	POS_SLEEPING,0, LOG_NORMAL, 1 },
  { "clist",	do_clanlist,	POS_SLEEPING,0, LOG_NORMAL, 1 },
  { "cleader",	do_cleader,	POS_SLEEPING,L4, LOG_NORMAL, 1 },


Add in act_move.c:
#include "tables.h"

Change in act_move.c:
void do_recall( CHAR_DATA *ch, char *argument )

    act( "$n prays for transportation!", ch, 0, 0, TO_ROOM );
+   if(!IS_CLAN(ch))
+   {   
       if( ( location = get_room_index( ROOM_VNUM_TEMPLE ) ) == NULL )
+      {
	    send_to_char( "You are completely lost.\n\r", ch );
+	    return;
+      }
+   }
+   else /* in a clan */
+   {
+      if((location = get_room_index(clan_table[ch->clan].recall)) == NULL)
+      {
+	    send_to_char( "Your clan recall room doesn't exist.\n\r", ch );
+	    return;
+      }
+   }
    if( ch->in_room == location )
Remove from act_comm.c:
void do_clantalk( CHAR_DATA *ch, char *argument )


From handler.c changes in:
void extract_char( CHAR_DATA *ch, bool fPull )

    /* Death room is set in the clan table now */
    if ( !fPull )
    {
+      char_to_room(ch,get_room_index(clan_table[ch->clan].deathroom));
	 return;
    }

Add #include "clan.h" to every file which contains:
#include "lookup.h"

Create macro in merc.h:
#define IS_CLAN(ch) (is_clan(ch))

From tables.h remove this:
extern const struct clan_type clan_table[MAX_CLAN];
struct clan_type
{
	 char 	*name;       /* name */
	 char 	*who_name;   /* who entry */
	 sh_int hall;   /* death-transfer room */
	 bool	independent; /* true for loners */
};

From merc.h
Add:
struct	pc_data
{
    PC_DATA *		next;
    BUFFER * 		buffer;
+   sh_int		leader;

Remove from tables.c

const struct clan_type clan_table[MAX_CLAN] =
{
  /* name,    who entry,    death-transfer room,   independent */
    /* independent should be FALSE if is a real clan */
  {"",	 "",		    ROOM_VNUM_TEMPLE, TRUE},
  {"loner",  "[ Loner ] ",ROOM_VNUM_TEMPLE, TRUE},
  {"rom",  "[  ROM  ] ",ROOM_VNUM_TEMPLE, FALSE}
};

Remove void do_guild( CHAR_DATA *ch, char *argument )
from act_wiz.c

In save.c 
Change: void fwrite_char( CHAR_DATA *ch, FILE *fp )

    if (ch->clan)
       fprintf( fp, "Clan %s~\n",clan_table[ch->clan].name);
+   if (ch->clan)
+      fprintf( fp, "Leader %d\n",ch->pcdata->leader);
+   else 
+      fprintf( fp, "Leader %d\n",-1);
Change: void fread_char( CHAR_DATA *ch, FILE *fp )

	case 'L':
	    KEY( "LastLevel",	ch->pcdata->last_level, fread_number( fp ) );
+	    KEY( "Leader", ch->pcdata->leader, fread_string(fp));
	    KEY( "LLev",	ch->pcdata->last_level, fread_number( fp ) );

Add to act_comm.c
void do_channels( CHAR_DATA *ch, char *argument)

    if (IS_IMMORTAL(ch))
    {
      send_to_char("god channel    ",ch);
      if(!IS_SET(ch->comm,COMM_NOWIZ))
        send_to_char("ON\n\r",ch);
      else
        send_to_char("OFF\n\r",ch);
    }
+   if (IS_CLAN(ch))
+   {
+     send_to_char("clan channel    ",ch);
+     if(!IS_SET(ch->comm,COMM_NOCLAN))
+       send_to_char("ON\n\r",ch);
+     else
+       send_to_char("OFF\n\r",ch);
+   }
