

 ==========================================================
 === Instructions for implementing Erwin S. Andreasen's ===
 ===  online social edit snippet for ROM 2.4b4.         ===
 ==========================================================

This file is based upon version 5 of Erwin's online social editor for Merc
and Envy, updated December 1996.

VERY IMPORTANT NOTE: Blame goes to the translator (Brian Castle a.k.a.
Rimbol), not the author (Erwin) for problems.  Feel free to send comments /
fixes related to the ROM translation to bcastle@prevuenet.com.

ANOTHER NOTE:  There are two separate steps to implementing this snippet,
and the mud must be compiled and run between the two.  Do not just go thru
and add all the changes blindly.

Thanks to Erwin for an extremely cool and fun snippet!  Make sure to follow
his license agreement and let him know you are using this code.

Rimbol, 07/31/97

-------------------STEP 1--------------------------

SOCIAL.ARE
----------
== Make a backup copy of this file.  (i.e. copy it to "social.bak" or something)

MAKEFILE
--------
== Add social-edit.o to O_FILES.

SOCIAL-EDIT.C
-------------
== Copy this file to your src directory.
There are a few tiny changes from Erwin's version, as follows:
* I've moved maxSocial to db.h so it is available in do_memory().  Definition of this variable was removed from social-edit.c, and #include "db.h" was added.
* Because I thought retaining the social file as "social.are" under the new format was inappropriate, I rename it to "social.txt" after Step 1.  The #ifdef for the #defines of SOCIAL_FILE are new, to support this.  If you don't like that, it's easy enough to keep the file as "social.are" and just remove it from area.lst so the bootup doesn't choke.
* ROM defines (and depends upon) the "name" element of social_type to be a char[20] array instead of a char pointer.  I've changed all the assignments to "name" to be strcpy() calls, which was less intrusive than changing the rest of ROM to work with a string.

COMM.C
------
== Include stdarg.h.
#include <stdarg.h>

== Add printf_to_char().
/* source: EOD, by John Booth <???> */
void printf_to_char (CHAR_DATA *ch, char *fmt, ...)
{
	char buf [MAX_STRING_LENGTH];
	va_list args;
	va_start (args, fmt);
	vsprintf (buf, fmt, args);
	va_end (args);
	
	send_to_char (buf, ch);
}

MERC.H
------
== Add load/save socials function declarations in a new section for social-edit.c.
/* social-edit.c */
void load_social_table();
void save_social_table();

== Add function declaration for printf_to_char() in comm.c section.
void    printf_to_char args( ( CHAR_DATA *ch, char *fmt, ...) );


DB.C
----
== Add call to save_social_table() at end of boot_db().
    save_social_table();

    return;
}

END of Step 1.  Compile and run the mud, then shut back down.  The new code should have re-built SOCIAL.ARE in a new format.

-------------------STEP 2--------------------------

MERC.H
------
== Remove #define of MAX_SOCIALS.
/*#define MAX_SOCIALS             256*/


== Replace definition of social_type structure...
/*extern          struct social_type      social_table	[MAX_SOCIALS];*/

with this:

extern          struct social_type *social_table;


SOCIAL-EDIT.C
-------------
== Remove the #define of CONST_SOCIAL.  Note that a change to the definition of SOCIAL_FILE will occur as a result, using social.txt instead of social.are.  The new social file format is not an "area".  (Not that it ever really was.)
/*#define CONST_SOCIAL*/ /* remove this in Step 2 */

AREA.LST
--------
== Remove the reference to "social.are".

SOCIAL.ARE
----------
== Rename this file to "social.txt".

DB.H
----
== Remove declaration of social_count.
/*extern int	social_count;*/

== Add declaration of maxSocial.
/* Values from Social-edit.c */
int				maxSocial; /* Max number of socials */


DB.C
----
== Remove the declaration of load_socials() at the top of the file.
/*void 	load_socials	args( ( FILE *fp ) );*/

== Add a call to load_social_table() near the end of boot_db().
	load_notes( );
	load_social_table();

== Remove the call to load_socials() in boot_db().
		/*else if ( !str_cmp( word, "SOCIALS"  ) ) load_socials (fpArea);*/


== Remove the call to save_social_table() at the end of boot_db() that we added in step 1.

== Modify do_memory() to report socials using maxSocial instead of social_count.
    sprintf( buf, "Socials %5d\n\r", maxSocial  ); send_to_char( buf, ch );


DB2.C
-----
== Remove variables social_table and social_count.
/*
struct	social_type	social_table		[MAX_SOCIALS];
int		social_count;
*/

== Remove function load_socials().


INTERP.H
--------
== Declare function do_sedit().
DECLARE_DO_FUN(	do_sedit	);

INTERP.C
--------
== Add command "sedit" in the Immortal commands section.  This sets it for Deity and up, change it if you like.
    { "sedit",		do_sedit,	POS_DEAD,	L3,  LOG_ALWAYS, 1 },

HELP.ARE
--------
== Add Erwin's helpfile for sedit.


That's it!  Enjoy, and don't forget to thank Erwin!  --Rimbol


