6D/
6D/area/
6D/boards/
6D/city/
6D/color/
6D/corpses/
6D/councils/
6D/htowns/
6D/news/
6D/specials/
6D/src/specials/
6D/src/trades/
Installation for Smaug

----------------------



1. In your Makefile, someplace above the main list of C_FLAGS,

   include the following:



#I3 - Comment out to disable I3 support

I3 = 1



   Then directly below the list of H_FILES, add the following:

   [Note: BSD users - put a period in front of the word ifdef, and in front of the word endif]



ifdef I3

   C_FILES := i3.c $(C_FILES)

   O_FILES := i3.o $(O_FILES)

   C_FLAGS := $(C_FLAGS) -DI3 -DI3SMAUG

endif



[Chronicles users should substitute -DI3CHRONICLES for -DI3SMAUG]



2. Open mud.h



   Locate the following:



/*

 * Structure for extended bitvectors -- Thoric

 */

struct extended_bitvector

{

    unsigned int		bits[XBI];

};



   Directly below that, add the following:



#ifdef I3

   #include "i3.h"

#endif



   Locate your pc_data struct, which should be in one of your main *.h files.



   Add the following to the end of it:



#ifdef I3

    I3_CHARDATA *i3chardata;

#endif



4. Open interp.c and locate the following section:



if ( !check_social( ch, command, argument )



   Add the following condition to whatever series of ifchecks exist there:



#ifdef I3

	&&   !I3_command_hook( ch, command, argument )

#endif



5. Open comm.c and locate main():



   A. If your mud uses copyover/hotboot, find this section( it may not look EXACTLY like this, adjust as needed ):

	If your mud does NOT use copyover/hotboot, move to B.



      if( argv[2] && argv[2][0] )

      {

         fCopyOver = TRUE;

         control = atoi( argv[3] );

      }

      else

         fCopyOver = FALSE;



   Change it to read as( while adjusting as needed ):



      if( argv[2] && argv[2][0] )

      {

         fCopyOver = TRUE;

         control = atoi( argv[3] );

#ifdef I3

	   I3_socket = atoi( argv[4] );

#endif

      }

      else

         fCopyOver = FALSE;



   This next part is somewhat tricky. If copyover_recover is called in db.c as is the usual case in

   most default installs, you need to place the following BEFORE the boot_db call. If it is listed

   somewhere here in comm.c, the following needs to be placed ABOVE it. Either way, I3_main needs

   to be called BEFORE copyover_recover or your mud WILL crash every time you do a copyover.



#ifdef I3

   /* Initialize and connect to Intermud-3 */

   I3_main( FALSE, port, fCopyOver );

#endif



   B. If your mud is NOT using copyover/hotboot:



      Locate the following:



    /* I don't know how well this will work on an unnamed machine as I don't

       have one handy, and the man pages are ever-so-helpful.. -- Alty */

    if (gethostname(hostn, sizeof(hostn)) < 0)

    {

      perror("main: gethostname");

      strcpy(hostn, "unresolved");

    }

    sprintf( log_buf, "%s ready at address %s on port %d.",	sysdata.mud_name, hostn, port );

    log_string( log_buf );



   Add the following lines directly below that:



#ifdef I3

   /* Initialize and connect to Intermud-3 */

   I3_main( FALSE, port, FALSE );

#endif



   C. ALL MUDS CONTINUE HERE:



   Then further down in main(), locate the following:



    closesocket( control  );

    closesocket( control2 );

    closesocket( conclient);

    closesocket( conjava  );



   Add the following beneath that:



#ifdef I3

   I3_shutdown( 0 );

#endif



   Then in game_loop(), locate the following:



	/*

	 * Autonomous game motion.

	 */

	update_handler( );



   Directly ABOVE that, add the following:



#ifdef I3

	I3_loop();

#endif



   Then locate function act_string, and find the following code:



      switch ( *str )

      {

      default:  bug( "Act: bad code %c.", *str );

		bug( "Act: Bad code came from %s", ch->name );

		i = " <@@@> ";						break;



   Directly below that, add the following:



#ifdef I3

	case '$': 

	    i = "$";

	    break;

#endif



6. Open save.c and locate fread_char:



   In the case 'I': section, and right before the final break; add the follwing:



#ifdef I3

	   if( ( fMatch = i3load_char( ch, fp, word ) ) )

		break;

#endif



   Then in fwrite_char, locate:



    fprintf( fp, "End\n\n" );



   Directly ABOVE that, add:



#ifdef I3

    i3save_char( ch, fp );

#endif



   Then in load_char_obj(), locate the following:



    found = FALSE;

    sprintf( strsave, "%s%c/%s", PLAYER_DIR, tolower(name[0]), capitalize( name ) );



   Directly ABOVE that, add the following:



#ifdef I3

    i3init_char( ch );

#endif



7. Open db.c



   Locate free_char:



   Below this block of code:



	if ( ch->pcdata->subprompt )

	   STRFREE( ch->pcdata->subprompt );

	if(ch->pcdata->tell_history)

	{

		int i;

		for(i = 0; i< 26; i++)

		{

			if(ch->pcdata->tell_history[i])

				STRFREE(ch->pcdata->tell_history[i]);

		}

		DISPOSE(ch->pcdata->tell_history);

	}

   Add:



#ifdef I3

	free_i3chardata( ch );

#endif



8. For users of copyover only - Target code may not be exact:



   In function do_copyover, locate the following code:



    DESCRIPTOR_DATA *d, *de_next;

    char buf [100], buf2[100], buf3[100], buf4[100], buf5[100];



   Directly below that, add:



    char buf6[100];



   Then further down, find the following:



    /* exec - descriptors are inherited */

    sprintf( buf,  "%d", port );

    sprintf( buf2, "%d", control );

    sprintf( buf3, "%d", control2 );

    sprintf( buf4, "%d", conclient );

    sprintf( buf5, "%d", conjava );

  

    execl( EXE_FILE, "smaug", buf, "hotboot",  buf2, buf3, buf4, buf5, (char *)NULL );



   Change that to read as follows:



#ifdef I3

   if( I3_is_connected() )

   {

	I3_savechanlist();

	I3_savemudlist();

	I3_savehistory();

   }

#endif



    /* exec - descriptors are inherited */

    sprintf( buf,  "%d", port );

    sprintf( buf2, "%d", control );

    sprintf( buf3, "%d", control2 );

    sprintf( buf4, "%d", conclient );

    sprintf( buf5, "%d", conjava );

#ifdef I3

    snprintf( buf6, 100, "%d", I3_socket );

#else

    strncpy( buf6, "-1", 100 );

#endif



    execl( EXE_FILE, "smaug", buf, "hotboot",  buf2, buf3, buf4, buf5, buf6, (char *)NULL );



8b: For users of SWR derivatives:



In your i3cfg.h file, replace the CH_LEVEL line with the following:



#define CH_I3LEVEL(ch)          ((ch)->top_level)



8c: For users of CalareyMUD 2.0 and 3.0:



In your imccgh.h file, REMOVE the CH_IMCLEVEL macro.

In imc.c, find the imc_adjust_perms function.

Replace it with this one:



void I3_adjust_perms( CHAR_DATA *ch )

{

   /* Ugly hack to let the permission system adapt freely, but retains the ability to override that adaptation

    * in the event you need to restrict someone to a lower level, or grant someone a higher level. This of

    * course comes at the cost of forgetting you may have done so and caused the override flag to be set, but hey.

    * This isn't a perfect system and never will be. Samson 2-8-04.

    */

   if( !I3IS_SET( I3FLAG(ch), I3_PERMOVERRIDE ) )

   {

      /* This will default to MORT only - you will need to override this with "none" to

       * keep people you don't want using it off.

       */

      if( ch->pcdata->permissions == 0 )

	   I3PERM(ch) = I3PERM_MORT;

      else if( IS_SET( ch->pcdata->permissions, PERMIT_BUILD ) )

	   I3PERM(ch) = I3PERM_IMM;

      else if( IS_SET( ch->pcdata->permissions, PERMIT_ADMIN ) )

	   I3PERM(ch) = I3PERM_ADMIN;

      else if( IS_SET( ch->pcdata->permissions, PERMIT_SECURITY ) )

	   I3PERM(ch) = I3PERM_IMP;

   }

   return;

}



Return to the main I3Install.txt file and continue.