1stMUD4.0/bin/
1stMUD4.0/doc/MPDocs/
1stMUD4.0/player/
1stMUD4.0/win32/
1stMUD4.0/win32/rom/
/**************************************************************************
*  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
*  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
*                                                                         *
*  Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael         *
*  Chastain, Michael Quan, and Mitchell Tse.                              *
*                                                                         *
*  In order to use any part of this Merc Diku Mud, you must comply with   *
*  both the original Diku license in 'license.doc' as well the Merc       *
*  license in 'license.txt'.  In particular, you may not remove either of *
*  these copyright notices.                                               *
*                                                                         *
*  Much time and thought has gone into this software and you are          *
*  benefiting.  We hope that you share your changes too.  What goes       *
*  around, comes around.                                                  *
***************************************************************************
*       ROM 2.4 is copyright 1993-1998 Russ Taylor                        *
*       ROM has been brought to you by the ROM consortium                 *
*           Russ Taylor (rtaylor@hypercube.org)                           *
*           Gabrielle Taylor (gtaylor@hypercube.org)                      *
*           Brian Moore (zump@rom.org)                                    *
*       By using this code, you have agreed to follow the terms of the    *
*       ROM license, in the file Rom24/doc/rom.license                    *
***************************************************************************
*       1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings              *
*            http://1stmud.dlmud.com/  <r-jenn@shaw.ca>                   *
***************************************************************************/
/***************************************************************************
 *  File: olc.h                                                            *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 *                                                                         *
 *  This code was freely distributed with the The Isles 1.1 source code,   *
 *  and has been used here for OLC - OLC would not be what it is without   *
 *  all the previous coders who released their source code.                *
 *                                                                         *
 ***************************************************************************/
/*
 * This is a header file for all the OLC files.  Feel free to copy it into
 * merc.h if you wish.  Many of these routines may be handy elsewhere in
 * the code.  -Jason Dinkel
 */

#if !defined(OLC_H)
#define OLC_H

/*
 * The version info.  Please use this info when reporting bugs.
 * It is displayed in the game by typing 'version' while editing.
 * Do not remove these from the code - by request of Jason Dinkel
 */
#define OLC_VERSION	"ILAB Online Creation [Beta 1.0, ROM 2.3 modified]\n\r" \
		"     Port a ROM 2.4 v1.8\n\r"
#define OLC_AUTHOR	"     By Jason(jdinkel@mines.colorado.edu)\n\r" \
                "     Modified for use with ROM 2.3\n\r"        \
                "     By Hans Birkeland (hansbi@ifi.uio.no)\n\r" \
                "     Modificado para uso en ROM 2.4b6\n\r"	\
                "     Por Ivan Toledo (itoledo@ctcreuna.cl)\n\r"
#define OLC_DATE	"     (Apr. 7, 1995 - ROM mod, Apr 16, 1995)\n\r" \
		"     (Port a ROM 2.4 - Nov 2, 1996)\n\r" \
		"     Version actual : 1.8 - Sep 8, 1998\n\r"
#define OLC_CREDITS "     Original by Surreality(cxw197@psu.edu) and Locke(locke@lm.com)"

/*
 * New typedefs.
 */
typedef bool OLC_FUN(CHAR_DATA * ch, const char *argument);
typedef const struct olc_ed_type OLCED_DATA;
#define DECLARE_OLC_FUN( fun )	OLC_FUN    fun
#define OLCED(fun)	bool fun(CHAR_DATA *ch, const char *argument)

/*
 * Connected states for editor.
 */
#define ED_NONE		-1
#define ED_AREA		0
#define ED_ROOM		1
#define ED_OBJECT	2
#define ED_MOBILE	3
#define ED_MPCODE	4
#define ED_OPCODE       5
#define ED_RPCODE       6
#define ED_HELP		7
#define ED_SOCIAL   8
#define ED_CLAN     9
#define ED_CMD      10
#define ED_SKILL    11
#define ED_GROUP    12
#define ED_RACE     13
#define ED_CLASS    14
#define ED_DEITY    15
#define ED_CHAN		16
#define ED_MUD      17
#define ED_SONG     18
#define ED_MAX		19

/*
 * OLC Constants
 */
#define MAX_MOB	1				/* Default maximum number for resetting mobs */

/*
 * Structure for an OLC editor command.
 */
struct olc_comm_type
{
	const char *name;
	void *argument;
	ED_FUN *function;
	const void *parameter;
	VALIDATE_FUN *validate;
};

struct olc_ed_type
{
	const char *name;
	const char *longname;
	int ed;
	OLC_FUN *show;
	DO_FUN *do_fun;
	const struct olc_comm_type *table;
};
EXTERN const struct olc_ed_type olc_ed_table[ED_MAX];

/*
 * Utils.
 */
PROTOTYPE(AREA_DATA * get_vnum_area, (vnum_t));
PROTOTYPE(AREA_DATA * get_area_data, (int));
PROTOTYPE(CHANNEL_DATA * get_chan_data, (int));
PROTOTYPE(void add_reset, (ROOM_INDEX_DATA *, RESET_DATA *, int));
PROTOTYPE(void display_resets, (CHAR_DATA *));

PROTOTYPE(void show_olc_cmds, (CHAR_DATA *));
PROTOTYPE(bool oedit_values, (CHAR_DATA *, const char *, int));
PROTOTYPE(bool set_value, (CHAR_DATA *, OBJ_INDEX_DATA *, const char *, int));
PROTOTYPE(bool set_obj_values, (CHAR_DATA *, OBJ_INDEX_DATA *, int,
								const char *));
PROTOTYPE(void show_obj_values, (CHAR_DATA *, OBJ_INDEX_DATA *));
PROTOTYPE(bool change_exit, (CHAR_DATA *, const char *, int));
PROTOTYPE(bool check_range, (long, long));
PROTOTYPE(void show_spec_cmds, (CHAR_DATA *));
PROTOTYPE(void show_skill_cmds, (CHAR_DATA *, int));
PROTOTYPE(flag_t wear_bit, (wloc_t));
PROTOTYPE(wloc_t wear_loc, (flag_t, int));
PROTOTYPE(void save_area, (AREA_DATA *));
PROTOTYPE(void save_helps, (void));
PROTOTYPE(void save_shops, (FILE *, AREA_DATA *));
PROTOTYPE(void save_resets, (FILE *, AREA_DATA *));
PROTOTYPE(void save_door_resets, (FILE *, AREA_DATA *));
PROTOTYPE(void save_specials, (FILE *, AREA_DATA *));
PROTOTYPE(void save_rooms, (FILE *, AREA_DATA *));
PROTOTYPE(void save_objects, (FILE *, AREA_DATA *));
PROTOTYPE(void save_object, (FILE *, OBJ_INDEX_DATA *));
PROTOTYPE(void save_mobiles, (FILE *, AREA_DATA *));
PROTOTYPE(void save_mobile, (FILE *, MOB_INDEX_DATA *));
PROTOTYPE(void save_mobprogs, (FILE *, AREA_DATA *));
PROTOTYPE(void save_area_list, (void));
PROTOTYPE(void stop_editing, (void *));
PROTOTYPE(int calc_avedam, (int, int));
PROTOTYPE(void edit_start, (CHAR_DATA *, void *, int));

/*
 * Interpreter Table Prototypes
 */
EXTERN const struct olc_comm_type mob_olc_comm_table[];
EXTERN const struct olc_comm_type obj_olc_comm_table[];
EXTERN const struct olc_comm_type room_olc_comm_table[];
EXTERN const struct olc_comm_type area_olc_comm_table[];
EXTERN const struct olc_comm_type mprog_olc_comm_table[];
EXTERN const struct olc_comm_type oprog_olc_comm_table[];
EXTERN const struct olc_comm_type rprog_olc_comm_table[];
EXTERN const struct olc_comm_type help_olc_comm_table[];
EXTERN const struct olc_comm_type social_olc_comm_table[];
EXTERN const struct olc_comm_type clan_olc_comm_table[];
EXTERN const struct olc_comm_type cmd_olc_comm_table[];
EXTERN const struct olc_comm_type skill_olc_comm_table[];
EXTERN const struct olc_comm_type group_olc_comm_table[];
EXTERN const struct olc_comm_type race_olc_comm_table[];
EXTERN const struct olc_comm_type class_olc_comm_table[];
EXTERN const struct olc_comm_type deity_olc_comm_table[];
EXTERN const struct olc_comm_type chan_olc_comm_table[];
EXTERN const struct olc_comm_type mud_olc_comm_table[];
EXTERN const struct olc_comm_type song_olc_comm_table[];

/*
 * General Functions
 */
PROTOTYPE(bool show_commands, (CHAR_DATA *, char *));
PROTOTYPE(bool show_help, (CHAR_DATA *, const char *));
PROTOTYPE(bool edit_done, (CHAR_DATA *));
PROTOTYPE(bool show_version, (CHAR_DATA *, char *));

PROTOTYPE(bool process_olc_command, (CHAR_DATA *, const char *,
									 const struct olc_comm_type *));

DECLARE_ED_FUN(olced_str);
DECLARE_ED_FUN(olced_desc);
DECLARE_ED_FUN(olced_bool);
DECLARE_ED_FUN(olced_flag);
DECLARE_ED_FUN(olced_number);
DECLARE_ED_FUN(olced_number_long);
DECLARE_ED_FUN(olced_shop);
DECLARE_ED_FUN(olced_spec);
DECLARE_ED_FUN(olced_ac);
DECLARE_ED_FUN(olced_dice);
DECLARE_ED_FUN(olced_race);
DECLARE_ED_FUN(olced_olded);
DECLARE_ED_FUN(olced_ed);
DECLARE_ED_FUN(olced_direction);
DECLARE_ED_FUN(olced_docomm);
DECLARE_ED_FUN(olced_value);
DECLARE_ED_FUN(olced_poslookup);
DECLARE_ED_FUN(olced_neglookup);
DECLARE_ED_FUN(olced_vnum);
DECLARE_ED_FUN(olced_addprog);
DECLARE_ED_FUN(olced_delprog);
DECLARE_ED_FUN(olced_array);
DECLARE_ED_FUN(olced_larray);
DECLARE_ED_FUN(olced_sarray);
DECLARE_ED_FUN(olced_farray);
DECLARE_ED_FUN(olced_mclass);
DECLARE_ED_FUN(olced_stance);
DECLARE_ED_FUN(olced_stats);
DECLARE_ED_FUN(olced_deity);
DECLARE_ED_FUN(olced_getchar);
DECLARE_ED_FUN(olced_time);
DECLARE_ED_FUN(olced_vnum);

DECLARE_VALIDATE_FUN(validate_align);
DECLARE_VALIDATE_FUN(validate_level);
DECLARE_VALIDATE_FUN(validate_groupname);

DECLARE_VALIDATE_FUN(validate_weapon);
DECLARE_VALIDATE_FUN(validate_adept);
DECLARE_VALIDATE_FUN(validate_hmv);
DECLARE_VALIDATE_FUN(validate_group);
DECLARE_VALIDATE_FUN(validate_classname);

/*
 * Area Editor Prototypes
 */
DECLARE_OLC_FUN(aedit_show);
DECLARE_OLC_FUN(aedit_create);
DECLARE_OLC_FUN(aedit_file);
DECLARE_OLC_FUN(aedit_reset);
DECLARE_OLC_FUN(aedit_builder);
DECLARE_OLC_FUN(aedit_vnum);
DECLARE_OLC_FUN(aedit_lvnum);
DECLARE_OLC_FUN(aedit_uvnum);
DECLARE_OLC_FUN(aedit_climate);

/*
 * Room Editor Prototypes
 */
DECLARE_OLC_FUN(redit_show);
DECLARE_OLC_FUN(redit_create);
DECLARE_OLC_FUN(redit_mreset);
DECLARE_OLC_FUN(redit_oreset);
DECLARE_OLC_FUN(redit_mlist);
DECLARE_OLC_FUN(redit_rlist);
DECLARE_OLC_FUN(redit_olist);
DECLARE_OLC_FUN(redit_mshow);
DECLARE_OLC_FUN(redit_oshow);
DECLARE_OLC_FUN(redit_clan);
DECLARE_OLC_FUN(redit_delete);
DECLARE_OLC_FUN(redit_format);

/*
 * Object Editor Prototypes
 */
DECLARE_OLC_FUN(oedit_show);
DECLARE_OLC_FUN(oedit_create);
DECLARE_OLC_FUN(oedit_addaffect);
DECLARE_OLC_FUN(oedit_addapply);
DECLARE_OLC_FUN(oedit_delaffect);
DECLARE_OLC_FUN(oedit_delete);
DECLARE_OLC_FUN(oedit_autoweapon);
DECLARE_OLC_FUN(oedit_autoarmor);

/*
 * Mobile Editor Prototypes
 */
DECLARE_OLC_FUN(medit_show);
DECLARE_OLC_FUN(medit_create);
DECLARE_OLC_FUN(medit_delete);
DECLARE_OLC_FUN(medit_group);	/* ROM */
DECLARE_OLC_FUN(medit_autoset);
DECLARE_OLC_FUN(medit_autoeasy);
DECLARE_OLC_FUN(medit_autohard);

/* Mobprog editor */
DECLARE_OLC_FUN(mpedit_create);
DECLARE_OLC_FUN(mpedit_show);
DECLARE_OLC_FUN(mpedit_list);
DECLARE_OLC_FUN(mpedit_delete);

DECLARE_OLC_FUN(opedit_create);
DECLARE_OLC_FUN(opedit_show);
DECLARE_OLC_FUN(opedit_list);
DECLARE_OLC_FUN(opedit_delete);

DECLARE_OLC_FUN(rpedit_create);
DECLARE_OLC_FUN(rpedit_show);
DECLARE_OLC_FUN(rpedit_list);
DECLARE_OLC_FUN(rpedit_delete);

/* Editor de helps */
DECLARE_OLC_FUN(hedit_new);
DECLARE_OLC_FUN(hedit_delete);
DECLARE_OLC_FUN(hedit_show);
DECLARE_OLC_FUN(hedit_list);

DECLARE_OLC_FUN(sedit_show);
DECLARE_OLC_FUN(sedit_name);
DECLARE_OLC_FUN(sedit_create);
DECLARE_OLC_FUN(sedit_delete);

DECLARE_OLC_FUN(cedit_show);
DECLARE_OLC_FUN(cedit_create);
DECLARE_OLC_FUN(cedit_delete);
DECLARE_OLC_FUN(cedit_rank);

DECLARE_OLC_FUN(cmdedit_show);
DECLARE_OLC_FUN(cmdedit_create);
DECLARE_OLC_FUN(cmdedit_delete);
DECLARE_OLC_FUN(cmdedit_dofun);
DECLARE_OLC_FUN(cmdedit_rearrange);
DECLARE_OLC_FUN(cmdedit_name);

DECLARE_OLC_FUN(gredit_show);
DECLARE_OLC_FUN(gredit_create);
DECLARE_OLC_FUN(gredit_ratings);
DECLARE_OLC_FUN(gredit_spells);
DECLARE_OLC_FUN(gredit_delete);

DECLARE_OLC_FUN(skedit_show);
DECLARE_OLC_FUN(skedit_create);
DECLARE_OLC_FUN(skedit_levels);
DECLARE_OLC_FUN(skedit_ratings);
DECLARE_OLC_FUN(skedit_spellfun);
DECLARE_OLC_FUN(skedit_gsn);
DECLARE_OLC_FUN(skedit_delete);

DECLARE_OLC_FUN(raedit_create);
DECLARE_OLC_FUN(raedit_delete);
DECLARE_OLC_FUN(raedit_show);
DECLARE_OLC_FUN(raedit_list);
DECLARE_OLC_FUN(raedit_stats);
DECLARE_OLC_FUN(raedit_mstats);
DECLARE_OLC_FUN(raedit_skills);
DECLARE_OLC_FUN(raedit_classx);
DECLARE_OLC_FUN(raedit_name);

DECLARE_OLC_FUN(cledit_create);
DECLARE_OLC_FUN(cledit_delete);
DECLARE_OLC_FUN(cledit_show);
DECLARE_OLC_FUN(cledit_prime);
DECLARE_OLC_FUN(cledit_weapon);
DECLARE_OLC_FUN(cledit_skill);
DECLARE_OLC_FUN(cledit_guilds);

DECLARE_OLC_FUN(dedit_show);
DECLARE_OLC_FUN(dedit_list);
DECLARE_OLC_FUN(dedit_delete);
DECLARE_OLC_FUN(dedit_create);

DECLARE_OLC_FUN(chanedit_show);
DECLARE_OLC_FUN(chanedit_create);
DECLARE_OLC_FUN(chanedit_gcn);
DECLARE_OLC_FUN(chanedit_delete);
DECLARE_OLC_FUN(chanedit_colour);
DECLARE_OLC_FUN(chanedit_list);

DECLARE_OLC_FUN(mudedit_show);

DECLARE_OLC_FUN(songedit_show);
DECLARE_OLC_FUN(songedit_lyrics);
DECLARE_OLC_FUN(songedit_create);
DECLARE_OLC_FUN(songedit_delete);

/*
 * Macros
 */
#define TOGGLE_BIT(var, bit)    ((var) ^= (bit))

/* Return pointers to what is being edited. */
#define EDIT_MOB(Ch, Mob)	( Mob = (MOB_INDEX_DATA *)Ch->desc->pEdit )
#define EDIT_OBJ(Ch, Obj)	( Obj = (OBJ_INDEX_DATA *)Ch->desc->pEdit )
#define EDIT_ROOM(Ch, Room)	( Room = Ch->in_room )
#define EDIT_AREA(Ch, Area)	( Area = (AREA_DATA *)Ch->desc->pEdit )
#define EDIT_MPCODE(Ch, Code)   ( Code = (PROG_CODE*)Ch->desc->pEdit )
#define EDIT_OPCODE(Ch, Code)   ( Code = (PROG_CODE*)Ch->desc->pEdit )
#define EDIT_RPCODE(Ch, Code)   ( Code = (PROG_CODE*)Ch->desc->pEdit )
#define EDIT_SOCIAL(ch, iSoc)	(iSoc = (SOCIAL_DATA *)ch->desc->pEdit)
#define EDIT_HELP(ch, help)	( help = (HELP_DATA *) ch->desc->pEdit )
#define EDIT_CLAN(ch, clan) ( clan = (CLAN_DATA *) ch->desc->pEdit )
#define EDIT_CMD(ch, cmd)   ( cmd = (CMD_DATA *) ch->desc->pEdit )
#define EDIT_SKILL(ch, skill) ( skill = (SKILL_DATA *) ch->desc->pEdit )
#define EDIT_GROUP(ch, grp) ( grp = (GROUP_DATA *) ch->desc->pEdit )
#define EDIT_RACE(ch, race) ( race = (RACE_DATA *) ch->desc->pEdit )
#define EDIT_CLASS(ch, class) ( class = (CLASS_DATA *) ch->desc->pEdit )
#define EDIT_DEITY(ch, deity)   (deity = (DEITY_DATA *)ch->desc->pEdit)
#define EDIT_CHAN(ch, chan)		(chan = (CHANNEL_DATA *)ch->desc->pEdit)
#define EDIT_MUD(ch, mud)       (mud = (MUD *)ch->desc->pEdit)
#define EDIT_SONG(ch, song)     (song = (SONG_DATA *)ch->desc->pEdit)

/*
 * Prototypes
 */
/* mem.c - memory prototypes. */
#define ED	EXTRA_DESCR_DATA
PROTOTYPE(RESET_DATA * new_reset_data, (void));
PROTOTYPE(void free_reset_data, (RESET_DATA *));
PROTOTYPE(AREA_DATA * new_area, (void));
PROTOTYPE(void free_area, (AREA_DATA *));
PROTOTYPE(EXIT_DATA * new_exit, (void));
PROTOTYPE(void free_exit, (EXIT_DATA *));
PROTOTYPE(ROOM_INDEX_DATA * new_room_index, (void));
PROTOTYPE(void free_room_index, (ROOM_INDEX_DATA *));
PROTOTYPE(SHOP_DATA * new_shop, (void));
PROTOTYPE(void free_shop, (SHOP_DATA *));
PROTOTYPE(OBJ_INDEX_DATA * new_obj_index, (void));
PROTOTYPE(void free_obj_index, (OBJ_INDEX_DATA *));
PROTOTYPE(MOB_INDEX_DATA * new_mob_index, (void));
PROTOTYPE(void free_mob_index, (MOB_INDEX_DATA *));
#undef	ED

PROTOTYPE(void show_liqlist, (CHAR_DATA *));
PROTOTYPE(void show_damlist, (CHAR_DATA *));

PROTOTYPE(PROG_LIST * new_prog, (void));
PROTOTYPE(void free_prog, (PROG_LIST *));
PROTOTYPE(PROG_CODE * new_pcode, (void));
PROTOTYPE(void free_pcode, (PROG_CODE *));

PROTOTYPE(void autoset, (MOB_INDEX_DATA *));
PROTOTYPE(void autohard, (MOB_INDEX_DATA *));
PROTOTYPE(void autoeasy, (MOB_INDEX_DATA *));
PROTOTYPE(void autoarmor, (OBJ_INDEX_DATA *));
PROTOTYPE(void autoweapon, (OBJ_INDEX_DATA *));

#endif