Installation for tbaMud-3.57 (CircleMUD derivative)
[ document by mtfox ] modified last: 10/23/08
---------------------------------------------------
If you have not done so, read the IMCInstall.txt


1. In the Makefile.in file, find:

#flags for profiling (see hacker.doc for more information)
PROFILE =

Directly below that, add:

#IMC2 - Comment out to disable IMC2 support
IMC = 1

/************* tbaMUD 3.55 and earlier ********************/
find:
weather.c zedit.c zmalloc.c
and after that add:

# [Note: BSD users - put a period in front of the word ifdef, and in front of the word endif]
ifdef IMC
   CXREF_FILES += imc.c sha256.c
   OBJFILES += imc.o sha256.o
   CFLAGS += -DIMC -DIMCCIRCLE
endif

change
clean:
	rm -f *.o

to
clean:
	rm -f *.o imcsrc/*.o depend

/************* tbaMUD 3.56 and newer ********************/
find:
OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
and add the following after:
# [Note: BSD users - put a period in front of the word ifdef, and in front of the word endif]

ifdef IMC
   SRCFILES += imcsrc/imc.c imcsrc/sha256.c
   OBJFILES += imcsrc/imc.o imcsrc/sha256.o
   CFLAGS += -DIMC -DIMCCIRCLE
endif

change
clean:
	rm -f *.o depend

to
clean:
	rm -f *.o imcsrc/*.o depend

/********************************************************/


2. Open act.social.c and at the bottom, add the following:

/* For IMC */
struct social_messg *find_social( const char *name )
{
   int cmd, socidx;

   if( ( cmd = find_command( name ) ) < 0 )
      return NULL;

   if( ( socidx = find_action( cmd ) ) < 0 )
      return NULL;

   return &soc_mess_list[socidx];
}

3. Open comm.c and locate the following:

#ifdef HAVE_ARPA_TELNET_H
#include <arpa/telnet.h>
#else
#include "telnet.h"
#endif


Directly below that, add the following:

#ifdef IMC
#include "structs.h"
#include "imcsrc/imc.h"
#endif

Locate function init_game, and find the following:

  /* set up hash table for find_char() */
  init_lookup_table();

  boot_db();

Directly below that, add the following:

#ifdef IMC
  imc_startup(FALSE, -1, FALSE); // FALSE arg, so the autoconnect setting can govern it.
#endif

Locate the following:

  log("Closing all sockets.");
  while (descriptor_list)
    close_socket(descriptor_list);

  CLOSE_SOCKET(mother_desc);

Directly below that, add the following:

#ifdef IMC
SERVER_DATA *server;
extern SERVER_DATA *first_server;
        for( server = first_server; server; server = server->next )
  imc_shutdown(FALSE, server);
#endif

Locate game_loop and find the following:

    /* If we missed more than 30 seconds worth of pulses, just do 30 secs */
    if (missed_pulses > 30 RL_SEC) {
      log("SYSERR: Missed %d seconds worth of pulses.", missed_pulses / PASSES_PER_SEC);
      missed_pulses = 30 RL_SEC;
    }

Directly below that, add the following:

#ifdef IMC
    imc_loop();
#endif

In game_loop, find:

   /* Sleep if we don't have any connections */
   if (descriptor_list == NULL) {
      log("No connections.  Going to sleep.");
      FD_ZERO(&input_set);
      FD_SET(mother_desc, &input_set);
      if (select(mother_desc + 1, &input_set, (fd_set *) 0, (fd_set *) 0, NULL) < 0) {

Replace with:

    /* Sleep if we don't have any connections */
    if (descriptor_list == NULL) {
#ifdef IMC
SERVER_DATA *server;
extern SERVER_DATA *first_server;
int top_desc = mother_desc, top2 = mother_desc;
        for( server = first_server; server; server = server->next ){
      top_desc = server != NULL ? MAX( top2, server->desc) : mother_desc;
		top2 = top_desc;
		}
#else
      int top_desc = mother_desc;
#endif
      log("No connections.  Going to sleep.");
      FD_ZERO(&input_set);
      FD_SET(mother_desc, &input_set);
#ifdef IMC
        for( server = first_server; server; server = server->next )
     if ( server != NULL && server->desc != -1 )
         FD_SET(server->desc, &input_set);
#endif
      if (select(top_desc + 1, &input_set, (fd_set *) 0, (fd_set *) 0, NULL) < 0) {


You might want to comment out the log messages for waking up and going to sleep.


4. Open db.c and locate the following:

#include "dg_scripts.h"
#include "dg_event.h"

#ifdef IMC
#include "imcsrc/imc.h"
#endif

Locate the following in free_char:

  int i;
  struct alias_data *a;
      
  if (ch->player_specials != NULL && ch->player_specials != &dummy_mob) {

Directly below that, add:

#ifdef IMC
    imc_freechardata(ch);
#endif


6. Open interpreter.c and locate the following:

#include "improved-edit.h"
#include "dg_scripts.h"
#include "constants.h"

Directly below that, add:

#ifdef IMC
#include "imcsrc/imc.h"
#endif



Then locate the following in command_interpreter:

  if (*complete_cmd_info[cmd].command == '\n') {
    int found = 0;
    send_to_char(ch, "Huh!?!\r\n");

Change it to read as follows:

  if (*complete_cmd_info[cmd].command == '\n') {
    int found = 0;

#ifdef IMC
    if( !imc_command_hook(ch, arg, line) ) {
#endif
    send_to_char(ch, "Huh!?!\r\n");

locate the following:

        send_to_char(ch, "  %s\r\n", cmd_info[cmd].command);
      }
    }
  }

Directly below that, add:

#ifdef IMC
  } 
#endif

locate the following: 
	write_to_output(d, "Invalid name, please try another.\r\nName: ");
	return;
      }

Directly below that, add: 
#ifdef IMC
  imc_initchar(d->character); 
#endif

locate the following:
    init_char(d->character);

Directly below that, add: 
#ifdef IMC
  imc_adjust_perms( d->character );
#endif

7. Open players.c and locate the following:

#include "dg_scripts.h"
#include "comm.h"
#include "interpreter.h"

Directly below that, add:

#ifdef IMC
#include "imcsrc/imc.h"
#endif

Locate the following:
    for (i = 0; i < PR_ARRAY_MAX; i++)
      PRF_FLAGS(ch)[i] = PFDEF_PREFFLAGS;

Directly below that, add the following:
#ifdef IMC
  imc_initchar(ch);
  imc_adjust_perms( ch );
#endif

Locate the following:
	else if (!strcmp(tag, "Invs"))	GET_INVIS_LEV(ch)	= atoi(line);

Directly below that, add the following:
#ifdef IMC
	else imc_load_pfile( ch, tag, line );
#endif

Locate the following:
  affect_total(ch);

Directly below that, add the following:
#ifdef IMC
  imc_adjust_perms( ch );
#endif

Locate the following:
  if (GET_SCREEN_WIDTH(ch) != PFDEF_SCREENWIDTH) fprintf(fl, "ScrW: %d\n", GET_SCREEN_WIDTH(ch));

Directly below that, add the following:
#ifdef IMC
  imc_save_pfile( ch, fl );
#endif

8. Open structs.h and locate the following:

   char	*poofin;		/* Description on arrival of a god.     */
   char	*poofout;		/* Description upon a god's exit.       */
   struct alias_data *aliases;	/* Character's aliases			*/
   long last_tell;		/* idnum of last tell from		*/
   void *last_olc_targ;		/* olc control				*/
   int last_olc_mode;		/* olc control				*/
   char *host;			/* player host				*/

Directly below that, add:

#ifdef IMC
   struct imcchar_data *imcchardata;
#endif

9. Open imccfg.h and locate the following:

locate the following:
   /*
    * This should be in an act.social.h, if it existed. Introducing
    * it in an IMC patch would be too intrusive. 
    */
struct social_messg
{
   int act_nr;
   int hide;
   int min_victim_position;
   char *char_no_arg;
   char *others_no_arg;
   char *char_found;
   char *others_found;
   char *vict_found;
   char *not_found;
   char *char_auto;
   char *others_auto;
};

   /*
    * UNCOMMENT if mud has Ascii Pfile code installed. 
    */
   /*
    * #include "diskio.h" 
    */


and delete it.
 

10. create a folder in the src directory named imcsrc then place imc.c, imc.h,
    sha26.c, sha26.h and imccfg.h in that folder.

11. in imc.c
find

#if defined(IMCCIRCLE) || (_TBAMUD)
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "db.h"
#include "handler.h"
#include "interpreter.h"
#include "imc.h"
#endif

change to

#if defined(IMCCIRCLE) || (_TBAMUD)
#include "../conf.h"
#include "../sysdep.h"
#include "../structs.h"
#include "../utils.h"
#include "../comm.h"
#include "../db.h"
#include "../handler.h"
#include "../interpreter.h"
#include "imc.h"
#endif

12. in imc.h
change
#define IMC_DIR          "imc/"
to
#define IMC_DIR          "../imc/"

13. Run your configure script according to the directions that came with tbaMUD.
    This will copy the information you put into Makefile.in into your Makefile.

Return to the IMCInstall.txt file and continue where you left off.

14. Once you have your mud running, you will need to change the channel seperator 
    with imcconfig channsep :