/**************************************************************************
* 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-2002 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 VERSION "ILAB Online Creation [Beta 1.0, ROM 2.3 modified]\n\r" \
" Port a ROM 2.4 v1.8\n\r"
#define 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 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 CREDITS " Original by Surreality(cxw197@psu.edu) and Locke(locke@lm.com)"
/*
* New typedefs.
*/
typedef bool OLC_FUN args ((CHAR_DATA * ch, const char *argument));
#define DECLARE_OLC_FUN( fun ) OLC_FUN fun
/*
* Connected states for editor.
*/
#define ED_NONE 0
#define ED_AREA 1
#define ED_ROOM 2
#define ED_OBJECT 3
#define ED_MOBILE 4
#define ED_MPCODE 5
#define ED_HELP 6
#define ED_SOCIAL 7
#define ED_CLAN 8
#define ED_CMD 9
#define ED_SKILL 10
#define ED_GROUP 11
#define ED_RACE 12
#define ED_CLASS 13
/*
* Interpreter Prototypes
*/
void aedit args ((CHAR_DATA * ch, char *argument));
void redit args ((CHAR_DATA * ch, char *argument));
void medit args ((CHAR_DATA * ch, char *argument));
void oedit args ((CHAR_DATA * ch, char *argument));
void mpedit args ((CHAR_DATA * ch, char *argument));
void hedit args ((CHAR_DATA *, char *));
void cedit args ((CHAR_DATA * ch, char *argument));
void cmdedit args ((CHAR_DATA * ch, char *argument));
void skedit args ((CHAR_DATA * ch, char *argument));
void gredit args ((CHAR_DATA * ch, char *argument));
void raedit args ((CHAR_DATA * ch, char *argument));
void cledit args ((CHAR_DATA * ch, char *argument));
/*
* 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;
};
/*
* Structure for an OLC editor startup command.
*/
struct editor_cmd_type
{
char *const name;
DO_FUN *do_fun;
};
/*
* Utils.
*/
AREA_DATA *get_vnum_area args ((vnum_t vnum));
AREA_DATA *get_area_data args ((int vnum));
void add_reset
args ((ROOM_INDEX_DATA * room, RESET_DATA * pReset, int pindex));
void display_resets (CHAR_DATA * ch);
void show_olc_cmds (CHAR_DATA * ch);
bool oedit_values (CHAR_DATA * ch, const char *argument, int value);
bool set_value (CHAR_DATA * ch, OBJ_INDEX_DATA * pObj, const char *argument,
int value);
bool set_obj_values (CHAR_DATA * ch, OBJ_INDEX_DATA * pObj, int value_num,
const char *argument);
void show_obj_values (CHAR_DATA * ch, OBJ_INDEX_DATA * obj);
bool change_exit (CHAR_DATA * ch, const char *argument, int door);
bool check_range (long lower, long upper);
void show_spec_cmds (CHAR_DATA * ch);
void show_skill_cmds (CHAR_DATA * ch, int tar);
flag_t wear_bit (int loc);
int wear_loc (flag_t bits, int count);
void save_area (AREA_DATA * pArea);
void save_other_helps (CHAR_DATA * ch);
void save_helps (FILE * fp, HELP_AREA * ha);
void save_shops (FILE * fp, AREA_DATA * pArea);
void save_resets (FILE * fp, AREA_DATA * pArea);
void save_door_resets (FILE * fp, AREA_DATA * pArea);
void save_specials (FILE * fp, AREA_DATA * pArea);
void save_rooms (FILE * fp, AREA_DATA * pArea);
void save_objects (FILE * fp, AREA_DATA * pArea);
void save_object (FILE * fp, OBJ_INDEX_DATA * pObjIndex);
void save_mobiles (FILE * fp, AREA_DATA * pArea);
void save_mobile (FILE * fp, MOB_INDEX_DATA * pMobIndex);
void save_mobprogs (FILE * fp, AREA_DATA * pArea);
void save_area_list (void);
char *fix_string (const char *str);
void stop_editing (void *OLC);
int calc_avedam (int num_dice, int dam_dice);
void edit_start args ((CHAR_DATA * ch, void *OLC, int Ed));
/*
* 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 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[];
/*
* General Functions
*/
bool show_commands args ((CHAR_DATA * ch, char *argument));
bool show_help args ((CHAR_DATA * ch, const char *argument));
bool edit_done args ((CHAR_DATA * ch));
bool show_version args ((CHAR_DATA * ch, char *argument));
bool process_olc_command args ((CHAR_DATA * ch, const char *argument,
const struct olc_comm_type * table));
DECLARE_ED_FUN (olced_str);
DECLARE_ED_FUN (olced_str_line);
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_VALIDATE_FUN (validate_align);
DECLARE_VALIDATE_FUN (validate_level);
DECLARE_VALIDATE_FUN (validate_groupname);
DECLARE_VALIDATE_FUN (validate_whoname);
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);
/*
* 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);
/*
* 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_addmprog); /* ROM */
DECLARE_OLC_FUN (medit_delmprog); /* ROM */
/* Mobprog editor */
DECLARE_OLC_FUN (mpedit_create);
DECLARE_OLC_FUN (mpedit_show);
DECLARE_OLC_FUN (mpedit_list);
DECLARE_OLC_FUN (mpedit_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 (cmdedit_show);
DECLARE_OLC_FUN (cmdedit_create);
DECLARE_OLC_FUN (cmdedit_delete);
DECLARE_OLC_FUN (cmdedit_dofun);
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_pcrace);
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 (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);
/*
* 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 = (MPROG_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 )
/*
* Prototypes
*/
/* mem.c - memory prototypes. */
#define ED EXTRA_DESCR_DATA
RESET_DATA *new_reset_data args ((void));
void free_reset_data args ((RESET_DATA * pReset));
AREA_DATA *new_area args ((void));
void free_area args ((AREA_DATA * pArea));
EXIT_DATA *new_exit args ((void));
void free_exit args ((EXIT_DATA * pExit));
ROOM_INDEX_DATA *new_room_index args ((void));
void free_room_index args ((ROOM_INDEX_DATA * pRoom));
SHOP_DATA *new_shop args ((void));
void free_shop args ((SHOP_DATA * pShop));
OBJ_INDEX_DATA *new_obj_index args ((void));
void free_obj_index args ((OBJ_INDEX_DATA * pObj));
MOB_INDEX_DATA *new_mob_index args ((void));
void free_mob_index args ((MOB_INDEX_DATA * pMob));
#undef ED
void show_liqlist args ((CHAR_DATA * ch));
void show_damlist args ((CHAR_DATA * ch));
char *mprog_type_to_name args ((int type));
MPROG_LIST *new_mprog args ((void));
void free_mprog args ((MPROG_LIST * mp));
MPROG_CODE *new_mpcode args ((void));
void free_mpcode args ((MPROG_CODE * pMcode));
void sedit args ((CHAR_DATA * ch, char *argument));
SOCIAL_DATA *get_social_data args ((const char *name));
#endif