KAIZEN formatting and linting, header files

This commit is contained in:
welcor 2024-09-17 01:04:36 +02:00
parent e59420363a
commit e6085172d5
45 changed files with 5153 additions and 5238 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,18 +1,18 @@
/**
* @file boards.h
* Header file for the bulletin board system (boards.c).
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*
* @todo Utility functions that could easily be moved elsewhere have been
* marked. Suggest a review of all utility functions (aka. non ACMDs) and
* determine if the utility functions should be placed into a lower level
* shared module.
* shared module.
*
*/
#ifndef _BAN_H_
@ -26,11 +26,11 @@
#define BANNED_SITE_LENGTH 50
struct ban_list_element {
char site[BANNED_SITE_LENGTH+1];
int type;
time_t date;
char name[MAX_NAME_LENGTH+1];
struct ban_list_element *next;
char site[BANNED_SITE_LENGTH+1];
int type;
time_t date;
char name[MAX_NAME_LENGTH+1];
struct ban_list_element *next;
};
/* Global functions */

View file

@ -1,41 +1,41 @@
/**
* @file boards.h
* Header file for the bulletin board system (boards.c).
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _BOARDS_H_
#define _BOARDS_H_
#define NUM_OF_BOARDS 7 /* change if needed! */
#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */
#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */
#define NUM_OF_BOARDS 7 /* change if needed! */
#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */
#define MAX_MESSAGE_LENGTH 4096 /* arbitrary -- change if needed */
#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5)
#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5)
#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */
#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */
struct board_msginfo {
int slot_num; /* pos of message in "master index" */
char *heading; /* pointer to message's heading */
int level; /* level of poster */
int heading_len; /* size of header (for file write) */
int message_len; /* size of message text (for file write) */
int slot_num; /* pos of message in "master index" */
char *heading; /* pointer to message's heading */
int level; /* level of poster */
int heading_len; /* size of header (for file write) */
int message_len; /* size of message text (for file write) */
};
struct board_info_type {
obj_vnum vnum; /* vnum of this board */
int read_lvl; /* min level to read messages on this board */
int write_lvl; /* min level to write messages on this board */
int remove_lvl; /* min level to remove messages from this board */
char filename[50]; /* file to save this board to */
obj_rnum rnum; /* rnum of this board */
obj_vnum vnum; /* vnum of this board */
int read_lvl; /* min level to read messages on this board */
int write_lvl; /* min level to write messages on this board */
int remove_lvl; /* min level to remove messages from this board */
char filename[50]; /* file to save this board to */
obj_rnum rnum; /* rnum of this board */
};
#define BOARD_VNUM(i) (board_info[i].vnum)

View file

@ -1,9 +1,9 @@
/**
* @file bsd-snprintf.h
* Used if your OS does not provide snprintf() or vsnprintf().
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
* of, and continuation of, CircleMUD.
*/
/* This file taken from openbsd-compat of OpenSSH 3.1:

View file

@ -1,13 +1,13 @@
/**
* @file class.h
* Header file for class specific functions and variables.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _CLASS_H_

View file

@ -13,24 +13,18 @@
#ifndef _COMM_H_
#define _COMM_H_
#define NUM_RESERVED_DESCS 8
#define NUM_RESERVED_DESCS 8
#define COPYOVER_FILE "copyover.dat"
/* comm.c */
void close_socket(struct descriptor_data *d);
void game_info(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__
((format (printf, 2, 3)));
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1,
2)));
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format
(printf, 2, 3)));
void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1,
2)));
void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...) __attribute__ ((format
(printf, 3, 4)));
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
__attribute__ ((format (printf, 3, 4)));
size_t send_to_char(struct char_data *ch, const char *messg, ...) __attribute__((format (printf, 2, 3)));
void send_to_all(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
void send_to_room(room_rnum room, const char *messg, ...) __attribute__ ((format (printf, 2, 3)));
void send_to_outdoor(const char *messg, ...) __attribute__ ((format (printf, 1, 2)));
void send_to_group(struct char_data *ch, struct group_data *group, const char * msg, ...) __attribute__ ((format(printf, 3, 4)));
void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...) __attribute__ ((format (printf, 3, 4)));
/* Act type settings and flags */
#define TO_ROOM 1 /**< act() type: to everyone in room, except ch. */
@ -38,7 +32,7 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
#define TO_NOTVICT 3 /**< act() type: to everyone in room, not ch or vict_obj. */
#define TO_CHAR 4 /**< act() type: to ch. */
#define TO_GMOTE 5 /**< act() type: to gemote channel (global emote) */
#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */
#define TO_SLEEP 128 /**< act() flag: to char, even if sleeping */
#define DG_NO_TRIG 256 /**< act() flag: don't check act trigger */
@ -47,10 +41,10 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj, v
char * act(const char *str, int hide_invisible, struct char_data *ch, struct obj_data *obj, void *vict_obj, int type);
/* I/O functions */
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
int write_to_descriptor(socket_t desc, const char *txt);
size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3)));
size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args);
void write_to_q(const char *txt, struct txt_q *queue, int aliased);
int write_to_descriptor(socket_t desc, const char *txt);
size_t write_to_output(struct descriptor_data *d, const char *txt, ...) __attribute__ ((format (printf, 2, 3)));
size_t vwrite_to_output(struct descriptor_data *d, const char *format, va_list args);
typedef RETSIGTYPE sigfunc(int);

275
src/db.h
View file

@ -15,98 +15,98 @@
/* arbitrary constants used by index_boot() (must be unique) */
#define DB_BOOT_WLD 0
#define DB_BOOT_MOB 1
#define DB_BOOT_OBJ 2
#define DB_BOOT_ZON 3
#define DB_BOOT_SHP 4
#define DB_BOOT_HLP 5
#define DB_BOOT_TRG 6
#define DB_BOOT_WLD 0
#define DB_BOOT_MOB 1
#define DB_BOOT_OBJ 2
#define DB_BOOT_ZON 3
#define DB_BOOT_SHP 4
#define DB_BOOT_HLP 5
#define DB_BOOT_TRG 6
#define DB_BOOT_QST 7
#if defined(CIRCLE_MACINTOSH)
#define LIB_WORLD ":world:"
#define LIB_TEXT ":text:"
#define LIB_TEXT_HELP ":text:help:"
#define LIB_MISC ":misc:"
#define LIB_ETC ":etc:"
#define LIB_PLRTEXT ":plrtext:"
#define LIB_PLROBJS ":plrobjs:"
#define LIB_PLRVARS ":plrvars:"
#define LIB_PLRFILES ":plrfiles:"
#define LIB_HOUSE ":house:"
#define SLASH ":"
#define LIB_WORLD ":world:"
#define LIB_TEXT ":text:"
#define LIB_TEXT_HELP ":text:help:"
#define LIB_MISC ":misc:"
#define LIB_ETC ":etc:"
#define LIB_PLRTEXT ":plrtext:"
#define LIB_PLROBJS ":plrobjs:"
#define LIB_PLRVARS ":plrvars:"
#define LIB_PLRFILES ":plrfiles:"
#define LIB_HOUSE ":house:"
#define SLASH ":"
#elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS)
#define LIB_WORLD "world/"
#define LIB_TEXT "text/"
#define LIB_TEXT_HELP "text/help/"
#define LIB_MISC "misc/"
#define LIB_ETC "etc/"
#define LIB_PLRTEXT "plrtext/"
#define LIB_PLROBJS "plrobjs/"
#define LIB_PLRVARS "plrvars/"
#define LIB_HOUSE "house/"
#define LIB_PLRFILES "plrfiles/"
#define SLASH "/"
#define LIB_WORLD "world/"
#define LIB_TEXT "text/"
#define LIB_TEXT_HELP "text/help/"
#define LIB_MISC "misc/"
#define LIB_ETC "etc/"
#define LIB_PLRTEXT "plrtext/"
#define LIB_PLROBJS "plrobjs/"
#define LIB_PLRVARS "plrvars/"
#define LIB_HOUSE "house/"
#define LIB_PLRFILES "plrfiles/"
#define SLASH "/"
#else
#error "Unknown path components."
#endif
#define SUF_OBJS "objs"
#define SUF_TEXT "text"
#define SUF_MEM "mem"
#define SUF_PLR "plr"
#define SUF_OBJS "objs"
#define SUF_TEXT "text"
#define SUF_MEM "mem"
#define SUF_PLR "plr"
#if defined(CIRCLE_AMIGA)
#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */
#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "/pause" /* autorun: don't restart mud */
#define EXE_FILE "/bin/circle" /* maybe use argv[0] but it's not reliable */
#define KILLSCRIPT_FILE "/.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "/pause" /* autorun: don't restart mud */
#elif defined(CIRCLE_MACINTOSH)
#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "::pause" /* autorun: don't restart mud */
#define EXE_FILE "::bin:circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "::.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "::.killscript" /* autorun: shut mud down */
#define PAUSE_FILE "::pause" /* autorun: don't restart mud */
#else
#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */
#define PAUSE_FILE "../pause" /* autorun: don't restart mud */
#define EXE_FILE "bin/circle" /* maybe use argv[0] but it's not reliable */
#define FASTBOOT_FILE "../.fastboot" /* autorun: boot without sleep */
#define KILLSCRIPT_FILE "../.killscript"/* autorun: shut mud down */
#define PAUSE_FILE "../pause" /* autorun: don't restart mud */
#endif
/* names of various files and directories */
#define INDEX_FILE "index" /* index of world files */
#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */
#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */
#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */
#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */
#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */
#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */
#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */
#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */
#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */
#define INDEX_FILE "index" /* index of world files */
#define MINDEX_FILE "index.mini" /* ... and for mini-mud-mode */
#define WLD_PREFIX LIB_WORLD"wld"SLASH /* room definitions */
#define MOB_PREFIX LIB_WORLD"mob"SLASH /* monster prototypes */
#define OBJ_PREFIX LIB_WORLD"obj"SLASH /* object prototypes */
#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */
#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */
#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */
#define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */
#define QST_PREFIX LIB_WORLD"qst"SLASH /* quest files */
#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */
#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */
#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */
#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */
#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */
#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP <CR> */
#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP <CR> imms */
#define INFO_FILE LIB_TEXT"info" /* for INFO */
#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */
#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */
#define BACKGROUND_FILE LIB_TEXT"background"/* for the background story */
#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */
#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */
#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */
#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */
#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */
#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */
#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */
#define HELP_PAGE_FILE LIB_TEXT_HELP"help" /* for HELP <CR> */
#define IHELP_PAGE_FILE LIB_TEXT_HELP"ihelp" /* for HELP <CR> imms */
#define INFO_FILE LIB_TEXT"info" /* for INFO */
#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */
#define IMMLIST_FILE LIB_TEXT"immlist" /* for IMMLIST */
#define BACKGROUND_FILE LIB_TEXT"background" /* for the background story */
#define POLICIES_FILE LIB_TEXT"policies" /* player policies/rules */
#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */
#define HELP_FILE "help.hlp"
#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */
#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */
#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */
#define MESS_FILE LIB_MISC"messages" /* damage messages */
#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */
#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/
#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */
#define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */
#define TYPOS_FILE LIB_MISC"typos" /* 'typo' */
#define BUGS_FILE LIB_MISC"bugs" /* 'bug' */
#define MESS_FILE LIB_MISC"messages" /* damage messages */
#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */
#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/
#define XNAME_FILE LIB_MISC"xnames" /* invalid name substrings */
/* BEGIN: Assumed default locations for logfiles, mainly used in do_file. */
/**/
@ -129,109 +129,108 @@
/**/
/* END: Assumed default locations for logfiles, mainly used in do_file. */
#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */
#define PLAYER_FILE LIB_ETC"players" /* the player database */
#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */
#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */
#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */
#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */
#define TIME_FILE LIB_ETC"time" /* for calendar system */
#define CHANGE_LOG_FILE "../changelog" /* for the changelog */
#define CONFIG_FILE LIB_ETC"config" /* OasisOLC * GAME CONFIG FL */
#define PLAYER_FILE LIB_ETC"players" /* the player database */
#define MAIL_FILE LIB_ETC"plrmail" /* for the mudmail system */
#define MAIL_FILE_TMP LIB_ETC"plrmail_tmp" /* for the mudmail system */
#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */
#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */
#define TIME_FILE LIB_ETC"time" /* for calendar system */
#define CHANGE_LOG_FILE "../changelog" /* for the changelog */
/* new bitvector data for use in player_index_element */
#define PINDEX_DELETED (1 << 0) /* deleted player */
#define PINDEX_NODELETE (1 << 1) /* protected player */
#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting*/
#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist*/
#define PINDEX_DELETED (1 << 0) /* deleted player */
#define PINDEX_NODELETE (1 << 1) /* protected player */
#define PINDEX_SELFDELETE (1 << 2) /* player is selfdeleting */
#define PINDEX_NOWIZLIST (1 << 3) /* Player shouldn't be on wizlist */
#define REAL 0
#define VIRTUAL 1
/* structure for the reset commands */
struct reset_com {
char command; /* current command */
char command; /* current command */
bool if_flag; /* if TRUE: exe only if preceding exe'd */
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
int line; /* line number this command appears on */
char *sarg1; /* string argument */
char *sarg2; /* string argument */
bool if_flag; /* if TRUE: exe only if preceding exe'd */
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
int line; /* line number this command appears on */
char *sarg1; /* string argument */
char *sarg2; /* string argument */
/* Commands:
* 'M': Read a mobile
* 'O': Read an object
* 'G': Give obj to mob
* 'P': Put obj in obj
* 'G': Obj to char
* 'E': Obj to char equip
* 'D': Set state of door
* 'T': Trigger command
* 'V': Assign a variable */
/* Commands:
* 'M': Read a mobile
* 'O': Read an object
* 'G': Give obj to mob
* 'P': Put obj in obj
* 'G': Obj to char
* 'E': Obj to char equip
* 'D': Set state of door
* 'T': Trigger command
* 'V': Assign a variable */
};
/* zone definition structure. for the 'zone-table' */
struct zone_data {
char *name; /* name of this zone */
char *builders; /* namelist of builders allowed to */
/* modify this zone. */
int lifespan; /* how long between resets (minutes) */
int age; /* current age of this zone (minutes) */
room_vnum bot; /* starting room number for this zone */
room_vnum top; /* upper limit for rooms in this zone */
char *name; /* name of this zone */
char *builders; /* namelist of builders allowed to modify this zone. */
int lifespan; /* how long between resets (minutes) */
int age; /* current age of this zone (minutes) */
room_vnum bot; /* starting room number for this zone */
room_vnum top; /* upper limit for rooms in this zone */
int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */
int min_level; /* Minimum level a player must be to enter this zone */
int max_level; /* Maximum level a player must be to enter this zone */
int zone_flags[ZN_ARRAY_MAX]; /* Zone Flags bitvector */
int min_level; /* Minimum level a player must be to enter this zone */
int max_level; /* Maximum level a player must be to enter this zone */
int reset_mode; /* conditions for reset (see below) */
zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */
int reset_mode; /* conditions for reset (see below) */
zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */
/* Reset mode:
* 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone.
* 2: Just reset. */
/* Reset mode:
* 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone.
* 2: Just reset. */
};
/* for queueing zones for update */
struct reset_q_element {
zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next;
zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next;
};
/* structure for the update queue */
struct reset_q_type {
struct reset_q_element *head;
struct reset_q_element *tail;
struct reset_q_element *head;
struct reset_q_element *tail;
};
/* Added level, flags, and last, primarily for pfile autocleaning. You can also
* use them to keep online statistics, and add race, class, etc if you like. */
struct player_index_element {
char *name;
long id;
int level;
int flags;
time_t last;
char *name;
long id;
int level;
int flags;
time_t last;
};
struct help_index_element {
char *index; /*Future Use */
char *keywords; /*Keyword Place holder and sorter */
char *entry; /*Entries for help files with Keywords at very top*/
int duplicate; /*Duplicate entries for multple keywords*/
int min_level; /*Min Level to read help entry*/
char *index; /* Future Use */
char *keywords; /* Keyword Place holder and sorter */
char *entry; /* Entries for help files with Keywords at very top */
int duplicate; /* Duplicate entries for multple keywords */
int min_level; /* Min Level to read help entry */
};
/* The ban defines and structs were moved to ban.h */
/* for the "buffered" rent and house object loading */
struct obj_save_data_t {
struct obj_data *obj;
int locate;
struct obj_save_data_t *next;
struct obj_data *obj;
int locate;
struct obj_save_data_t *next;
};
typedef struct obj_save_data_t obj_save_data;

View file

@ -1,18 +1,18 @@
/**
* @file dg_event.h
* This file contains defines for the simplified event system to allow trigedit
* This file contains defines for the simplified event system to allow trigedit
* to use the "wait" command, causing a delay in the middle of a script.
* This system could easily be expanded by coders who wish to implement
* an event driven mud.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
* is attributed to:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
*/
#ifndef _DG_EVENT_H_
#define _DG_EVENT_H_
@ -30,10 +30,10 @@
/** The event structure. Events get attached to the queue and are executed
* when their turn comes up in the queue. */
struct event {
EVENTFUNC(*func); /**< The function called when this event comes up. */
void *event_obj; /**< event_obj is passed to func when func is called */
struct q_element *q_el; /**< Where this event is located in the queue */
bool isMudEvent; /**< used by the memory routines */
EVENTFUNC(*func); /**< The function called when this event comes up. */
void *event_obj; /**< event_obj is passed to func when func is called */
struct q_element *q_el; /**< Where this event is located in the queue */
bool isMudEvent; /**< used by the memory routines */
};
/**************************************************************************
* End event structures and defines.
@ -47,15 +47,15 @@ struct event {
/** The priority queue. */
struct dg_queue {
struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */
struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */
struct q_element *head[NUM_EVENT_QUEUES]; /**< Front of each queue bucket. */
struct q_element *tail[NUM_EVENT_QUEUES]; /**< Rear of each queue bucket. */
};
/** Queued elements. */
struct q_element {
void *data; /**< The event to be handled. */
long key; /**< When the event should be handled. */
struct q_element *prev, *next; /**< Points to other q_elements in line. */
void *data; /**< The event to be handled. */
long key; /**< When the event should be handled. */
struct q_element *prev, *next; /**< Points to other q_elements in line. */
};
/**************************************************************************
* End priority queue structures and defines.

View file

@ -1,43 +1,43 @@
/**
* @file dg_olc.h
* This source file is used in extending Oasis OLC for trigedit.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* was created by the following people:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
* was created by the following people:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
*/
#ifndef _DG_OLC_H_
#define _DG_OLC_H_
#include "dg_scripts.h"
#define NUM_TRIG_TYPE_FLAGS 20
#define NUM_TRIG_TYPE_FLAGS 20
/* Submodes of TRIGEDIT connectedness. */
#define TRIGEDIT_MAIN_MENU 0
#define TRIGEDIT_TRIGTYPE 1
#define TRIGEDIT_CONFIRM_SAVESTRING 2
#define TRIGEDIT_NAME 3
#define TRIGEDIT_INTENDED 4
#define TRIGEDIT_TYPES 5
#define TRIGEDIT_COMMANDS 6
#define TRIGEDIT_NARG 7
#define TRIGEDIT_ARGUMENT 8
#define TRIGEDIT_COPY 9
#define TRIGEDIT_MAIN_MENU 0
#define TRIGEDIT_TRIGTYPE 1
#define TRIGEDIT_CONFIRM_SAVESTRING 2
#define TRIGEDIT_NAME 3
#define TRIGEDIT_INTENDED 4
#define TRIGEDIT_TYPES 5
#define TRIGEDIT_COMMANDS 6
#define TRIGEDIT_NARG 7
#define TRIGEDIT_ARGUMENT 8
#define TRIGEDIT_COPY 9
#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */
#define SCRIPT_MAIN_MENU 0
#define SCRIPT_NEW_TRIGGER 1
#define SCRIPT_DEL_TRIGGER 2
#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */
#define SCRIPT_MAIN_MENU 0
#define SCRIPT_NEW_TRIGGER 1
#define SCRIPT_DEL_TRIGGER 2
#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */
#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */
#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */
#define OLC_SCRIPT_EDIT_MODE(d) (OLC(d)->script_mode) /* parse input mode */
#define OLC_SCRIPT(d) (OLC(d)->script) /* script editing */
#define OLC_ITEM_TYPE(d) (OLC(d)->item_type) /* mob/obj/room */
/* prototype exported functions from dg_olc.c */
void script_save_to_disk(FILE *fp, void *item, int type);

View file

@ -53,8 +53,8 @@
/* mob trigger types */
#define MTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define MTRIG_RANDOM (1 << 1) /* checked randomly */
#define MTRIG_COMMAND (1 << 2) /* character types a command */
#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */
#define MTRIG_COMMAND (1 << 2) /* character types a command */
#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */
#define MTRIG_ACT (1 << 4) /* word or phrase sent to act */
#define MTRIG_DEATH (1 << 5) /* character dies */
#define MTRIG_GREET (1 << 6) /* something enters room seen */
@ -63,7 +63,7 @@
#define MTRIG_RECEIVE (1 << 9) /* character is given obj */
#define MTRIG_FIGHT (1 << 10) /* each pulse while fighting */
#define MTRIG_HITPRCNT (1 << 11) /* fighting and below some hp */
#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */
#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */
#define MTRIG_LOAD (1 << 13) /* the mob is loaded */
#define MTRIG_MEMORY (1 << 14) /* mob see's someone remembered */
#define MTRIG_CAST (1 << 15) /* mob targetted by spell */
@ -73,8 +73,8 @@
#define MTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj trigger types */
#define OTRIG_GLOBAL (1 << 0) /* unused */
#define OTRIG_RANDOM (1 << 1) /* checked randomly */
#define OTRIG_GLOBAL (1 << 0) /* unused */
#define OTRIG_RANDOM (1 << 1) /* checked randomly */
#define OTRIG_COMMAND (1 << 2) /* character types a command */
#define OTRIG_TIMER (1 << 5) /* item's timer expires */
@ -94,12 +94,12 @@
/* wld trigger types */
#define WTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define WTRIG_RANDOM (1 << 1) /* checked randomly */
#define WTRIG_COMMAND (1 << 2) /* character types a command */
#define WTRIG_RANDOM (1 << 1) /* checked randomly */
#define WTRIG_COMMAND (1 << 2) /* character types a command */
#define WTRIG_SPEECH (1 << 3) /* a char says word/phrase */
#define WTRIG_RESET (1 << 5) /* zone has been reset */
#define WTRIG_ENTER (1 << 6) /* character enters room */
#define WTRIG_ENTER (1 << 6) /* character enters room */
#define WTRIG_DROP (1 << 7) /* something dropped in room */
#define WTRIG_CAST (1 << 15) /* spell cast in room */
@ -109,41 +109,40 @@
#define WTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj command trigger types */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
#define OCMD_ROOM (1 << 2) /* obj must be in char's room */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
#define OCMD_ROOM (1 << 2) /* obj must be in char's room */
/* obj consume trigger commands */
#define OCMD_EAT 1
#define OCMD_DRINK 2
#define OCMD_QUAFF 3
#define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */
#define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
* same time. */
#define PULSE_DG_SCRIPT (13 RL_SEC)
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
recurse into each other */
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can recurse into each other */
#define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */
/* one line of the trigger */
struct cmdlist_element {
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
int loops; /* for counting number of runs in a while loop */
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
int loops; /* for counting number of runs in a while loop */
};
struct trig_var_data {
char *name; /* name of variable */
char *value; /* value of variable */
long context; /* 0: global context */
char *name; /* name of variable */
char *value; /* value of variable */
long context; /* 0: global context */
struct trig_var_data *next;
struct trig_var_data *next;
};
/** structure for triggers */
@ -154,14 +153,14 @@ struct trig_data {
char *name; /**< name of trigger */
long trigger_type; /**< type of trigger (for bitvector) */
struct cmdlist_element *cmdlist; /**< top of command list */
struct cmdlist_element *curr_state; /**< ptr to current line of trigger */
struct cmdlist_element *curr_state; /**< ptr to current line of trigger */
int narg; /**< numerical argument */
char *arglist; /**< argument list */
int depth; /**< depth into nest ifs/whiles/etc */
int loops; /**< loop iteration counter */
struct event *wait_event; /**< event to pause the trigger */
ubyte purged; /**< trigger is set to be purged */
struct trig_var_data *var_list; /**< list of local vars for trigger */
struct trig_var_data *var_list; /**< list of local vars for trigger */
struct trig_data *next;
struct trig_data *next_in_world; /**< next in the global trigger list */
@ -169,27 +168,27 @@ struct trig_data {
/** a complete script (composed of several triggers) */
struct script_data {
long types; /**< bitvector of trigger types */
struct trig_data *trig_list; /**< list of triggers */
struct trig_var_data *global_vars; /**< list of global variables */
ubyte purged; /**< script is set to be purged */
long context; /**< current context for statics */
long types; /**< bitvector of trigger types */
struct trig_data *trig_list; /**< list of triggers */
struct trig_var_data *global_vars; /**< list of global variables */
ubyte purged; /**< script is set to be purged */
long context; /**< current context for statics */
struct script_data *next; /**< used for purged_scripts */
struct script_data *next; /**< used for purged_scripts */
};
/* The event data for the wait command */
struct wait_event_data {
struct trig_data *trigger;
void *go;
int type;
struct trig_data *trigger;
void *go;
int type;
};
/* used for actor memory triggers */
struct script_memory {
long id; /* id of who to remember */
char *cmd; /* command, or NULL for generic */
struct script_memory *next;
long id; /* id of who to remember */
char *cmd; /* command, or NULL for generic */
struct script_memory *next;
};
/* typedefs that the dg functions rely on */
@ -205,8 +204,8 @@ char *one_phrase(char *arg, char *first_arg);
int is_substring(char *sub, char *string);
int word_check(char *str, char *wordlist);
void act_mtrigger(const char_data *ch, char *str,
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
void act_mtrigger(const char_data *ch, char *str, char_data *actor, char_data *victim, obj_data *object,
obj_data *target, char *arg);
void speech_mtrigger(char_data *actor, char *str);
void speech_wtrigger(char_data *actor, char *str);
void greet_memory_mtrigger(char_data *ch);
@ -218,17 +217,13 @@ int drop_otrigger(obj_data *obj, char_data *actor);
void timer_otrigger(obj_data *obj);
int get_otrigger(obj_data *obj, char_data *actor);
int drop_wtrigger(obj_data *obj, char_data *actor);
int give_otrigger(obj_data *obj, char_data *actor,
char_data *victim);
int receive_mtrigger(char_data *ch, char_data *actor,
obj_data *obj);
void bribe_mtrigger(char_data *ch, char_data *actor,
int amount);
int give_otrigger(obj_data *obj, char_data *actor, char_data *victim);
int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj);
void bribe_mtrigger(char_data *ch, char_data *actor, int amount);
int wear_otrigger(obj_data *obj, char_data *actor, int where);
int remove_otrigger(obj_data *obj, char_data *actor);
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
char *argument, int type);
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, char *argument, int type);
int command_mtrigger(char_data *actor, char *cmd, char *argument);
int command_otrigger(char_data *actor, char *cmd, char *argument);
int command_wtrigger(char_data *actor, char *cmd, char *argument);
@ -308,8 +303,7 @@ int trig_is_attached(struct script_data *sc, int trig_num);
/* Thanks to Chris Gilbert for reminding me that there are other options. */
int script_driver(void *go_adress, trig_data *trig, int type, int mode);
trig_rnum real_trigger(trig_vnum vnum);
void process_eval(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void process_eval(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void read_saved_vars(struct char_data *ch);
void save_char_vars(struct char_data *ch);
void init_lookup_table(void);
@ -329,12 +323,10 @@ void add_var(struct trig_var_data **var_list, const char *name, const char *valu
int item_in_list(char *item, obj_data *list);
char *skill_percent(struct char_data *ch, char *skill);
int char_has_item(char *item, struct char_data *ch);
void var_subst(void *go, struct script_data *sc, trig_data *trig,
int type, char *line, char *buf);
int text_processed(char *field, char *subfield, struct trig_var_data *vd,
char *str, size_t slen);
void find_replacement(void *go, struct script_data *sc, trig_data *trig,
int type, char *var, char *field, char *subfield, char *str, size_t slen);
void var_subst(void *go, struct script_data *sc, trig_data *trig, int type, char *line, char *buf);
int text_processed(char *field, char *subfield, struct trig_var_data *vd, char *str, size_t slen);
void find_replacement(void *go, struct script_data *sc, trig_data *trig, int type, char *var, char *field,
char *subfield, char *str, size_t slen);
/* From dg_handler.c */
void free_var_el(struct trig_var_data *var);
@ -355,10 +347,8 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets);
void send_to_zone(char *messg, zone_rnum zone);
/* from dg_misc.c */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd);
void send_char_pos(struct char_data *ch, int dam);
int valid_dg_target(char_data *ch, int bitvector);
void script_damage(char_data *vict, int dam);
@ -407,13 +397,13 @@ void wld_command_interpreter(room_data *room, char *argument);
#define UID_CHAR '}'
#define GET_TRIG_NAME(t) ((t)->name)
#define GET_TRIG_RNUM(t) ((t)->nr)
#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum)
#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum)
#define GET_TRIG_TYPE(t) ((t)->trigger_type)
#define GET_TRIG_DATA_TYPE(t) ((t)->data_type)
#define GET_TRIG_DATA_TYPE(t) ((t)->data_type)
#define GET_TRIG_NARG(t) ((t)->narg)
#define GET_TRIG_ARG(t) ((t)->arglist)
#define GET_TRIG_VARS(t) ((t)->var_list)
#define GET_TRIG_WAIT(t) ((t)->wait_event)
#define GET_TRIG_VARS(t) ((t)->var_list)
#define GET_TRIG_WAIT(t) ((t)->wait_event)
#define GET_TRIG_DEPTH(t) ((t)->depth)
#define GET_TRIG_LOOPS(t) ((t)->loops)
@ -421,22 +411,20 @@ void wld_command_interpreter(room_data *room, char *argument);
* mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1
* room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1
* object id's: OBJ_ID_BASE and higher */
#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */
#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */
#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */
#define MOB_ID_BASE 10000000 /* 10000000 player IDNUMS should suffice */
#define ROOM_ID_BASE (10000000 + MOB_ID_BASE) /* 10000000 Mobs */
#define OBJ_ID_BASE (10000000 + ROOM_ID_BASE) /* 10000000 Rooms */
#define SCRIPT(o) ((o)->script)
#define SCRIPT_MEM(c) ((c)->memory)
#define SCRIPT(o) ((o)->script)
#define SCRIPT_MEM(c) ((c)->memory)
#define SCRIPT_TYPES(s) ((s)->types)
#define TRIGGERS(s) ((s)->trig_list)
#define SCRIPT_TYPES(s) ((s)->types)
#define TRIGGERS(s) ((s)->trig_list)
#define GET_SHORT(ch) ((ch)->player.short_descr)
#define GET_SHORT(ch) ((ch)->player.short_descr)
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \
IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \
!GET_TRIG_DEPTH(t))
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && !GET_TRIG_DEPTH(t))
/* This formerly used 'go' instead of 'id' and referenced 'go->id' but this is
@ -444,8 +432,8 @@ void wld_command_interpreter(room_data *room, char *argument);
* and obj_script_id().
*/
#define ADD_UID_VAR(buf, trig, id, name, context) do { \
sprintf(buf, "%c%ld", UID_CHAR, id); \
add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0)
sprintf(buf, "%c%ld", UID_CHAR, id); \
add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0)
// id helpers
extern long char_script_id(char_data *ch);

View file

@ -1,12 +1,12 @@
/**
* @file fight.h
* Fighting and violence functions and variables.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
@ -16,8 +16,8 @@
/* Structures and defines */
/* Attacktypes with grammar */
struct attack_hit_type {
const char *singular;
const char *plural;
const char *singular;
const char *plural;
};
/* Functions available in fight.c */
@ -31,8 +31,7 @@ void hit(struct char_data *ch, struct char_data *victim, int type);
void perform_violence(void);
void raw_kill(struct char_data * ch, struct char_data * killer);
void set_fighting(struct char_data *ch, struct char_data *victim);
int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int attacktype);
int skill_message(int dam, struct char_data *ch, struct char_data *vict, int attacktype);
void stop_fighting(struct char_data *ch);

View file

@ -1,13 +1,13 @@
/**
* @file genmob.h
* Generic OLC Library - Mobiles.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENMOB_H_
#define _GENMOB_H_
@ -31,12 +31,12 @@ int write_mobile_mobprog(mob_vnum mvnum, struct char_data *mob, FILE *fd);
#endif
/* Handy macros. */
#define GET_NDD(mob) ((mob)->mob_specials.damnodice)
#define GET_SDD(mob) ((mob)->mob_specials.damsizedice)
#define GET_ALIAS(mob) ((mob)->player.name)
#define GET_SDESC(mob) ((mob)->player.short_descr)
#define GET_LDESC(mob) ((mob)->player.long_descr)
#define GET_DDESC(mob) ((mob)->player.description)
#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type)
#define GET_NDD(mob) ((mob)->mob_specials.damnodice)
#define GET_SDD(mob) ((mob)->mob_specials.damsizedice)
#define GET_ALIAS(mob) ((mob)->player.name)
#define GET_SDESC(mob) ((mob)->player.short_descr)
#define GET_LDESC(mob) ((mob)->player.long_descr)
#define GET_DDESC(mob) ((mob)->player.description)
#define GET_ATTACK(mob) ((mob)->mob_specials.attack_type)
#endif /* _GENMOB_H_ */

View file

@ -1,13 +1,13 @@
/**
* @file genobj.h
* Generic OLC Library - Objects.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENOBJ_H_
#define _GENOBJ_H_

View file

@ -1,19 +1,19 @@
/**
* @file genolc.h
* Generic OLC Library - General.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENOLC_H_
#define _GENOLC_H_
#define STRING_TERMINATOR '~'
#define CONFIG_GENOLC_MOBPROG 0
#define CONFIG_GENOLC_MOBPROG 0
int genolc_checkstring(struct descriptor_data *d, char *arg);
int remove_from_save_list(zone_vnum, int type);
@ -30,28 +30,28 @@ ACMD(do_export_zone);
ACMD(do_show_save_list);
struct save_list_data {
int zone;
int type;
struct save_list_data *next;
int zone;
int type;
struct save_list_data *next;
};
extern struct save_list_data *save_list;
/* save_list_data.type */
#define SL_MOB 0
#define SL_OBJ 1
#define SL_SHP 2
#define SL_WLD 3
#define SL_ZON 4
#define SL_CFG 5
#define SL_MOB 0
#define SL_OBJ 1
#define SL_SHP 2
#define SL_WLD 3
#define SL_ZON 4
#define SL_CFG 5
#define SL_QST 6
#define SL_MAX 6
#define SL_ACT SL_MAX + 1 /* must be above MAX */
#define SL_MAX 6
#define SL_ACT SL_MAX + 1 /* must be above MAX */
#define SL_HLP SL_MAX + 2
#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)]
#define ZCMD(zon, cmds) zone_table[(zon)].cmd[(cmds)]
#define LIMIT(var, low, high) MIN(high, MAX(var, low))
#define LIMIT(var, low, high) MIN(high, MAX(var, low))
room_vnum genolc_zone_bottom(zone_rnum rznum);
room_vnum genolc_zonep_bottom(struct zone_data *zone);

View file

@ -1,13 +1,13 @@
/**
* @file genshp.h
* Generic OLC Library - Shops.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENSHP_H_
#define _GENSHP_H_
@ -25,35 +25,35 @@ int save_shops(zone_rnum zone_num);
shop_rnum real_shop(shop_vnum vnum);
/* Handy macros. */
#define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1)
#define S_CLOSE1(i) ((i)->close1)
#define S_OPEN2(i) ((i)->open2)
#define S_CLOSE2(i) ((i)->close2)
#define S_BANK(i) ((i)->bankAccount)
#define S_BROKE_TEMPER(i) ((i)->temper1)
#define S_BITVECTOR(i) ((i)->bitvector)
#define S_NOTRADE(i) ((i)->with_who)
#define S_SORT(i) ((i)->lastsort)
#define S_BUYPROFIT(i) ((i)->profit_buy)
#define S_SELLPROFIT(i) ((i)->profit_sell)
#define S_FUNC(i) ((i)->func)
#define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1)
#define S_CLOSE1(i) ((i)->close1)
#define S_OPEN2(i) ((i)->open2)
#define S_CLOSE2(i) ((i)->close2)
#define S_BANK(i) ((i)->bankAccount)
#define S_BROKE_TEMPER(i) ((i)->temper1)
#define S_BITVECTOR(i) ((i)->bitvector)
#define S_NOTRADE(i) ((i)->with_who)
#define S_SORT(i) ((i)->lastsort)
#define S_BUYPROFIT(i) ((i)->profit_buy)
#define S_SELLPROFIT(i) ((i)->profit_sell)
#define S_FUNC(i) ((i)->func)
#define S_ROOMS(i) ((i)->in_room)
#define S_PRODUCTS(i) ((i)->producing)
#define S_NAMELISTS(i) ((i)->type)
#define S_ROOM(i, num) ((i)->in_room[(num)])
#define S_PRODUCT(i, num) ((i)->producing[(num)])
#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)]))
#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)]))
#define S_ROOMS(i) ((i)->in_room)
#define S_PRODUCTS(i) ((i)->producing)
#define S_NAMELISTS(i) ((i)->type)
#define S_ROOM(i, num) ((i)->in_room[(num)])
#define S_PRODUCT(i, num) ((i)->producing[(num)])
#define S_BUYTYPE(i, num) (BUY_TYPE((i)->type[(num)]))
#define S_BUYWORD(i, num) (BUY_WORD((i)->type[(num)]))
#define S_NOITEM1(i) ((i)->no_such_item1)
#define S_NOITEM2(i) ((i)->no_such_item2)
#define S_NOCASH1(i) ((i)->missing_cash1)
#define S_NOCASH2(i) ((i)->missing_cash2)
#define S_NOBUY(i) ((i)->do_not_buy)
#define S_BUY(i) ((i)->message_buy)
#define S_SELL(i) ((i)->message_sell)
#define S_NOITEM1(i) ((i)->no_such_item1)
#define S_NOITEM2(i) ((i)->no_such_item2)
#define S_NOCASH1(i) ((i)->missing_cash1)
#define S_NOCASH2(i) ((i)->missing_cash2)
#define S_NOBUY(i) ((i)->do_not_buy)
#define S_BUY(i) ((i)->message_buy)
#define S_SELL(i) ((i)->message_sell)
#endif /* _GENSHP_H_ */

View file

@ -1,13 +1,13 @@
/**
* @file genwld.h
* Generic OLC Library - Rooms.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENWLD_H_
#define _GENWLD_H_

View file

@ -1,13 +1,13 @@
/**
* @file genzon.h
* Generic OLC Library - Zones.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer.
*/
#ifndef _GENZON_H_
#define _GENZON_H_

View file

@ -1,13 +1,13 @@
/**
* @file graph.h
* Header file for Various graph algorithms.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* @todo the functions here should perhaps be a part of another module?
*/

View file

@ -1,49 +1,48 @@
/**
* @file handler.h
* Prototypes of handling and utility functions.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _HANDLER_H_
#define _HANDLER_H_
/* handling the affected-structures */
void affect_total(struct char_data *ch);
void affect_to_char(struct char_data *ch, struct affected_type *af);
void affect_remove(struct char_data *ch, struct affected_type *af);
void affect_from_char(struct char_data *ch, int type);
bool affected_by_spell(struct char_data *ch, int type);
void affect_join(struct char_data *ch, struct affected_type *af,
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod);
void affect_total(struct char_data *ch);
void affect_to_char(struct char_data *ch, struct affected_type *af);
void affect_remove(struct char_data *ch, struct affected_type *af);
void affect_from_char(struct char_data *ch, int type);
bool affected_by_spell(struct char_data *ch, int type);
void affect_join(struct char_data *ch, struct affected_type *af, bool add_dur, bool avg_dur, bool add_mod, bool avg_mod);
/* utility */
const char *money_desc(int amount);
struct obj_data *create_money(int amount);
int isname(const char *str, const char *namelist);
int is_name(const char *str, const char *namelist);
char *fname(const char *namelist);
int get_number(char **name);
int isname(const char *str, const char *namelist);
int is_name(const char *str, const char *namelist);
char *fname(const char *namelist);
int get_number(char **name);
/* objects */
void obj_to_char(struct obj_data *object, struct char_data *ch);
void obj_from_char(struct obj_data *object);
void obj_to_char(struct obj_data *object, struct char_data *ch);
void obj_from_char(struct obj_data *object);
void equip_char(struct char_data *ch, struct obj_data *obj, int pos);
void equip_char(struct char_data *ch, struct obj_data *obj, int pos);
struct obj_data *unequip_char(struct char_data *ch, int pos);
int invalid_align(struct char_data *ch, struct obj_data *obj);
int invalid_align(struct char_data *ch, struct obj_data *obj);
void obj_to_room(struct obj_data *object, room_rnum room);
void obj_from_room(struct obj_data *object);
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to);
void obj_from_obj(struct obj_data *obj);
void object_list_new_owner(struct obj_data *list, struct char_data *ch);
void obj_to_room(struct obj_data *object, room_rnum room);
void obj_from_room(struct obj_data *object);
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to);
void obj_from_obj(struct obj_data *obj);
void object_list_new_owner(struct obj_data *list, struct char_data *ch);
void extract_obj(struct obj_data *obj);
void extract_obj(struct obj_data *obj);
void update_char_objects(struct char_data *ch);
@ -51,11 +50,11 @@ void update_char_objects(struct char_data *ch);
struct char_data *get_char_room(char *name, int *num, room_rnum room);
struct char_data *get_char_num(mob_rnum nr);
void char_from_room(struct char_data *ch);
void char_to_room(struct char_data *ch, room_rnum room);
void extract_char(struct char_data *ch);
void extract_char_final(struct char_data *ch);
void extract_pending_chars(void);
void char_from_room(struct char_data *ch);
void char_to_room(struct char_data *ch, room_rnum room);
void extract_char(struct char_data *ch);
void extract_char_final(struct char_data *ch);
void extract_pending_chars(void);
/* find if character can see */
struct char_data *get_player_vis(struct char_data *ch, char *name, int *number, int inroom);
@ -71,11 +70,11 @@ struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *numb
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]);
/* find all dots */
int find_all_dots(char *arg);
int find_all_dots(char *arg);
#define FIND_INDIV 0
#define FIND_ALL 1
#define FIND_ALLDOT 2
#define FIND_INDIV 0
#define FIND_ALL 1
#define FIND_ALLDOT 2
/* group */
struct group_data * create_group(struct char_data * leader);
@ -84,8 +83,7 @@ void leave_group(struct char_data *ch);
void join_group(struct char_data *ch, struct group_data *group);
/* Generic Find */
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
struct char_data **tar_ch, struct obj_data **tar_obj);
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, struct char_data **tar_ch, struct obj_data **tar_obj);
#define FIND_CHAR_ROOM (1 << 0)
#define FIND_CHAR_WORLD (1 << 1)
@ -118,13 +116,13 @@ void clearMemory(struct char_data *ch);
#define LAST_PLAYING 10
struct last_entry {
int close_type;
char hostname[256];
char username[16];
time_t time;
time_t close_time;
int idnum;
int punique;
int close_type;
char hostname[256];
char username[16];
time_t time;
time_t close_time;
int idnum;
int punique;
};
void add_llog_entry(struct char_data *ch, int type);

View file

@ -1,13 +1,13 @@
/**
* @file hedit.h
* Oasis OLC Help Editor.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* Author: Steve Wolfe, Scott Meisenholder, Rhade
* All rights reserved. See license.doc for complete information.
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*/
#ifndef _HEDIT_H_

View file

@ -1,52 +1,51 @@
/**
* @file house.h
* Player house structures, prototypes and defines.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _HOUSE_H_
#define _HOUSE_H_
#define MAX_HOUSES 100
#define MAX_GUESTS 10
#define MAX_HOUSES 100
#define MAX_GUESTS 10
#define HOUSE_PRIVATE 0
#define HOUSE_PRIVATE 0
struct house_control_rec {
room_vnum vnum; /* vnum of this house */
room_vnum atrium; /* vnum of atrium */
sh_int exit_num; /* direction of house's exit */
time_t built_on; /* date this house was built */
int mode; /* mode of ownership */
long owner; /* idnum of house's owner */
int num_of_guests; /* how many guests for house */
long guests[MAX_GUESTS]; /* idnums of house's guests */
time_t last_payment; /* date of last house payment */
long spare0;
long spare1;
long spare2;
long spare3;
long spare4;
long spare5;
long spare6;
long spare7;
room_vnum vnum; /* vnum of this house */
room_vnum atrium; /* vnum of atrium */
sh_int exit_num; /* direction of house's exit */
time_t built_on; /* date this house was built */
int mode; /* mode of ownership */
long owner; /* idnum of house's owner */
int num_of_guests; /* how many guests for house */
long guests[MAX_GUESTS]; /* idnums of house's guests */
time_t last_payment; /* date of last house payment */
long spare0;
long spare1;
long spare2;
long spare3;
long spare4;
long spare5;
long spare6;
long spare7;
};
#define TOROOM(room, dir) (world[room].dir_option[dir] ? \
world[room].dir_option[dir]->to_room : NOWHERE)
#define TOROOM(room, dir) (world[room].dir_option[dir] ? world[room].dir_option[dir]->to_room : NOWHERE)
/* Functions in house.c made externally available */
/* Utility Functions */
void House_boot(void);
void House_save_all(void);
int House_can_enter(struct char_data *ch, room_vnum house);
void House_crashsave(room_vnum vnum);
void House_list_guests(struct char_data *ch, int i, int quiet);
void House_boot(void);
void House_save_all(void);
int House_can_enter(struct char_data *ch, room_vnum house);
void House_crashsave(room_vnum vnum);
void House_list_guests(struct char_data *ch, int i, int quiet);
int House_save(struct obj_data *obj, FILE *fp);
void hcontrol_list_houses(struct char_data *ch, char *arg);
/* In game Commands */

25
src/ibt.h Executable file → Normal file
View file

@ -69,19 +69,18 @@ typedef struct ibt_data IBT_DATA;
break; \
}
struct ibt_data
{
IBT_DATA *next; /**< Pointer to next IBT in the list */
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
char *text; /**< Header Text for this IBT */
char *body; /**< Body Text for this IBT */
char *name; /**< Name of the person who reported this IBT */
char *notes; /**< Resolution Notes added by Administrators */
int level; /**< Level of the person who reported this IBT */
room_vnum room; /**< Room in which this IBT was reported */
long id_num; /**< The ID number of the player who logged it */
int flags[IBT_ARRAY_MAX]; /**< IBT flags */
long dated; /**< When the IBT what reported */
struct ibt_data {
IBT_DATA *next; /**< Pointer to next IBT in the list */
IBT_DATA *prev; /**< Pointer to previous IBT in the list */
char *text; /**< Header Text for this IBT */
char *body; /**< Body Text for this IBT */
char *name; /**< Name of the person who reported this IBT */
char *notes; /**< Resolution Notes added by Administrators */
int level; /**< Level of the person who reported this IBT */
room_vnum room; /**< Room in which this IBT was reported */
long id_num; /**< The ID number of the player who logged it */
int flags[IBT_ARRAY_MAX]; /**< IBT flags */
long dated; /**< When the IBT what reported */
};
extern IBT_DATA *first_bug;

View file

@ -1,21 +1,21 @@
/**
* @file improved-edit.h
* The basic and improved editor.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* This set of code was not originally part of the circlemud distribution.
*
* This set of code was not originally part of the circlemud distribution.
*/
#ifndef _IMPROVED_EDIT_H_
#define _IMPROVED_EDIT_H_
/* This is here to allow different code for the basic and improved editor. If
* you do not wish to use the improved editor, put #if 0 below, otherwise you
/* This is here to allow different code for the basic and improved editor. If
* you do not wish to use the improved editor, put #if 0 below, otherwise you
* should leave the setting at #if 1. */
#define CONFIG_IMPROVED_EDITOR 1
#define CONFIG_IMPROVED_EDITOR 1
#define using_improved_editor CONFIG_IMPROVED_EDITOR
#define using_improved_editor CONFIG_IMPROVED_EDITOR
void parse_edit_action(int command, char *string, struct descriptor_data *d);
int improved_editor_execute(struct descriptor_data *d, char *string);
@ -29,18 +29,18 @@ void send_editor_help(struct descriptor_data *d);
#define PARSE_HELP 2
#define PARSE_DELETE 3
#define PARSE_INSERT 4
#define PARSE_LIST_NORM 5
#define PARSE_LIST_NORM 5
#define PARSE_LIST_NUM 6
#define PARSE_EDIT 7
#define PARSE_TOGGLE 8
/* Defines for the action variable. */
#define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */
#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */
#define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */
#define STRINGADD_ACTION 4 /* Editor action, don't append \r\n. */
/* Settings for formatter. */
#define FORMAT_INDENT (1 << 0)
#define FORMAT_INDENT (1 << 0)
#endif /* _IMPROVED_EDIT_H_ */

File diff suppressed because it is too large Load diff

View file

@ -21,21 +21,21 @@
#define IS_MOVE(cmdnum) (complete_cmd_info[cmdnum].command_pointer == do_move)
void sort_commands(void);
void command_interpreter(struct char_data *ch, char *argument);
int search_block(char *arg, const char **list, int exact);
char *one_argument(char *argument, char *first_arg);
char *one_word(char *argument, char *first_arg);
char *any_one_arg(char *argument, char *first_arg);
char *two_arguments(char *argument, char *first_arg, char *second_arg);
int fill_word(char *argument);
void command_interpreter(struct char_data *ch, char *argument);
int search_block(char *arg, const char **list, int exact);
char *one_argument(char *argument, char *first_arg);
char *one_word(char *argument, char *first_arg);
char *any_one_arg(char *argument, char *first_arg);
char *two_arguments(char *argument, char *first_arg, char *second_arg);
int fill_word(char *argument);
int reserved_word(char *argument);
void half_chop(char *string, char *arg1, char *arg2);
void nanny(struct descriptor_data *d, char *arg);
int is_abbrev(const char *arg1, const char *arg2);
int is_number(const char *str);
int find_command(const char *command);
void skip_spaces(char **string);
char *delete_doubledollar(char *string);
void half_chop(char *string, char *arg1, char *arg2);
void nanny(struct descriptor_data *d, char *arg);
int is_abbrev(const char *arg1, const char *arg2);
int is_number(const char *str);
int find_command(const char *command);
void skip_spaces(char **string);
char *delete_doubledollar(char *string);
int special(struct char_data *ch, int cmd, char *arg);
void free_alias(struct alias_data *a);
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
@ -54,35 +54,35 @@ ACMD(do_alias);
#define RESERVE_CMDS 7
struct command_info {
const char *command;
const char *sort_as;
byte minimum_position;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
sh_int minimum_level;
int subcmd;
const char *command;
const char *sort_as;
byte minimum_position;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
sh_int minimum_level;
int subcmd;
};
struct mob_script_command_t {
const char *command_name;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
int subcmd;
const char *command_name;
void (*command_pointer)
(struct char_data *ch, char *argument, int cmd, int subcmd);
int subcmd;
};
struct alias_data {
char *alias;
char *replacement;
int type;
struct alias_data *next;
char *alias;
char *replacement;
int type;
struct alias_data *next;
};
#define ALIAS_SIMPLE 0
#define ALIAS_COMPLEX 1
#define ALIAS_SIMPLE 0
#define ALIAS_COMPLEX 1
#define ALIAS_SEP_CHAR ';'
#define ALIAS_VAR_CHAR '$'
#define ALIAS_GLOB_CHAR '*'
#define ALIAS_SEP_CHAR ';'
#define ALIAS_VAR_CHAR '$'
#define ALIAS_GLOB_CHAR '*'
/* SUBCOMMANDS: You can define these however you want to, and the definitions
* of the subcommands are independent from function to function.*/

View file

@ -1,34 +1,34 @@
/**
* @file lists.h
* Lists Header file.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 2012 by Joseph Arnusch.
* Copyright 2012 by Joseph Arnusch.
*/
#ifndef _LISTS_HEADER
#define _LISTS_HEADER
struct item_data {
struct item_data * pPrevItem;
struct item_data * pNextItem;
void * pContent;
struct item_data * pPrevItem;
struct item_data * pNextItem;
void * pContent;
};
struct list_data {
struct item_data * pFirstItem;
struct item_data * pLastItem;
unsigned short int iIterators;
unsigned short int iSize;
struct item_data * pFirstItem;
struct item_data * pLastItem;
unsigned short int iIterators;
unsigned short int iSize;
};
struct iterator_data {
struct list_data * pList;
struct item_data * pItem;
struct list_data * pList;
struct item_data * pItem;
};
/* Externals */

View file

@ -1,12 +1,12 @@
/**
* @file mail.h
* Public procs, macro defs, subcommand defines mudmail system.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
* By Jeremy Elson.
*/
@ -15,39 +15,39 @@
/* You can modify the following constants to fit your own MUD. */
/* minimum level a player must be to send mail */
/* minimum level a player must be to send mail */
#define MIN_MAIL_LEVEL 1
/* # of gold coins required to send mail */
/* # of gold coins required to send mail */
#define STAMP_PRICE 150
/* Maximum size of mail in bytes (arbitrary) */
/* Maximum size of mail in bytes (arbitrary) */
#define MAX_MAIL_SIZE 8192
/* size of mail file allocation blocks */
/* size of mail file allocation blocks */
#define BLOCK_SIZE 100
/* General, publicly available functions */
SPECIAL(postmaster);
/* NOTE: Make sure that your block size is big enough. If not, HEADER_BLOCK_
* DATASIZE will end up negative. This is a bad thing. Check the define below
* to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE.
* DATASIZE will end up negative. This is a bad thing. Check the define below
* to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE.
* 100 is a nice round number for BLOCK_SIZE and is the default. The mail system
* will always allocate disk space in chunks of size BLOCK_SIZE. */
/* DON'T TOUCH DEFINES BELOW. */
int scan_file(void);
int has_mail(long recipient);
void store_mail(long to, long from, char *message_pointer);
char *read_delete(long recipient);
int scan_file(void);
int has_mail(long recipient);
void store_mail(long to, long from, char *message_pointer);
char *read_delete(long recipient);
void notify_if_playing(struct char_data *from, int recipient_id);
struct mail_t {
long recipient;
long sender;
time_t sent_time;
char *body;
long recipient;
long sender;
time_t sent_time;
char *body;
};
/* old stuff below */
@ -56,18 +56,17 @@ struct mail_t {
#define DELETED_BLOCK (-3)
/* Note: next_block is part of header_blk in a data block; we can't combine them
* here because we have to be able to differentiate a data block from a header
* here because we have to be able to differentiate a data block from a header
* block when booting mail system. */
struct header_data_type {
long next_block; /* if header block, link to next block */
long from; /* idnum of the mail's sender */
long to; /* idnum of mail's recipient */
time_t mail_time; /* when was the letter mailed? */
long next_block; /* if header block, link to next block */
long from; /* idnum of the mail's sender */
long to; /* idnum of mail's recipient */
time_t mail_time; /* when was the letter mailed? */
};
/* size of the data part of a header block */
#define HEADER_BLOCK_DATASIZE \
(BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
#define HEADER_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(struct header_data_type) - sizeof(char))
/* size of the data part of a data block */
#define DATA_BLOCK_DATASIZE (BLOCK_SIZE - sizeof(long) - sizeof(char))
@ -76,31 +75,31 @@ struct header_data_type {
terminating null character. */
struct header_block_type_d {
long block_type; /* is this a header or data block? */
struct header_data_type header_data; /* other header data */
char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
long block_type; /* is this a header or data block? */
struct header_data_type header_data; /* other header data */
char txt[HEADER_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
};
struct data_block_type_d {
long block_type; /* -1 if header block, -2 if last data block
in mail, otherwise a link to the next */
char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
long block_type; /* -1 if header block, -2 if last data block
in mail, otherwise a link to the next */
char txt[DATA_BLOCK_DATASIZE+1]; /* actual text plus 1 for null */
};
typedef struct header_block_type_d header_block_type;
typedef struct data_block_type_d data_block_type;
struct position_list_type_d {
long position;
struct position_list_type_d *next;
long position;
struct position_list_type_d *next;
};
typedef struct position_list_type_d position_list_type;
struct mail_index_type_d {
long recipient; /* who is this mail for? */
position_list_type *list_start; /* list of mail positions */
struct mail_index_type_d *next; /* link to next one */
long recipient; /* who is this mail for? */
position_list_type *list_start; /* list of mail positions */
struct mail_index_type_d *next; /* link to next one */
};
typedef struct mail_index_type_d mail_index_type;

View file

@ -1,19 +1,19 @@
/**
* @file modify.h
* Header file for the modify module.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* @todo This module is originally defined as 'Run-time modification of game
*
* @todo This module is originally defined as 'Run-time modification of game
* variables.' I believe it has digressed from the original intent. This
* header file is created to help redefine (over time) what the heck modify.h
* is. For example, publicly functions declared in comm.h but defined in modify.c
* should have their declarations moved here.
* should have their declarations moved here.
*
*/
#ifndef _MODIFY_H_

View file

@ -1,21 +1,21 @@
/**
* Copyright 2012 Joseph Arnusch
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
**/
/* Externals */

View file

@ -1,13 +1,13 @@
/**
* @file mud_event.h
* Mud_Event Header file.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This source code, which was not part of the CircleMUD legacy code,
* is attributed to:
* Copyright 2012 by Joseph Arnusch.
* Copyright 2012 by Joseph Arnusch.
*/
#ifndef _MUD_EVENT_H_
@ -30,17 +30,17 @@ typedef enum {
} event_id;
struct mud_event_list {
const char * event_name;
EVENTFUNC(*func);
int iEvent_Type;
const char * event_name;
EVENTFUNC(*func);
int iEvent_Type;
};
struct mud_event_data {
struct event * pEvent; /***< Pointer reference to the event */
event_id iId; /***< General ID reference */
void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */
char * sVariables; /***< String variable */
};
struct event * pEvent; /***< Pointer reference to the event */
event_id iId; /***< General ID reference */
void * pStruct; /***< Pointer to NULL, Descriptor, Character .... */
char * sVariables; /***< String variable */
};
/* Externals */
extern struct list_data * world_events;

View file

@ -14,11 +14,11 @@
#include "utils.h" /* for ACMD macro */
#define _OASISOLC 0x206 /* 2.0.6 */
#define _OASISOLC 0x206 /* 2.0.6 */
/* Used to determine what version of OasisOLC is installed.
Ex: #if _OASISOLC >= OASIS_VERSION(2,0,0) */
#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z))
#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z))
#define AEDIT_PERMISSION 999 /* arbitrary number higher than max zone vnum*/
#define HEDIT_PERMISSION 888 /* arbitrary number higher then max zone vnum*/
@ -28,22 +28,22 @@
to adjust these numbers if you ever add more. Note: Most of the NUM_ and
MAX_ limits have been moved to more appropriate locations. */
#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; }
#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; }
#define CHECK_VAR(var) ((var == YES) ? "Yes" : "No")
#define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */
/* Limit information. */
/* Name size increased due to larger colour/mxp codes. -Vatiken */
#define MAX_ROOM_NAME 150
#define MAX_MOB_NAME 100
#define MAX_OBJ_NAME 100
#define MAX_ROOM_DESC 2048
#define MAX_EXIT_DESC 256
#define MAX_EXTRA_DESC 512
#define MAX_MOB_DESC 1024
#define MAX_OBJ_DESC 512
#define MAX_DUPLICATES 100 /* when loading in zedit */
#define MAX_ROOM_NAME 150
#define MAX_MOB_NAME 100
#define MAX_OBJ_NAME 100
#define MAX_ROOM_DESC 2048
#define MAX_EXIT_DESC 256
#define MAX_EXTRA_DESC 512
#define MAX_MOB_DESC 1024
#define MAX_OBJ_DESC 512
#define MAX_DUPLICATES 100 /* when loading in zedit */
/* arbitrary limits - roll your own */
/* max weapon is 50d50 .. avg. 625 dam... */
@ -67,12 +67,12 @@
#define BIT_STRING_LENGTH 33
/* The data types for miscellaneous functions. */
#define OASIS_WLD 0
#define OASIS_MOB 1
#define OASIS_OBJ 2
#define OASIS_ZON 3
#define OASIS_EXI 4
#define OASIS_CFG 5
#define OASIS_WLD 0
#define OASIS_MOB 1
#define OASIS_OBJ 2
#define OASIS_ZON 3
#define OASIS_EXI 4
#define OASIS_CFG 5
/* Utilities exported from oasis.c. */
void cleanup_olc(struct descriptor_data *d, byte cleanup_type);
@ -84,30 +84,30 @@ void send_cannot_edit(struct char_data *ch, zone_vnum zone);
/* NO and YES are defined in utils.h. Removed from here. */
struct oasis_olc_data {
int mode; /* how to parse input */
zone_rnum zone_num; /* current zone */
room_vnum number; /* vnum of subject */
int value; /* mostly 'has changed' flag*/
char *storage; /* used for 'tedit' */
struct char_data *mob; /* used for 'medit' */
struct room_data *room; /* used for 'redit' */
struct obj_data *obj; /* used for 'oedit' */
struct zone_data *zone; /* used for 'zedit' */
struct shop_data *shop; /* used for 'sedit' */
struct config_data *config; /* used for 'cedit' */
struct aq_data *quest; /* used for 'qedit' */
struct extra_descr_data *desc; /* used in '[r|o|m]edit' */
struct social_messg *action; /* Aedit uses this one */
struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */
struct message_list *msg;
struct message_type *m_type;
int script_mode;
int trigger_position;
int item_type;
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
struct help_index_element*help; /* Hedit uses this */
int mode; /* how to parse input */
zone_rnum zone_num; /* current zone */
room_vnum number; /* vnum of subject */
int value; /* mostly 'has changed' flag*/
char *storage; /* used for 'tedit' */
struct char_data *mob; /* used for 'medit' */
struct room_data *room; /* used for 'redit' */
struct obj_data *obj; /* used for 'oedit' */
struct zone_data *zone; /* used for 'zedit' */
struct shop_data *shop; /* used for 'sedit' */
struct config_data *config; /* used for 'cedit' */
struct aq_data *quest; /* used for 'qedit' */
struct extra_descr_data *desc; /* used in '[r|o|m]edit' */
struct social_messg *action; /* Aedit uses this one */
struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */
struct message_list *msg;
struct message_type *m_type;
int script_mode;
int trigger_position;
int item_type;
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
struct help_index_element *help; /* Hedit uses this */
};
/* Exported globals. */
@ -115,22 +115,22 @@ extern const char *nrm, *grn, *cyn, *yel;
/* Descriptor access macros. */
#define OLC(d) ((d)->olc)
#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */
#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */
#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */
#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */
#define OLC_MODE(d) (OLC(d)->mode) /**< Parse input mode. */
#define OLC_NUM(d) (OLC(d)->number) /**< Room/Obj VNUM. */
#define OLC_VAL(d) (OLC(d)->value) /**< Scratch variable. */
#define OLC_ZNUM(d) (OLC(d)->zone_num) /**< Real zone number. */
#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */
#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */
#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */
#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */
#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */
#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */
#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
#define OLC_STORAGE(d) (OLC(d)->storage) /**< char pointer. */
#define OLC_ROOM(d) (OLC(d)->room) /**< Room structure. */
#define OLC_OBJ(d) (OLC(d)->obj) /**< Object structure. */
#define OLC_ZONE(d) (OLC(d)->zone) /**< Zone structure. */
#define OLC_MOB(d) (OLC(d)->mob) /**< Mob structure. */
#define OLC_SHOP(d) (OLC(d)->shop) /**< Shop structure. */
#define OLC_DESC(d) (OLC(d)->desc) /**< Extra description. */
#define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */
#define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */
#define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */
#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */
#define OLC_MSG_LIST(d) (OLC(d)->msg) /**< Message structure */
#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
@ -141,9 +141,9 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OLC_MSG(d) (OLC(d)->m_type)
/* Cleanup types. */
#define CLEANUP_ALL 1 /* Free the whole lot. */
#define CLEANUP_STRUCTS 2 /* Don't free strings. */
#define CLEANUP_CONFIG 3 /* Used just to send proper message. */
#define CLEANUP_ALL 1 /* Free the whole lot. */
#define CLEANUP_STRUCTS 2 /* Don't free strings. */
#define CLEANUP_CONFIG 3 /* Used just to send proper message. */
/* Submodes of AEDIT connectedness */
#define AEDIT_CONFIRM_SAVESTRING 0
@ -171,82 +171,82 @@ extern const char *nrm, *grn, *cyn, *yel;
#define AEDIT_OBJ_OTHERS_FOUND 22
/* Submodes of OEDIT connectedness. */
#define OEDIT_MAIN_MENU 1
#define OEDIT_KEYWORD 2
#define OEDIT_SHORTDESC 3
#define OEDIT_LONGDESC 4
#define OEDIT_ACTDESC 5
#define OEDIT_TYPE 6
#define OEDIT_EXTRAS 7
#define OEDIT_WEAR 8
#define OEDIT_WEIGHT 9
#define OEDIT_COST 10
#define OEDIT_COSTPERDAY 11
#define OEDIT_TIMER 12
#define OEDIT_VALUE_1 13
#define OEDIT_VALUE_2 14
#define OEDIT_VALUE_3 15
#define OEDIT_VALUE_4 16
#define OEDIT_APPLY 17
#define OEDIT_APPLYMOD 18
#define OEDIT_EXTRADESC_KEY 19
#define OEDIT_CONFIRM_SAVEDB 20
#define OEDIT_CONFIRM_SAVESTRING 21
#define OEDIT_PROMPT_APPLY 22
#define OEDIT_EXTRADESC_DESCRIPTION 23
#define OEDIT_EXTRADESC_MENU 24
#define OEDIT_LEVEL 25
#define OEDIT_PERM 26
#define OEDIT_MAIN_MENU 1
#define OEDIT_KEYWORD 2
#define OEDIT_SHORTDESC 3
#define OEDIT_LONGDESC 4
#define OEDIT_ACTDESC 5
#define OEDIT_TYPE 6
#define OEDIT_EXTRAS 7
#define OEDIT_WEAR 8
#define OEDIT_WEIGHT 9
#define OEDIT_COST 10
#define OEDIT_COSTPERDAY 11
#define OEDIT_TIMER 12
#define OEDIT_VALUE_1 13
#define OEDIT_VALUE_2 14
#define OEDIT_VALUE_3 15
#define OEDIT_VALUE_4 16
#define OEDIT_APPLY 17
#define OEDIT_APPLYMOD 18
#define OEDIT_EXTRADESC_KEY 19
#define OEDIT_CONFIRM_SAVEDB 20
#define OEDIT_CONFIRM_SAVESTRING 21
#define OEDIT_PROMPT_APPLY 22
#define OEDIT_EXTRADESC_DESCRIPTION 23
#define OEDIT_EXTRADESC_MENU 24
#define OEDIT_LEVEL 25
#define OEDIT_PERM 26
#define OEDIT_DELETE 27
#define OEDIT_COPY 28
/* Submodes of REDIT connectedness. */
#define REDIT_MAIN_MENU 1
#define REDIT_NAME 2
#define REDIT_DESC 3
#define REDIT_FLAGS 4
#define REDIT_SECTOR 5
#define REDIT_EXIT_MENU 6
#define REDIT_CONFIRM_SAVEDB 7
#define REDIT_CONFIRM_SAVESTRING 8
#define REDIT_EXIT_NUMBER 9
#define REDIT_EXIT_DESCRIPTION 10
#define REDIT_EXIT_KEYWORD 11
#define REDIT_EXIT_KEY 12
#define REDIT_EXIT_DOORFLAGS 13
#define REDIT_EXTRADESC_MENU 14
#define REDIT_EXTRADESC_KEY 15
#define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17
#define REDIT_COPY 18
#define REDIT_MAIN_MENU 1
#define REDIT_NAME 2
#define REDIT_DESC 3
#define REDIT_FLAGS 4
#define REDIT_SECTOR 5
#define REDIT_EXIT_MENU 6
#define REDIT_CONFIRM_SAVEDB 7
#define REDIT_CONFIRM_SAVESTRING 8
#define REDIT_EXIT_NUMBER 9
#define REDIT_EXIT_DESCRIPTION 10
#define REDIT_EXIT_KEYWORD 11
#define REDIT_EXIT_KEY 12
#define REDIT_EXIT_DOORFLAGS 13
#define REDIT_EXTRADESC_MENU 14
#define REDIT_EXTRADESC_KEY 15
#define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17
#define REDIT_COPY 18
/* Submodes of ZEDIT connectedness. */
#define ZEDIT_MAIN_MENU 0
#define ZEDIT_DELETE_ENTRY 1
#define ZEDIT_NEW_ENTRY 2
#define ZEDIT_CHANGE_ENTRY 3
#define ZEDIT_COMMAND_TYPE 4
#define ZEDIT_IF_FLAG 5
#define ZEDIT_ARG1 6
#define ZEDIT_ARG2 7
#define ZEDIT_ARG3 8
#define ZEDIT_ZONE_NAME 9
#define ZEDIT_ZONE_LIFE 10
#define ZEDIT_ZONE_BOT 11
#define ZEDIT_ZONE_TOP 12
#define ZEDIT_ZONE_RESET 13
#define ZEDIT_CONFIRM_SAVESTRING 14
#define ZEDIT_ZONE_BUILDERS 15
#define ZEDIT_SARG1 20
#define ZEDIT_SARG2 21
#define ZEDIT_ZONE_FLAGS 22
#define ZEDIT_LEVELS 23
#define ZEDIT_LEV_MIN 24
#define ZEDIT_LEV_MAX 25
#define ZEDIT_ZONE_CLAIM 26
#define ZEDIT_MAIN_MENU 0
#define ZEDIT_DELETE_ENTRY 1
#define ZEDIT_NEW_ENTRY 2
#define ZEDIT_CHANGE_ENTRY 3
#define ZEDIT_COMMAND_TYPE 4
#define ZEDIT_IF_FLAG 5
#define ZEDIT_ARG1 6
#define ZEDIT_ARG2 7
#define ZEDIT_ARG3 8
#define ZEDIT_ZONE_NAME 9
#define ZEDIT_ZONE_LIFE 10
#define ZEDIT_ZONE_BOT 11
#define ZEDIT_ZONE_TOP 12
#define ZEDIT_ZONE_RESET 13
#define ZEDIT_CONFIRM_SAVESTRING 14
#define ZEDIT_ZONE_BUILDERS 15
#define ZEDIT_SARG1 20
#define ZEDIT_SARG2 21
#define ZEDIT_ZONE_FLAGS 22
#define ZEDIT_LEVELS 23
#define ZEDIT_LEV_MIN 24
#define ZEDIT_LEV_MAX 25
#define ZEDIT_ZONE_CLAIM 26
/* Submodes of MEDIT connectedness. */
#define MEDIT_MAIN_MENU 0
#define MEDIT_MAIN_MENU 0
#define MEDIT_KEYWORD 1
#define MEDIT_S_DESC 2
#define MEDIT_L_DESC 3
@ -257,129 +257,129 @@ extern const char *nrm, *grn, *cyn, *yel;
#define MEDIT_STATS_MENU 8
/* Numerical responses. */
#define MEDIT_NUMERICAL_RESPONSE 10
#define MEDIT_SEX 11
#define MEDIT_HITROLL 12
#define MEDIT_DAMROLL 13
#define MEDIT_NDD 14
#define MEDIT_SDD 15
#define MEDIT_NUM_HP_DICE 16
#define MEDIT_SIZE_HP_DICE 17
#define MEDIT_ADD_HP 18
#define MEDIT_AC 19
#define MEDIT_EXP 20
#define MEDIT_GOLD 21
#define MEDIT_POS 22
#define MEDIT_DEFAULT_POS 23
#define MEDIT_ATTACK 24
#define MEDIT_LEVEL 25
#define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27
#define MEDIT_COPY 28
#define MEDIT_STR 29
#define MEDIT_INT 30
#define MEDIT_WIS 31
#define MEDIT_DEX 32
#define MEDIT_CON 33
#define MEDIT_CHA 34
#define MEDIT_PARA 35
#define MEDIT_ROD 36
#define MEDIT_PETRI 37
#define MEDIT_BREATH 38
#define MEDIT_SPELL 39
#define MEDIT_NUMERICAL_RESPONSE 10
#define MEDIT_SEX 11
#define MEDIT_HITROLL 12
#define MEDIT_DAMROLL 13
#define MEDIT_NDD 14
#define MEDIT_SDD 15
#define MEDIT_NUM_HP_DICE 16
#define MEDIT_SIZE_HP_DICE 17
#define MEDIT_ADD_HP 18
#define MEDIT_AC 19
#define MEDIT_EXP 20
#define MEDIT_GOLD 21
#define MEDIT_POS 22
#define MEDIT_DEFAULT_POS 23
#define MEDIT_ATTACK 24
#define MEDIT_LEVEL 25
#define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27
#define MEDIT_COPY 28
#define MEDIT_STR 29
#define MEDIT_INT 30
#define MEDIT_WIS 31
#define MEDIT_DEX 32
#define MEDIT_CON 33
#define MEDIT_CHA 34
#define MEDIT_PARA 35
#define MEDIT_ROD 36
#define MEDIT_PETRI 37
#define MEDIT_BREATH 38
#define MEDIT_SPELL 39
/* Submodes of SEDIT connectedness. */
#define SEDIT_MAIN_MENU 0
#define SEDIT_CONFIRM_SAVESTRING 1
#define SEDIT_NOITEM1 2
#define SEDIT_NOITEM2 3
#define SEDIT_NOCASH1 4
#define SEDIT_NOCASH2 5
#define SEDIT_NOBUY 6
#define SEDIT_BUY 7
#define SEDIT_SELL 8
#define SEDIT_PRODUCTS_MENU 11
#define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14
#define SEDIT_COPY 15
#define SEDIT_MAIN_MENU 0
#define SEDIT_CONFIRM_SAVESTRING 1
#define SEDIT_NOITEM1 2
#define SEDIT_NOITEM2 3
#define SEDIT_NOCASH1 4
#define SEDIT_NOCASH2 5
#define SEDIT_NOBUY 6
#define SEDIT_BUY 7
#define SEDIT_SELL 8
#define SEDIT_PRODUCTS_MENU 11
#define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14
#define SEDIT_COPY 15
#define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22
#define SEDIT_CLOSE1 23
#define SEDIT_CLOSE2 24
#define SEDIT_KEEPER 25
#define SEDIT_BUY_PROFIT 26
#define SEDIT_SELL_PROFIT 27
#define SEDIT_TYPE_MENU 29
#define SEDIT_DELETE_TYPE 30
#define SEDIT_DELETE_PRODUCT 31
#define SEDIT_NEW_PRODUCT 32
#define SEDIT_DELETE_ROOM 33
#define SEDIT_NEW_ROOM 34
#define SEDIT_SHOP_FLAGS 35
#define SEDIT_NOTRADE 36
#define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22
#define SEDIT_CLOSE1 23
#define SEDIT_CLOSE2 24
#define SEDIT_KEEPER 25
#define SEDIT_BUY_PROFIT 26
#define SEDIT_SELL_PROFIT 27
#define SEDIT_TYPE_MENU 29
#define SEDIT_DELETE_TYPE 30
#define SEDIT_DELETE_PRODUCT 31
#define SEDIT_NEW_PRODUCT 32
#define SEDIT_DELETE_ROOM 33
#define SEDIT_NEW_ROOM 34
#define SEDIT_SHOP_FLAGS 35
#define SEDIT_NOTRADE 36
/* Submodes of CEDIT connectedness. */
#define CEDIT_MAIN_MENU 0
#define CEDIT_CONFIRM_SAVESTRING 1
#define CEDIT_GAME_OPTIONS_MENU 2
#define CEDIT_CRASHSAVE_OPTIONS_MENU 3
#define CEDIT_OPERATION_OPTIONS_MENU 4
#define CEDIT_DISP_EXPERIENCE_MENU 5
#define CEDIT_ROOM_NUMBERS_MENU 6
#define CEDIT_AUTOWIZ_OPTIONS_MENU 7
#define CEDIT_OK 8
#define CEDIT_HUH 9
#define CEDIT_NOPERSON 10
#define CEDIT_NOEFFECT 11
#define CEDIT_DFLT_IP 12
#define CEDIT_DFLT_DIR 13
#define CEDIT_LOGNAME 14
#define CEDIT_MENU 15
#define CEDIT_WELC_MESSG 16
#define CEDIT_START_MESSG 17
#define CEDIT_MAIN_MENU 0
#define CEDIT_CONFIRM_SAVESTRING 1
#define CEDIT_GAME_OPTIONS_MENU 2
#define CEDIT_CRASHSAVE_OPTIONS_MENU 3
#define CEDIT_OPERATION_OPTIONS_MENU 4
#define CEDIT_DISP_EXPERIENCE_MENU 5
#define CEDIT_ROOM_NUMBERS_MENU 6
#define CEDIT_AUTOWIZ_OPTIONS_MENU 7
#define CEDIT_OK 8
#define CEDIT_HUH 9
#define CEDIT_NOPERSON 10
#define CEDIT_NOEFFECT 11
#define CEDIT_DFLT_IP 12
#define CEDIT_DFLT_DIR 13
#define CEDIT_LOGNAME 14
#define CEDIT_MENU 15
#define CEDIT_WELC_MESSG 16
#define CEDIT_START_MESSG 17
/* Numerical responses. */
#define CEDIT_NUMERICAL_RESPONSE 20
#define CEDIT_LEVEL_CAN_SHOUT 21
#define CEDIT_HOLLER_MOVE_COST 22
#define CEDIT_TUNNEL_SIZE 23
#define CEDIT_MAX_EXP_GAIN 24
#define CEDIT_MAX_EXP_LOSS 25
#define CEDIT_MAX_NPC_CORPSE_TIME 26
#define CEDIT_MAX_PC_CORPSE_TIME 27
#define CEDIT_IDLE_VOID 28
#define CEDIT_IDLE_RENT_TIME 29
#define CEDIT_IDLE_MAX_LEVEL 30
#define CEDIT_DTS_ARE_DUMPS 31
#define CEDIT_LOAD_INTO_INVENTORY 32
#define CEDIT_TRACK_THROUGH_DOORS 33
#define CEDIT_NO_MORT_TO_IMMORT 34
#define CEDIT_MAX_OBJ_SAVE 35
#define CEDIT_MIN_RENT_COST 36
#define CEDIT_AUTOSAVE_TIME 37
#define CEDIT_CRASH_FILE_TIMEOUT 38
#define CEDIT_RENT_FILE_TIMEOUT 39
#define CEDIT_MORTAL_START_ROOM 40
#define CEDIT_IMMORT_START_ROOM 41
#define CEDIT_FROZEN_START_ROOM 42
#define CEDIT_DONATION_ROOM_1 43
#define CEDIT_DONATION_ROOM_2 44
#define CEDIT_DONATION_ROOM_3 45
#define CEDIT_DFLT_PORT 46
#define CEDIT_MAX_PLAYING 47
#define CEDIT_MAX_FILESIZE 48
#define CEDIT_MAX_BAD_PWS 49
#define CEDIT_SITEOK_EVERYONE 50
#define CEDIT_NAMESERVER_IS_SLOW 51
#define CEDIT_USE_AUTOWIZ 52
#define CEDIT_MIN_WIZLIST_LEV 53
#define CEDIT_MAP_OPTION 54
#define CEDIT_MAP_SIZE 55
#define CEDIT_MINIMAP_SIZE 56
#define CEDIT_DEBUG_MODE 57
#define CEDIT_NUMERICAL_RESPONSE 20
#define CEDIT_LEVEL_CAN_SHOUT 21
#define CEDIT_HOLLER_MOVE_COST 22
#define CEDIT_TUNNEL_SIZE 23
#define CEDIT_MAX_EXP_GAIN 24
#define CEDIT_MAX_EXP_LOSS 25
#define CEDIT_MAX_NPC_CORPSE_TIME 26
#define CEDIT_MAX_PC_CORPSE_TIME 27
#define CEDIT_IDLE_VOID 28
#define CEDIT_IDLE_RENT_TIME 29
#define CEDIT_IDLE_MAX_LEVEL 30
#define CEDIT_DTS_ARE_DUMPS 31
#define CEDIT_LOAD_INTO_INVENTORY 32
#define CEDIT_TRACK_THROUGH_DOORS 33
#define CEDIT_NO_MORT_TO_IMMORT 34
#define CEDIT_MAX_OBJ_SAVE 35
#define CEDIT_MIN_RENT_COST 36
#define CEDIT_AUTOSAVE_TIME 37
#define CEDIT_CRASH_FILE_TIMEOUT 38
#define CEDIT_RENT_FILE_TIMEOUT 39
#define CEDIT_MORTAL_START_ROOM 40
#define CEDIT_IMMORT_START_ROOM 41
#define CEDIT_FROZEN_START_ROOM 42
#define CEDIT_DONATION_ROOM_1 43
#define CEDIT_DONATION_ROOM_2 44
#define CEDIT_DONATION_ROOM_3 45
#define CEDIT_DFLT_PORT 46
#define CEDIT_MAX_PLAYING 47
#define CEDIT_MAX_FILESIZE 48
#define CEDIT_MAX_BAD_PWS 49
#define CEDIT_SITEOK_EVERYONE 50
#define CEDIT_NAMESERVER_IS_SLOW 51
#define CEDIT_USE_AUTOWIZ 52
#define CEDIT_MIN_WIZLIST_LEV 53
#define CEDIT_MAP_OPTION 54
#define CEDIT_MAP_SIZE 55
#define CEDIT_MINIMAP_SIZE 56
#define CEDIT_DEBUG_MODE 57
/* Hedit Submodes of connectedness. */
#define HEDIT_CONFIRM_SAVESTRING 0

View file

@ -1,7 +1,7 @@
/**
* @file pfdefaults.h
* ASCII player file defaults.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
@ -10,56 +10,56 @@
#ifndef _PFDEFAULTS_H_
#define _PFDEFAULTS_H_
/* WARNING: Do not change the values below if you have existing ascii player
/* WARNING: Do not change the values below if you have existing ascii player
* files you don't want to screw up. */
#define PFDEF_SEX 0
#define PFDEF_CLASS 0
#define PFDEF_LEVEL 0
#define PFDEF_HEIGHT 0
#define PFDEF_WEIGHT 0
#define PFDEF_ALIGNMENT 0
#define PFDEF_PLRFLAGS 0
#define PFDEF_AFFFLAGS 0
#define PFDEF_SAVETHROW 0
#define PFDEF_LOADROOM 0
#define PFDEF_INVISLEV 0
#define PFDEF_FREEZELEV 0
#define PFDEF_WIMPLEV 0
#define PFDEF_CONDITION 0
#define PFDEF_BADPWS 0
#define PFDEF_PREFFLAGS 0
#define PFDEF_PRACTICES 0
#define PFDEF_GOLD 0
#define PFDEF_BANK 0
#define PFDEF_EXP 0
#define PFDEF_HITROLL 0
#define PFDEF_DAMROLL 0
#define PFDEF_AC 0
#define PFDEF_STR 0
#define PFDEF_STRADD 0
#define PFDEF_DEX 0
#define PFDEF_INT 0
#define PFDEF_WIS 0
#define PFDEF_CON 0
#define PFDEF_CHA 0
#define PFDEF_HIT 0
#define PFDEF_MAXHIT 0
#define PFDEF_MANA 0
#define PFDEF_MAXMANA 0
#define PFDEF_MOVE 0
#define PFDEF_MAXMOVE 0
#define PFDEF_HUNGER 0
#define PFDEF_THIRST 0
#define PFDEF_DRUNK 0
#define PFDEF_OLC NOWHERE
#define PFDEF_PAGELENGTH 22
#define PFDEF_SCREENWIDTH 80
#define PFDEF_QUESTPOINTS 0
#define PFDEF_QUESTCOUNT 0
#define PFDEF_COMPQUESTS 0
#define PFDEF_CURRQUEST NOTHING
#define PFDEF_LASTMOTD 0
#define PFDEF_LASTNEWS 0
#define PFDEF_SEX 0
#define PFDEF_CLASS 0
#define PFDEF_LEVEL 0
#define PFDEF_HEIGHT 0
#define PFDEF_WEIGHT 0
#define PFDEF_ALIGNMENT 0
#define PFDEF_PLRFLAGS 0
#define PFDEF_AFFFLAGS 0
#define PFDEF_SAVETHROW 0
#define PFDEF_LOADROOM 0
#define PFDEF_INVISLEV 0
#define PFDEF_FREEZELEV 0
#define PFDEF_WIMPLEV 0
#define PFDEF_CONDITION 0
#define PFDEF_BADPWS 0
#define PFDEF_PREFFLAGS 0
#define PFDEF_PRACTICES 0
#define PFDEF_GOLD 0
#define PFDEF_BANK 0
#define PFDEF_EXP 0
#define PFDEF_HITROLL 0
#define PFDEF_DAMROLL 0
#define PFDEF_AC 0
#define PFDEF_STR 0
#define PFDEF_STRADD 0
#define PFDEF_DEX 0
#define PFDEF_INT 0
#define PFDEF_WIS 0
#define PFDEF_CON 0
#define PFDEF_CHA 0
#define PFDEF_HIT 0
#define PFDEF_MAXHIT 0
#define PFDEF_MANA 0
#define PFDEF_MAXMANA 0
#define PFDEF_MOVE 0
#define PFDEF_MAXMOVE 0
#define PFDEF_HUNGER 0
#define PFDEF_THIRST 0
#define PFDEF_DRUNK 0
#define PFDEF_OLC NOWHERE
#define PFDEF_PAGELENGTH 22
#define PFDEF_SCREENWIDTH 80
#define PFDEF_QUESTPOINTS 0
#define PFDEF_QUESTCOUNT 0
#define PFDEF_COMPQUESTS 0
#define PFDEF_CURRQUEST NOTHING
#define PFDEF_LASTMOTD 0
#define PFDEF_LASTNEWS 0
#endif /* _PFDEFAULTS_H_ */

13
src/prefedit.h Executable file → Normal file
View file

@ -10,13 +10,12 @@
**************************************************************************/
/* Toggle structure held for OLC purposes */
struct prefs_data
{
struct char_data *ch; /* Pointer to char being edited */
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
int wimp_level; /* Copy of player's wimp level */
int page_length; /* Copy of player's pagelength */
int screen_width; /* Copy of player's screenwidth */
struct prefs_data {
struct char_data *ch; /* Pointer to char being edited */
int pref_flags[PR_ARRAY_MAX]; /* Copy of player's pref flags */
int wimp_level; /* Copy of player's wimp level */
int page_length; /* Copy of player's pagelength */
int screen_width; /* Copy of player's screenwidth */
};
/* Prefedit utility macros */

View file

@ -71,149 +71,142 @@ typedef struct descriptor_data descriptor_t;
Types.
******************************************************************************/
typedef enum
{
false,
true
typedef enum {
false,
true
} bool_t;
typedef enum
{
eUNKNOWN,
eNO,
eSOMETIMES,
eYES
typedef enum {
eUNKNOWN,
eNO,
eSOMETIMES,
eYES
} support_t;
typedef enum
{
eMSDP_NONE = -1, /* This must always be first. */
typedef enum {
eMSDP_NONE = -1, /* This must always be first. */
/* General */
eMSDP_CHARACTER_NAME,
eMSDP_SERVER_ID,
eMSDP_SERVER_TIME,
eMSDP_SNIPPET_VERSION,
/* General */
eMSDP_CHARACTER_NAME,
eMSDP_SERVER_ID,
eMSDP_SERVER_TIME,
eMSDP_SNIPPET_VERSION,
/* Character */
eMSDP_AFFECTS,
eMSDP_ALIGNMENT,
eMSDP_EXPERIENCE,
eMSDP_EXPERIENCE_MAX,
eMSDP_EXPERIENCE_TNL,
eMSDP_HEALTH,
eMSDP_HEALTH_MAX,
eMSDP_LEVEL,
eMSDP_RACE,
eMSDP_CLASS,
eMSDP_MANA,
eMSDP_MANA_MAX,
eMSDP_WIMPY,
eMSDP_PRACTICE,
eMSDP_MONEY,
eMSDP_MOVEMENT,
eMSDP_MOVEMENT_MAX,
eMSDP_HITROLL,
eMSDP_DAMROLL,
eMSDP_AC,
eMSDP_STR,
eMSDP_INT,
eMSDP_WIS,
eMSDP_DEX,
eMSDP_CON,
eMSDP_STR_PERM,
eMSDP_INT_PERM,
eMSDP_WIS_PERM,
eMSDP_DEX_PERM,
eMSDP_CON_PERM,
/* Character */
eMSDP_AFFECTS,
eMSDP_ALIGNMENT,
eMSDP_EXPERIENCE,
eMSDP_EXPERIENCE_MAX,
eMSDP_EXPERIENCE_TNL,
eMSDP_HEALTH,
eMSDP_HEALTH_MAX,
eMSDP_LEVEL,
eMSDP_RACE,
eMSDP_CLASS,
eMSDP_MANA,
eMSDP_MANA_MAX,
eMSDP_WIMPY,
eMSDP_PRACTICE,
eMSDP_MONEY,
eMSDP_MOVEMENT,
eMSDP_MOVEMENT_MAX,
eMSDP_HITROLL,
eMSDP_DAMROLL,
eMSDP_AC,
eMSDP_STR,
eMSDP_INT,
eMSDP_WIS,
eMSDP_DEX,
eMSDP_CON,
eMSDP_STR_PERM,
eMSDP_INT_PERM,
eMSDP_WIS_PERM,
eMSDP_DEX_PERM,
eMSDP_CON_PERM,
/* Combat */
eMSDP_OPPONENT_HEALTH,
eMSDP_OPPONENT_HEALTH_MAX,
eMSDP_OPPONENT_LEVEL,
eMSDP_OPPONENT_NAME,
/* Combat */
eMSDP_OPPONENT_HEALTH,
eMSDP_OPPONENT_HEALTH_MAX,
eMSDP_OPPONENT_LEVEL,
eMSDP_OPPONENT_NAME,
/* World */
eMSDP_AREA_NAME,
eMSDP_ROOM_EXITS,
eMSDP_ROOM_NAME,
eMSDP_ROOM_VNUM,
eMSDP_WORLD_TIME,
/* World */
eMSDP_AREA_NAME,
eMSDP_ROOM_EXITS,
eMSDP_ROOM_NAME,
eMSDP_ROOM_VNUM,
eMSDP_WORLD_TIME,
/* Configuration */
eMSDP_CLIENT_ID,
eMSDP_CLIENT_VERSION,
eMSDP_PLUGIN_ID,
eMSDP_ANSI_COLORS,
eMSDP_XTERM_256_COLORS,
eMSDP_UTF_8,
eMSDP_SOUND,
eMSDP_MXP,
/* Configuration */
eMSDP_CLIENT_ID,
eMSDP_CLIENT_VERSION,
eMSDP_PLUGIN_ID,
eMSDP_ANSI_COLORS,
eMSDP_XTERM_256_COLORS,
eMSDP_UTF_8,
eMSDP_SOUND,
eMSDP_MXP,
/* GUI variables */
eMSDP_BUTTON_1,
eMSDP_BUTTON_2,
eMSDP_BUTTON_3,
eMSDP_BUTTON_4,
eMSDP_BUTTON_5,
eMSDP_GAUGE_1,
eMSDP_GAUGE_2,
eMSDP_GAUGE_3,
eMSDP_GAUGE_4,
eMSDP_GAUGE_5,
/* GUI variables */
eMSDP_BUTTON_1,
eMSDP_BUTTON_2,
eMSDP_BUTTON_3,
eMSDP_BUTTON_4,
eMSDP_BUTTON_5,
eMSDP_GAUGE_1,
eMSDP_GAUGE_2,
eMSDP_GAUGE_3,
eMSDP_GAUGE_4,
eMSDP_GAUGE_5,
eMSDP_MAX /* This must always be last */
eMSDP_MAX /* This must always be last */
} variable_t;
typedef struct
{
variable_t Variable; /* The enum type of this variable */
const char *pName; /* The string name of this variable */
bool_t bString; /* Is this variable a string or a number? */
bool_t bConfigurable; /* Can it be configured by the client? */
bool_t bWriteOnce; /* Can only set this variable once */
bool_t bGUI; /* It's a special GUI configuration variable */
int Min; /* The minimum valid value or string length */
int Max; /* The maximum valid value or string length */
int Default; /* The default value for a number */
const char *pDefault; /* The default value for a string */
typedef struct {
variable_t Variable; /* The enum type of this variable */
const char *pName; /* The string name of this variable */
bool_t bString; /* Is this variable a string or a number? */
bool_t bConfigurable; /* Can it be configured by the client? */
bool_t bWriteOnce; /* Can only set this variable once */
bool_t bGUI; /* It's a special GUI configuration variable */
int Min; /* The minimum valid value or string length */
int Max; /* The maximum valid value or string length */
int Default; /* The default value for a number */
const char *pDefault; /* The default value for a string */
} variable_name_t;
typedef struct
{
bool_t bReport; /* Is this variable being reported? */
bool_t bDirty; /* Does this variable need to be sent again? */
int ValueInt; /* The numeric value of the variable */
char *pValueString; /* The string value of the variable */
typedef struct {
bool_t bReport; /* Is this variable being reported? */
bool_t bDirty; /* Does this variable need to be sent again? */
int ValueInt; /* The numeric value of the variable */
char *pValueString; /* The string value of the variable */
} MSDP_t;
typedef struct
{
const char *pName; /* The name of the MSSP variable */
const char *pValue; /* The value of the MSSP variable */
const char *(*pFunction)(void); /* Optional function to return the value */
typedef struct {
const char *pName; /* The name of the MSSP variable */
const char *pValue; /* The value of the MSSP variable */
const char *(*pFunction)(void); /* Optional function to return the value */
} MSSP_t;
typedef struct
{
int WriteOOB; /* Used internally to indicate OOB data */
bool_t bIACMode; /* Current mode - deals with broken packets */
bool_t bNegotiated; /* Indicates client successfully negotiated */
bool_t bBlockMXP; /* Used internally based on MXP version */
bool_t bTTYPE; /* The client supports TTYPE */
bool_t bNAWS; /* The client supports NAWS */
bool_t bCHARSET; /* The client supports CHARSET */
bool_t bMSDP; /* The client supports MSDP */
bool_t bATCP; /* The client supports ATCP */
bool_t bMSP; /* The client supports MSP */
bool_t bMXP; /* The client supports MXP */
bool_t bMCCP; /* The client supports MCCP */
support_t b256Support; /* The client supports XTerm 256 colors */
int ScreenWidth; /* The client's screen width */
int ScreenHeight; /* The client's screen height */
char *pMXPVersion; /* The version of MXP supported */
char *pLastTTYPE; /* Used for the cyclic TTYPE check */
MSDP_t **pVariables; /* The MSDP variables */
typedef struct {
int WriteOOB; /* Used internally to indicate OOB data */
bool_t bIACMode; /* Current mode - deals with broken packets */
bool_t bNegotiated; /* Indicates client successfully negotiated */
bool_t bBlockMXP; /* Used internally based on MXP version */
bool_t bTTYPE; /* The client supports TTYPE */
bool_t bNAWS; /* The client supports NAWS */
bool_t bCHARSET; /* The client supports CHARSET */
bool_t bMSDP; /* The client supports MSDP */
bool_t bATCP; /* The client supports ATCP */
bool_t bMSP; /* The client supports MSP */
bool_t bMXP; /* The client supports MXP */
bool_t bMCCP; /* The client supports MCCP */
support_t b256Support; /* The client supports XTerm 256 colors */
int ScreenWidth; /* The client's screen width */
int ScreenHeight; /* The client's screen height */
char *pMXPVersion; /* The version of MXP supported */
char *pLastTTYPE; /* Used for the cyclic TTYPE check */
MSDP_t **pVariables; /* The MSDP variables */
} protocol_t;
/******************************************************************************
@ -222,55 +215,55 @@ typedef struct
/* Function: ProtocolCreate
*
* Creates, initialises and returns a structure containing protocol data for a
* Creates, initialises and returns a structure containing protocol data for a
* single user. This should be called when the descriptor is initialised.
*/
protocol_t *ProtocolCreate( void );
/* Function: ProtocolDestroy
*
* Frees the memory allocated by the specified structure. This should be
* Frees the memory allocated by the specified structure. This should be
* called just before a descriptor is freed.
*/
void ProtocolDestroy( protocol_t *apProtocol );
/* Function: ProtocolNegotiate
*
* Negatiates with the client to see which protocols the user supports, and
* stores the results in the user's protocol structure. Call this when you
* wish to perform negotiation (but only call it once). It is usually called
* either immediately after the user has connected, or just after they have
* Negatiates with the client to see which protocols the user supports, and
* stores the results in the user's protocol structure. Call this when you
* wish to perform negotiation (but only call it once). It is usually called
* either immediately after the user has connected, or just after they have
* entered the game.
*/
void ProtocolNegotiate( descriptor_t *apDescriptor );
/* Function: ProtocolInput
*
* Extracts any negotiation sequences from the input buffer, and passes back
* whatever is left for the mud to parse normally. Call this after data has
* Extracts any negotiation sequences from the input buffer, and passes back
* whatever is left for the mud to parse normally. Call this after data has
* been read into the input buffer, before it is used for anything else.
*/
/* MUD Primary Colours */
extern const char * RGBone;
extern const char * RGBtwo;
extern const char * RGBthree;
extern const char * RGBthree;
ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char *apOut );
/* Function: ProtocolOutput
*
* This function takes a string, applies colour codes to it, and returns the
* This function takes a string, applies colour codes to it, and returns the
* result. It should be called just before writing to the output buffer.
*
* The special character used to indicate the start of a colour sequence is
* '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include
* in help files (as you can literally press the tab key) as well as strings
* (where you can use \t instead). However players can't send tabs (on most
*
* The special character used to indicate the start of a colour sequence is
* '\t' (i.e., a tab, or ASCII character 9). This makes it easy to include
* in help files (as you can literally press the tab key) as well as strings
* (where you can use \t instead). However players can't send tabs (on most
* muds at least), so this stops them from sending colour codes to each other.
*
*
* The predefined colours are:
*
*
* n: no colour (switches colour off)
* r: dark red R: bright red
* g: dark green G: bright green
@ -280,41 +273,41 @@ ssize_t ProtocolInput( descriptor_t *apDescriptor, char *apData, int aSize, char
* c: dark cyan C: bright cyan
* w: dark white W: bright white
* o: dark orange O: bright orange
*
* So for example "This is \tOorange\tn." will colour the word "orange". You
*
* So for example "This is \tOorange\tn." will colour the word "orange". You
* can add more colours yourself just by updating the switch statement.
*
* It's also possible to explicitly specify an RGB value, by including the four
*
* It's also possible to explicitly specify an RGB value, by including the four
* character colour sequence (as used by ColourRGB) within square brackets, eg:
*
*
* This is a \t[F010]very dark green foreground\tn.
*
*
* The square brackets can also be used to send unicode characters, like this:
*
*
* Boat: \t[U9973/B]
* Rook: \t[U9814/C]
*
* For example you might use 'B' to represent a boat on your ASCII map, or a 'C'
* to represent a castle - but players with UTF-8 support would actually see the
*
* For example you might use 'B' to represent a boat on your ASCII map, or a 'C'
* to represent a castle - but players with UTF-8 support would actually see the
* appropriate unicode characters for a boat or a rook (the chess playing piece).
*
* The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal
* number of the unicode character (see http://www.unicode.org/charts), then '/'
* followed by the ASCII character/s that should be used if the client doesn't
* support UTF-8. The ASCII sequence can be up to 7 characters in length, but in
* most cases you'll only want it to be one or two characters (so that it has the
*
* The exact syntax is '\t' (tab), '[', 'U' (indicating unicode), then the decimal
* number of the unicode character (see http://www.unicode.org/charts), then '/'
* followed by the ASCII character/s that should be used if the client doesn't
* support UTF-8. The ASCII sequence can be up to 7 characters in length, but in
* most cases you'll only want it to be one or two characters (so that it has the
* same alignment as the unicode character).
*
* Finally, this function also allows you to embed MXP tags. The easiest and
*
* Finally, this function also allows you to embed MXP tags. The easiest and
* safest way to do this is via the ( and ) bracket options:
*
*
* From here, you can walk \t(north\t).
*
*
* However it's also possible to include more explicit MSP tags, like this:
*
*
* The baker offers to sell you a \t<send href="buy pie">pie\t</send>.
*
* Note that the MXP tags will automatically be removed if the user doesn't
*
* Note that the MXP tags will automatically be removed if the user doesn't
* support MXP, but it's very important you remember to close the tags.
*/
const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int *apLength );
@ -325,24 +318,24 @@ const char *ProtocolOutput( descriptor_t *apDescriptor, const char *apData, int
/* Function: CopyoverGet
*
* Returns the protocol values stored as a short string. If your mud uses
* copyover, you should call this for each player and insert it after their
* Returns the protocol values stored as a short string. If your mud uses
* copyover, you should call this for each player and insert it after their
* name in the temporary text file.
*/
const char *CopyoverGet( descriptor_t *apDescriptor );
/* Function: CopyoverSet
*
* Call this function for each player after a copyover, passing in the string
* you added to the temporary text file. This will restore their protocol
* Call this function for each player after a copyover, passing in the string
* you added to the temporary text file. This will restore their protocol
* settings, and automatically renegotiate MSDP/ATCP.
*
* Note that the client doesn't recognise a copyover, and therefore refuses to
* renegotiate certain telnet options (to avoid loops), so they really need to
* be saved. However MSDP/ATCP is handled through scripts, and we don't want
*
* Note that the client doesn't recognise a copyover, and therefore refuses to
* renegotiate certain telnet options (to avoid loops), so they really need to
* be saved. However MSDP/ATCP is handled through scripts, and we don't want
* to have to save all of the REPORT variables, so it's easier to renegotiate.
*
* Client name and version are not saved. It is recommended you save these in
*
* Client name and version are not saved. It is recommended you save these in
* the player file, as then you can grep to collect client usage stats.
*/
void CopyoverSet( descriptor_t *apDescriptor, const char *apData );
@ -353,33 +346,33 @@ void CopyoverSet( descriptor_t *apDescriptor, const char *apData );
/* Function: MSDPUpdate
*
* Call this regularly (I'd suggest at least once per second) to flush every
* dirty MSDP variable that has been requested by the client via REPORT. This
* Call this regularly (I'd suggest at least once per second) to flush every
* dirty MSDP variable that has been requested by the client via REPORT. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPUpdate( descriptor_t *apDescriptor );
/* Function: MSDPFlush
*
* Works like MSDPUpdate(), except only flushes a specific variable. The
* Works like MSDPUpdate(), except only flushes a specific variable. The
* variable will only actually be sent if it's both reported and dirty.
*
* Call this function after setting a variable if you want it to be reported
*
* Call this function after setting a variable if you want it to be reported
* immediately, instead of on the next update.
*/
void MSDPFlush( descriptor_t *apDescriptor, variable_t aMSDP );
/* Function: MSDPSend
*
* Send the specified MSDP variable to the player. You shouldn't ever really
* need to do this manually, except perhaps when debugging something. This
* Send the specified MSDP variable to the player. You shouldn't ever really
* need to do this manually, except perhaps when debugging something. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPSend( descriptor_t *apDescriptor, variable_t aMSDP );
/* Function: MSDPSendPair
*
* Send the specified strings to the user as an MSDP variable/value pair. This
* Send the specified strings to the user as an MSDP variable/value pair. This
* will automatically use ATCP instead if MSDP is not supported by the client.
*/
void MSDPSendPair( descriptor_t *apDescriptor, const char *apVariable, const char *apValue );
@ -394,20 +387,20 @@ void MSDPSendList( descriptor_t *apDescriptor, const char *apVariable, const cha
/* Function: MSDPSetNumber
*
* Call this whenever an MSDP integer variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* Call this whenever an MSDP integer variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* set in one place you can just move its MDSPSend() call to there.
*
*
* You can also this function for bools, chars, enums, short ints, etc.
*/
void MSDPSetNumber( descriptor_t *apDescriptor, variable_t aMSDP, int aValue );
/* Function: MSDPSetString
*
* Call this whenever an MSDP string variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* Call this whenever an MSDP string variable has changed. The easiest
* approach is to send every MSDP variable within an update function (and
* this is what the snippet does by default), but if the variable is only
* set in one place you can just move its MDSPSend() call to there.
*/
void MSDPSetString( descriptor_t *apDescriptor, variable_t aMSDP, const char *apValue );
@ -440,7 +433,7 @@ void MSDPSetArray( descriptor_t *apDescriptor, variable_t aMSDP, const char *apV
/* Function: MSSPSetPlayers
*
* Stores the current number of players. The first time it's called, it also
* Stores the current number of players. The first time it's called, it also
* stores the uptime.
*/
void MSSPSetPlayers( int aPlayers );
@ -451,17 +444,17 @@ void MSSPSetPlayers( int aPlayers );
/* Function: MXPCreateTag
*
* Puts the specified tag into a secure line, if MXP is supported. If the user
* doesn't support MXP they will see the string unchanged, meaning they will
* see the <send> tags or whatever. You should therefore check for support and
* provide a different sequence for other users, or better yet just embed MXP
* Puts the specified tag into a secure line, if MXP is supported. If the user
* doesn't support MXP they will see the string unchanged, meaning they will
* see the <send> tags or whatever. You should therefore check for support and
* provide a different sequence for other users, or better yet just embed MXP
* tags for the ProtocolOutput() function.
*/
const char *MXPCreateTag( descriptor_t *apDescriptor, const char *apTag );
/* Function: MXPSendTag
*
* This works like MXPCreateTag, but instead of returning the string it sends
* This works like MXPCreateTag, but instead of returning the string it sends
* it directly to the user. This is mainly useful for the <VERSION> tag.
*/
void MXPSendTag( descriptor_t *apDescriptor, const char *apTag );
@ -472,8 +465,8 @@ void MXPSendTag( descriptor_t *apDescriptor, const char *apTag );
/* Function: SoundSend
*
* Sends the specified sound trigger to the player, using MSDP or ATCP if
* supported, MSP if not. The trigger string itself is a relative path and
* Sends the specified sound trigger to the player, using MSDP or ATCP if
* supported, MSP if not. The trigger string itself is a relative path and
* filename, eg: SoundSend( pDesc, "monster/growl.wav" );
*/
void SoundSend( descriptor_t *apDescriptor, const char *apTrigger );
@ -484,17 +477,17 @@ void SoundSend( descriptor_t *apDescriptor, const char *apTrigger );
/* Function: ColourRGB
*
* Returns a colour as an escape code, based on the RGB value provided. The
* string must be four characters, where the first is either 'f' for foreground
* or 'b' for background (case insensitive), and the other three characters are
* Returns a colour as an escape code, based on the RGB value provided. The
* string must be four characters, where the first is either 'f' for foreground
* or 'b' for background (case insensitive), and the other three characters are
* numeric digits in the range 0 to 5, representing red, green and blue.
*
* For example "F500" returns a red foreground, "B530" an orange background,
*
* For example "F500" returns a red foreground, "B530" an orange background,
* and so on. An invalid colour will clear whatever you've set previously.
*
* If the user doesn't support XTerm 256 colours, this function will return the
*
* If the user doesn't support XTerm 256 colours, this function will return the
* best-fit ANSI colour instead.
*
*
* If you wish to embed colours in strings, use ProtocolOutput().
*/
const char *ColourRGB( descriptor_t *apDescriptor, const char *apRGB );
@ -511,7 +504,7 @@ char *UnicodeGet( int aValue );
/* Function: UnicodeAdd
*
* Adds the UTF-8 sequence for the specified unicode value onto the end of the
* Adds the UTF-8 sequence for the specified unicode value onto the end of the
* string, without adding a NUL character at the end.
*/
void UnicodeAdd( char **apString, int aValue );

File diff suppressed because it is too large Load diff

View file

@ -36,24 +36,24 @@
#define NUM_AQ_FLAGS 1
/* Main quest struct ************************************************** */
struct aq_data {
qst_vnum vnum; /* Virtual nr of the quest */
char *name; /* For qlist and the sort */
char *desc; /* Description of the quest */
char *info; /* Message displayed when accepted */
char *done; /* Message displayed when completed */
char *quit; /* Message displayed when quit quest */
long flags; /* Flags (repeatable, etc */
int type; /* Quest type */
mob_vnum qm; /* questmaster offering quest */
int target; /* Target value */
obj_vnum prereq; /* Object required to undertake quest */
int value[7]; /* Quest values */
int gold_reward; /* Number of gold coins given as reward */
int exp_reward; /* Experience points given as a reward */
obj_vnum obj_reward; /* vnum of object given as a reward */
qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
SPECIAL (*func); /* secondary spec_proc for the QM */
qst_vnum vnum; /* Virtual nr of the quest */
char *name; /* For qlist and the sort */
char *desc; /* Description of the quest */
char *info; /* Message displayed when accepted */
char *done; /* Message displayed when completed */
char *quit; /* Message displayed when quit quest */
long flags; /* Flags (repeatable, etc */
int type; /* Quest type */
mob_vnum qm; /* questmaster offering quest */
int target; /* Target value */
obj_vnum prereq; /* Object required to undertake quest */
int value[7]; /* Quest values */
int gold_reward; /* Number of gold coins given as reward */
int exp_reward; /* Experience points given as a reward */
obj_vnum obj_reward; /* vnum of object given as a reward */
qst_vnum prev_quest; /* Link to prev quest, NOTHING is open */
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
SPECIAL (*func); /* secondary spec_proc for the QM */
};
#define QST_NUM(i) (aquest_table[i].vnum)
#define QST_NAME(i) (aquest_table[i].name)

View file

@ -1,183 +1,183 @@
/**
* @file screen.h
* Header file with ANSI color codes for online color.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _SCREEN_H_
#define _SCREEN_H_
#define CNRM "\x1B[0;0m" /* "Normal" */
#define CNUL "" /* No Change */
#define KNRM "\x1B[0m" /* Foreground "Normal" */
#define KBLK "\x1b[0;30m" /* Foreground Black */
#define KRED "\x1B[0;31m" /* Foreground Dark Red */
#define KGRN "\x1B[0;32m" /* Foreground Dark Green */
#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */
#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */
#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */
#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */
#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */
#define KNUL "" /* Foreground No Change */
#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */
#define BRED "\x1B[1;31m" /* Foreground Bright Red */
#define BGRN "\x1B[1;32m" /* Foreground Bright Green */
#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */
#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */
#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */
#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */
#define BWHT "\x1B[1;37m" /* Foreground Bright White */
#define CNRM "\x1B[0;0m" /* "Normal" */
#define CNUL "" /* No Change */
#define KNRM "\x1B[0m" /* Foreground "Normal" */
#define KBLK "\x1b[0;30m" /* Foreground Black */
#define KRED "\x1B[0;31m" /* Foreground Dark Red */
#define KGRN "\x1B[0;32m" /* Foreground Dark Green */
#define KYEL "\x1B[0;33m" /* Foreground Dark Yellow */
#define KBLU "\x1B[0;34m" /* Foreground Dark Blue */
#define KMAG "\x1B[0;35m" /* Foreground Dark Magenta */
#define KCYN "\x1B[0;36m" /* Foreground Dark Cyan */
#define KWHT "\x1B[0;37m" /* Foreground Dark White (Light Gray) */
#define KNUL "" /* Foreground No Change */
#define BBLK "\x1B[1;30m" /* Foreground Bright Black (Dark Gray) */
#define BRED "\x1B[1;31m" /* Foreground Bright Red */
#define BGRN "\x1B[1;32m" /* Foreground Bright Green */
#define BYEL "\x1B[1;33m" /* Foreground Bright Yellow */
#define BBLU "\x1B[1;34m" /* Foreground Bright Blue */
#define BMAG "\x1B[1;35m" /* Foreground Bright Magenta */
#define BCYN "\x1B[1;36m" /* Foreground Bright Cyan */
#define BWHT "\x1B[1;37m" /* Foreground Bright White */
#define BKBLK "\x1B[40m" /* Background Black */
#define BKRED "\x1B[41m" /* Background Dark Red */
#define BKGRN "\x1B[42m" /* Background Dark Green */
#define BKYEL "\x1B[43m" /* Background Dark Yellow */
#define BKBLU "\x1B[44m" /* Background Dark Blue */
#define BKMAG "\x1B[45m" /* Background Dark Magenta */
#define BKCYN "\x1B[46m" /* Background Dark Cyan */
#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */
#define BKBLK "\x1B[40m" /* Background Black */
#define BKRED "\x1B[41m" /* Background Dark Red */
#define BKGRN "\x1B[42m" /* Background Dark Green */
#define BKYEL "\x1B[43m" /* Background Dark Yellow */
#define BKBLU "\x1B[44m" /* Background Dark Blue */
#define BKMAG "\x1B[45m" /* Background Dark Magenta */
#define BKCYN "\x1B[46m" /* Background Dark Cyan */
#define BKWHT "\x1B[47m" /* Background Dark White (Light Gray) */
#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */
#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */
#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */
#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */
#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */
#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */
#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */
#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */
#define FBLK "\x1B[5;30m" /* Foreground Flashing Black (silly) */
#define FRED "\x1B[5;31m" /* Foreground Flashing Dark Red */
#define FGRN "\x1B[5;32m" /* Foreground Flashing Dark Green */
#define FYEL "\x1B[5;33m" /* Foreground Flashing Dark Yellow */
#define FBLU "\x1B[5;34m" /* Foreground Flashing Dark Blue */
#define FMAG "\x1B[5;35m" /* Foreground Flashing Dark Magenta */
#define FCYN "\x1B[5;36m" /* Foreground Flashing Dark Cyan */
#define FWHT "\x1B[5;37m" /* Foreground Flashing Light Gray */
#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */
#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */
#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */
#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */
#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */
#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */
#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */
#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */
#define BFBLK "\x1B[1;5;30m" /* Foreground Flashing Dark Gray */
#define BFRED "\x1B[1;5;31m" /* Foreground Flashing Bright Red */
#define BFGRN "\x1B[1;5;32m" /* Foreground Flashing Bright Green */
#define BFYEL "\x1B[1;5;33m" /* Foreground Flashing Bright Yellow */
#define BFBLU "\x1B[1;5;34m" /* Foreground Flashing Bright Blue */
#define BFMAG "\x1B[1;5;35m" /* Foreground Flashing Bright Magenta */
#define BFCYN "\x1B[1;5;36m" /* Foreground Flashing Bright Cyan */
#define BFWHT "\x1B[1;5;37m" /* Foreground Flashing Bright White */
#define CBEEP "\x07"
#define CBEEP "\x07"
#define CAT "@@"
#define CAMP "&"
#define CSLH "\\"
#define CAMP "&"
#define CSLH "\\"
#define CUDL "\x1B[4m" /* Underline ANSI code */
#define CUDL "\x1B[4m" /* Underline ANSI code */
#define CFSH "\x1B[5m" /* Flashing ANSI code. Change to #define CFSH "" if
* you want to disable flashing colour codes
*/
#define CRVS "\x1B[7m" /* Reverse video ANSI code */
*/
#define CRVS "\x1B[7m" /* Reverse video ANSI code */
/* conditional color. pass it a pointer to a char_data and a color level. */
#define C_OFF 0
#define C_SPR 1
#define C_NRM 2
#define C_CMP 3
/* conditional color. pass it a pointer to a char_data and a color level. */
#define C_OFF 0
#define C_SPR 1
#define C_NRM 2
#define C_CMP 3
#define _clrlevel(ch) (!IS_NPC(ch) ? (PRF_FLAGGED((ch), PRF_COLOR_1) ? 1 : 0) + \
(PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0)
#define clr(ch,lvl) (_clrlevel(ch) >= (lvl))
(PRF_FLAGGED((ch), PRF_COLOR_2) ? 2 : 0) : 0)
#define clr(ch,lvl) (_clrlevel(ch) >= (lvl))
/* Player dependant foreground color codes */
#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL)
#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL)
#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL)
#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL)
#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL)
#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL)
#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL)
#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL)
#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL)
/* Player dependant foreground color codes */
#define CCNRM(ch,lvl) (clr((ch),(lvl))?KNRM:KNUL)
#define CCBLK(ch,lvl) (clr((ch),(lvl))?KBLK:CNUL)
#define CCRED(ch,lvl) (clr((ch),(lvl))?KRED:KNUL)
#define CCGRN(ch,lvl) (clr((ch),(lvl))?KGRN:KNUL)
#define CCYEL(ch,lvl) (clr((ch),(lvl))?KYEL:KNUL)
#define CCBLU(ch,lvl) (clr((ch),(lvl))?KBLU:KNUL)
#define CCMAG(ch,lvl) (clr((ch),(lvl))?KMAG:KNUL)
#define CCCYN(ch,lvl) (clr((ch),(lvl))?KCYN:KNUL)
#define CCWHT(ch,lvl) (clr((ch),(lvl))?KWHT:KNUL)
/* Bright colors */
#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL)
#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL)
#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL)
#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL)
#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL)
#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL)
#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL)
#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL)
/* Bright colors */
#define CBRED(ch,lvl) (clr((ch),(lvl))?BRED:CNUL)
#define CBGRN(ch,lvl) (clr((ch),(lvl))?BGRN:CNUL)
#define CBYEL(ch,lvl) (clr((ch),(lvl))?BYEL:CNUL)
#define CBBLU(ch,lvl) (clr((ch),(lvl))?BBLU:CNUL)
#define CBMAG(ch,lvl) (clr((ch),(lvl))?BMAG:CNUL)
#define CBCYN(ch,lvl) (clr((ch),(lvl))?BCYN:CNUL)
#define CBWHT(ch,lvl) (clr((ch),(lvl))?BWHT:CNUL)
#define CBBLK(ch,lvl) (clr((ch),(lvl))?BBLK:CNUL)
/* Flashing colors */
#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL)
#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL)
#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL)
#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL)
#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL)
#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL)
#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL)
/* Flashing colors */
#define CCFRED(ch,lvl) (clr((ch),(lvl))?FRED:CNUL)
#define CCFGRN(ch,lvl) (clr((ch),(lvl))?FGRN:CNUL)
#define CCFYEL(ch,lvl) (clr((ch),(lvl))?FYEL:CNUL)
#define CCFBLU(ch,lvl) (clr((ch),(lvl))?FBLU:CNUL)
#define CCFMAG(ch,lvl) (clr((ch),(lvl))?FMAG:CNUL)
#define CCFCYN(ch,lvl) (clr((ch),(lvl))?FCYN:CNUL)
#define CCFWHT(ch,lvl) (clr((ch),(lvl))?FWHT:CNUL)
/* Flashing bright colors */
#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL)
#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL)
#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL)
#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL)
#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL)
#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL)
#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL)
/* Flashing bright colors */
#define CBFRED(ch,lvl) (clr((ch),(lvl))?BFRED:CNUL)
#define CBFGRN(ch,lvl) (clr((ch),(lvl))?BFGRN:CNUL)
#define CBFYEL(ch,lvl) (clr((ch),(lvl))?BFYEL:CNUL)
#define CBFBLU(ch,lvl) (clr((ch),(lvl))?BFBLU:CNUL)
#define CBFMAG(ch,lvl) (clr((ch),(lvl))?BFMAG:CNUL)
#define CBFCYN(ch,lvl) (clr((ch),(lvl))?BFCYN:CNUL)
#define CBFWHT(ch,lvl) (clr((ch),(lvl))?BFWHT:CNUL)
/* Background colors */
#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL)
#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL)
#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL)
#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL)
#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL)
#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL)
#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL)
#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL)
/* Background colors */
#define CBKRED(ch,lvl) (clr((ch),(lvl))?BKRED:CNUL)
#define CBKGRN(ch,lvl) (clr((ch),(lvl))?BKGRN:CNUL)
#define CBKYEL(ch,lvl) (clr((ch),(lvl))?BKYEL:CNUL)
#define CBKBLU(ch,lvl) (clr((ch),(lvl))?BKBLU:CNUL)
#define CBKMAG(ch,lvl) (clr((ch),(lvl))?BKMAG:CNUL)
#define CBKCYN(ch,lvl) (clr((ch),(lvl))?BKCYN:CNUL)
#define CBKWHT(ch,lvl) (clr((ch),(lvl))?BKWHT:CNUL)
#define CBKBLK(ch,lvl) (clr((ch),(lvl))?BKBLK:CNUL)
#define COLOR_LEV(ch) (_clrlevel(ch))
#define COLOR_LEV(ch) (_clrlevel(ch))
/* Simplified color codes */
#define QNRM CCNRM(ch,C_SPR)
#define QBLK CCBLK(ch,C_SPR)
#define QRED CCRED(ch,C_SPR)
#define QGRN CCGRN(ch,C_SPR)
#define QYEL CCYEL(ch,C_SPR)
#define QBLU CCBLU(ch,C_SPR)
#define QMAG CCMAG(ch,C_SPR)
#define QCYN CCCYN(ch,C_SPR)
#define QWHT CCWHT(ch,C_SPR)
/* Simplified color codes */
#define QNRM CCNRM(ch,C_SPR)
#define QBLK CCBLK(ch,C_SPR)
#define QRED CCRED(ch,C_SPR)
#define QGRN CCGRN(ch,C_SPR)
#define QYEL CCYEL(ch,C_SPR)
#define QBLU CCBLU(ch,C_SPR)
#define QMAG CCMAG(ch,C_SPR)
#define QCYN CCCYN(ch,C_SPR)
#define QWHT CCWHT(ch,C_SPR)
/* simplified brights */
#define QBBLK CBBLK(ch,C_SPR)
#define QBRED CBRED(ch,C_SPR)
#define QBGRN CBGRN(ch,C_SPR)
#define QBYEL CBYEL(ch,C_SPR)
#define QBBLU CBBLU(ch,C_SPR)
#define QBMAG CBMAG(ch,C_SPR)
#define QBCYN CBCYN(ch,C_SPR)
#define QBWHT CBWHT(ch,C_SPR)
/* simplified brights */
#define QBBLK CBBLK(ch,C_SPR)
#define QBRED CBRED(ch,C_SPR)
#define QBGRN CBGRN(ch,C_SPR)
#define QBYEL CBYEL(ch,C_SPR)
#define QBBLU CBBLU(ch,C_SPR)
#define QBMAG CBMAG(ch,C_SPR)
#define QBCYN CBCYN(ch,C_SPR)
#define QBWHT CBWHT(ch,C_SPR)
/* Simplified Flashing */
#define QFRED CCFRED(ch,C_SPR)
#define QFGRN CCFGRN(ch,C_SPR)
#define QFYEL CCFYEL(ch,C_SPR)
#define QFBLU CCFBLU(ch,C_SPR)
#define QFMAG CCFMAG(ch,C_SPR)
#define QFCYN CCFCYN(ch,C_SPR)
#define QFWHT CCFWHT(ch,C_SPR)
/* Simplified Flashing */
#define QFRED CCFRED(ch,C_SPR)
#define QFGRN CCFGRN(ch,C_SPR)
#define QFYEL CCFYEL(ch,C_SPR)
#define QFBLU CCFBLU(ch,C_SPR)
#define QFMAG CCFMAG(ch,C_SPR)
#define QFCYN CCFCYN(ch,C_SPR)
#define QFWHT CCFWHT(ch,C_SPR)
/* Simplified Bright Flashing */
#define QBFRED CBFRED(ch,C_SPR)
#define QBFGRN CBFGRN(ch,C_SPR)
#define QBFYEL CBFYEL(ch,C_SPR)
#define QBFBLU CBFBLU(ch,C_SPR)
#define QBFMAG CBFMAG(ch,C_SPR)
#define QBFCYN CBFCYN(ch,C_SPR)
#define QBFWHT CBFWHT(ch,C_SPR)
/* Simplified Bright Flashing */
#define QBFRED CBFRED(ch,C_SPR)
#define QBFGRN CBFGRN(ch,C_SPR)
#define QBFYEL CBFYEL(ch,C_SPR)
#define QBFBLU CBFBLU(ch,C_SPR)
#define QBFMAG CBFMAG(ch,C_SPR)
#define QBFCYN CBFCYN(ch,C_SPR)
#define QBFWHT CBFWHT(ch,C_SPR)
/* Simplified Backgrounds */
#define QBKBLK CBKBLK(ch,C_SPR)
#define QBKRED CBKRED(ch,C_SPR)
#define QBKGRN CBKGRN(ch,C_SPR)
#define QBKYEL CBKYEL(ch,C_SPR)
#define QBKBLU CBKBLU(ch,C_SPR)
#define QBKMAG CBKMAG(ch,C_SPR)
#define QBKCYN CBKCYN(ch,C_SPR)
#define QBKWHT CBKWHT(ch,C_SPR)
/* Simplified Backgrounds */
#define QBKBLK CBKBLK(ch,C_SPR)
#define QBKRED CBKRED(ch,C_SPR)
#define QBKGRN CBKGRN(ch,C_SPR)
#define QBKYEL CBKYEL(ch,C_SPR)
#define QBKBLU CBKBLU(ch,C_SPR)
#define QBKMAG CBKMAG(ch,C_SPR)
#define QBKCYN CBKCYN(ch,C_SPR)
#define QBKWHT CBKWHT(ch,C_SPR)
#endif /* _SCREEN_H_ */

View file

@ -1,13 +1,13 @@
/**
* @file shop.h
* Shop file definitions, structures, constants.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _SHOP_H_
#define _SHOP_H_
@ -21,57 +21,57 @@ int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim);
void destroy_shops(void);
struct shop_buy_data {
int type;
char *keywords;
int type;
char *keywords;
};
#define BUY_TYPE(i) ((i).type)
#define BUY_WORD(i) ((i).keywords)
#define BUY_TYPE(i) ((i).type)
#define BUY_WORD(i) ((i).keywords)
struct shop_data {
room_vnum vnum; /* Virtual number of this shop */
obj_vnum *producing; /* Which item to produce (virtual) */
float profit_buy; /* Factor to multiply cost with */
float profit_sell; /* Factor to multiply cost with */
struct shop_buy_data *type; /* Which items to trade */
char *no_such_item1; /* Message if keeper hasn't got an item */
char *no_such_item2; /* Message if player hasn't got an item */
char *missing_cash1; /* Message if keeper hasn't got cash */
char *missing_cash2; /* Message if player hasn't got cash */
char *do_not_buy; /* If keeper dosn't buy such things */
char *message_buy; /* Message when player buys item */
char *message_sell; /* Message when player sells item */
int temper1; /* How does keeper react if no money */
bitvector_t bitvector; /* Can attack? Use bank? Cast here? */
mob_rnum keeper; /* The mobile who owns the shop (rnum) */
int with_who; /* Who does the shop trade with? */
room_vnum *in_room; /* Where is the shop? */
int open1, open2; /* When does the shop open? */
int close1, close2; /* When does the shop close? */
int bankAccount; /* Store all gold over 15000 (disabled) */
int lastsort; /* How many items are sorted in inven? */
SPECIAL (*func); /* Secondary spec_proc for shopkeeper */
room_vnum vnum; /* Virtual number of this shop */
obj_vnum *producing; /* Which item to produce (virtual) */
float profit_buy; /* Factor to multiply cost with */
float profit_sell; /* Factor to multiply cost with */
struct shop_buy_data *type; /* Which items to trade */
char *no_such_item1; /* Message if keeper hasn't got an item */
char *no_such_item2; /* Message if player hasn't got an item */
char *missing_cash1; /* Message if keeper hasn't got cash */
char *missing_cash2; /* Message if player hasn't got cash */
char *do_not_buy; /* If keeper dosn't buy such things */
char *message_buy; /* Message when player buys item */
char *message_sell; /* Message when player sells item */
int temper1; /* How does keeper react if no money */
bitvector_t bitvector; /* Can attack? Use bank? Cast here? */
mob_rnum keeper; /* The mobile who owns the shop (rnum) */
int with_who; /* Who does the shop trade with? */
room_vnum *in_room; /* Where is the shop? */
int open1, open2; /* When does the shop open? */
int close1, close2; /* When does the shop close? */
int bankAccount; /* Store all gold over 15000 (disabled) */
int lastsort; /* How many items are sorted in inven? */
SPECIAL (*func); /* Secondary spec_proc for shopkeeper */
};
#define MAX_TRADE 5 /* List maximums for compatibility */
#define MAX_PROD 5 /* with shops before v3.0 */
#define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */
#define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */
#define MAX_TRADE 5 /* List maximums for compatibility */
#define MAX_PROD 5 /* with shops before v3.0 */
#define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */
#define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */
/* Pretty general macros that could be used elsewhere */
#define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD))
#define END_OF(buffer) ((buffer) + strlen((buffer)))
#define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD))
#define END_OF(buffer) ((buffer) + strlen((buffer)))
/* Possible states for objects trying to be sold */
#define OBJECT_DEAD 0
#define OBJECT_NOTOK 1
#define OBJECT_OK 2
#define OBJECT_NOVAL 3
#define OBJECT_DEAD 0
#define OBJECT_NOTOK 1
#define OBJECT_OK 2
#define OBJECT_NOVAL 3
/* Types of lists to read */
#define LIST_PRODUCE 0
#define LIST_TRADE 1
#define LIST_ROOM 2
#define LIST_PRODUCE 0
#define LIST_TRADE 1
#define LIST_ROOM 2
/* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */
#define TRADE_NOGOOD (1 << 0)
@ -85,47 +85,47 @@ struct shop_data {
#define NUM_TRADERS 7
struct stack_data {
int data[100];
int len;
int data[100];
int len;
} ;
#define S_DATA(stack, index) ((stack)->data[(index)])
#define S_LEN(stack) ((stack)->len)
#define S_DATA(stack, index) ((stack)->data[(index)])
#define S_LEN(stack) ((stack)->len)
/* Which expression type we are now parsing */
#define OPER_OPEN_PAREN 0
#define OPER_CLOSE_PAREN 1
#define OPER_OR 2
#define OPER_AND 3
#define OPER_NOT 4
#define MAX_OPER 4
#define OPER_OPEN_PAREN 0
#define OPER_CLOSE_PAREN 1
#define OPER_OR 2
#define OPER_AND 3
#define OPER_NOT 4
#define MAX_OPER 4
#define SHOP_NUM(i) (shop_index[(i)].vnum)
#define SHOP_KEEPER(i) (shop_index[(i)].keeper)
#define SHOP_OPEN1(i) (shop_index[(i)].open1)
#define SHOP_CLOSE1(i) (shop_index[(i)].close1)
#define SHOP_OPEN2(i) (shop_index[(i)].open2)
#define SHOP_CLOSE2(i) (shop_index[(i)].close2)
#define SHOP_ROOM(i, num) (shop_index[(i)].in_room[(num)])
#define SHOP_BUYTYPE(i, num) (BUY_TYPE(shop_index[(i)].type[(num)]))
#define SHOP_BUYWORD(i, num) (BUY_WORD(shop_index[(i)].type[(num)]))
#define SHOP_PRODUCT(i, num) (shop_index[(i)].producing[(num)])
#define SHOP_BANK(i) (shop_index[(i)].bankAccount)
#define SHOP_BROKE_TEMPER(i) (shop_index[(i)].temper1)
#define SHOP_BITVECTOR(i) (shop_index[(i)].bitvector)
#define SHOP_TRADE_WITH(i) (shop_index[(i)].with_who)
#define SHOP_SORT(i) (shop_index[(i)].lastsort)
#define SHOP_BUYPROFIT(i) (shop_index[(i)].profit_buy)
#define SHOP_SELLPROFIT(i) (shop_index[(i)].profit_sell)
#define SHOP_FUNC(i) (shop_index[(i)].func)
#define SHOP_NUM(i) (shop_index[(i)].vnum)
#define SHOP_KEEPER(i) (shop_index[(i)].keeper)
#define SHOP_OPEN1(i) (shop_index[(i)].open1)
#define SHOP_CLOSE1(i) (shop_index[(i)].close1)
#define SHOP_OPEN2(i) (shop_index[(i)].open2)
#define SHOP_CLOSE2(i) (shop_index[(i)].close2)
#define SHOP_ROOM(i, num) (shop_index[(i)].in_room[(num)])
#define SHOP_BUYTYPE(i, num) (BUY_TYPE(shop_index[(i)].type[(num)]))
#define SHOP_BUYWORD(i, num) (BUY_WORD(shop_index[(i)].type[(num)]))
#define SHOP_PRODUCT(i, num) (shop_index[(i)].producing[(num)])
#define SHOP_BANK(i) (shop_index[(i)].bankAccount)
#define SHOP_BROKE_TEMPER(i) (shop_index[(i)].temper1)
#define SHOP_BITVECTOR(i) (shop_index[(i)].bitvector)
#define SHOP_TRADE_WITH(i) (shop_index[(i)].with_who)
#define SHOP_SORT(i) (shop_index[(i)].lastsort)
#define SHOP_BUYPROFIT(i) (shop_index[(i)].profit_buy)
#define SHOP_SELLPROFIT(i) (shop_index[(i)].profit_sell)
#define SHOP_FUNC(i) (shop_index[(i)].func)
#define NOTRADE_GOOD(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOGOOD))
#define NOTRADE_EVIL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOEVIL))
#define NOTRADE_NEUTRAL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NONEUTRAL))
#define NOTRADE_MAGIC_USER(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOMAGIC_USER))
#define NOTRADE_CLERIC(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOCLERIC))
#define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF))
#define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR))
#define NOTRADE_GOOD(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOGOOD))
#define NOTRADE_EVIL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOEVIL))
#define NOTRADE_NEUTRAL(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NONEUTRAL))
#define NOTRADE_MAGIC_USER(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOMAGIC_USER))
#define NOTRADE_CLERIC(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOCLERIC))
#define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF))
#define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR))
/* Shop flags */
#define WILL_START_FIGHT (1 << 0)
@ -134,21 +134,21 @@ struct stack_data {
/** Total number of shop flags */
#define NUM_SHOP_FLAGS 3
#define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT))
#define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY))
#define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT))
#define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY))
#define MIN_OUTSIDE_BANK 5000
#define MAX_OUTSIDE_BANK 15000
#define MIN_OUTSIDE_BANK 5000
#define MAX_OUTSIDE_BANK 15000
#define MSG_NOT_OPEN_YET "Come back later!"
#define MSG_NOT_REOPEN_YET "Sorry, we have closed, but come back later."
#define MSG_CLOSED_FOR_DAY "Sorry, come back tomorrow."
#define MSG_NO_STEAL_HERE "$n is a bloody thief!"
#define MSG_NO_SEE_CHAR "I don't trade with someone I can't see!"
#define MSG_NO_SELL_ALIGN "Get out of here before I call the guards!"
#define MSG_NO_SELL_CLASS "We don't serve your kind here!"
#define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!"
#define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!"
#define MSG_NOT_OPEN_YET "Come back later!"
#define MSG_NOT_REOPEN_YET "Sorry, we have closed, but come back later."
#define MSG_CLOSED_FOR_DAY "Sorry, come back tomorrow."
#define MSG_NO_STEAL_HERE "$n is a bloody thief!"
#define MSG_NO_SEE_CHAR "I don't trade with someone I can't see!"
#define MSG_NO_SELL_ALIGN "Get out of here before I call the guards!"
#define MSG_NO_SELL_CLASS "We don't serve your kind here!"
#define MSG_NO_USED_WANDSTAFF "I don't buy used up wands or staves!"
#define MSG_CANT_KILL_KEEPER "Get out of here before I call the guards!"
/* Global variables */

View file

@ -2,25 +2,25 @@
* @file spec_procs.h
* Header file for special procedure modules. This file groups a lot of the
* legacy special procedures found in spec_procs.c and castle.c.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
*
*/
#ifndef _SPEC_PROCS_H_
#define _SPEC_PROCS_H_
/*****************************************************************************
* Begin Functions and defines for castle.c
* Begin Functions and defines for castle.c
****************************************************************************/
void assign_kings_castle(void);
/*****************************************************************************
* Begin Functions and defines for spec_assign.c
* Begin Functions and defines for spec_assign.c
****************************************************************************/
void assign_mobiles(void);
void assign_objects(void);
@ -30,7 +30,7 @@ void assign_rooms(void);
const char *get_spec_func_name(SPECIAL(*func));
/*****************************************************************************
* Begin Functions and defines for spec_procs.c
* Begin Functions and defines for spec_procs.c
****************************************************************************/
/* Utility functions */
void sort_spells(void);

View file

@ -12,28 +12,28 @@
#ifndef _SPELLS_H_
#define _SPELLS_H_
#define DEFAULT_STAFF_LVL 12
#define DEFAULT_WAND_LVL 12
#define DEFAULT_STAFF_LVL 12
#define DEFAULT_WAND_LVL 12
#define CAST_UNDEFINED (-1)
#define CAST_SPELL 0
#define CAST_POTION 1
#define CAST_WAND 2
#define CAST_STAFF 3
#define CAST_SCROLL 4
#define CAST_UNDEFINED (-1)
#define CAST_SPELL 0
#define CAST_POTION 1
#define CAST_WAND 2
#define CAST_STAFF 3
#define CAST_SCROLL 4
#define MAG_DAMAGE (1 << 0)
#define MAG_AFFECTS (1 << 1)
#define MAG_UNAFFECTS (1 << 2)
#define MAG_POINTS (1 << 3)
#define MAG_ALTER_OBJS (1 << 4)
#define MAG_GROUPS (1 << 5)
#define MAG_MASSES (1 << 6)
#define MAG_AREAS (1 << 7)
#define MAG_SUMMONS (1 << 8)
#define MAG_CREATIONS (1 << 9)
#define MAG_MANUAL (1 << 10)
#define MAG_ROOMS (1 << 11)
#define MAG_DAMAGE (1 << 0)
#define MAG_AFFECTS (1 << 1)
#define MAG_UNAFFECTS (1 << 2)
#define MAG_POINTS (1 << 3)
#define MAG_ALTER_OBJS (1 << 4)
#define MAG_GROUPS (1 << 5)
#define MAG_MASSES (1 << 6)
#define MAG_AREAS (1 << 7)
#define MAG_SUMMONS (1 << 8)
#define MAG_CREATIONS (1 << 9)
#define MAG_MANUAL (1 << 10)
#define MAG_ROOMS (1 << 11)
#define TYPE_UNDEFINED (-1)
#define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */
@ -97,7 +97,7 @@
#define NUM_SPELLS 54
/* Insert new spells here, up to MAX_SPELLS */
#define MAX_SPELLS 130
#define MAX_SPELLS 130
/* PLAYER SKILLS - Numbered from MAX_SPELLS+1 to MAX_SKILLS */
#define SKILL_BACKSTAB 131 /* Reserved Skill[] DO NOT CHANGE */
@ -105,7 +105,7 @@
#define SKILL_HIDE 133 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_KICK 134 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_PICK_LOCK 135 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_WHIRLWIND 136
#define SKILL_WHIRLWIND 136
#define SKILL_RESCUE 137 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_SNEAK 138 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_STEAL 139 /* Reserved Skill[] DO NOT CHANGE */
@ -124,7 +124,7 @@
* define it with a 'spellname'. */
#define SPELL_DG_AFFECT 298
#define TOP_SPELL_DEFINE 299
#define TOP_SPELL_DEFINE 299
/* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */
/* WEAPON ATTACK TYPES */
@ -140,14 +140,14 @@
#define TYPE_MAUL 309
#define TYPE_THRASH 310
#define TYPE_PIERCE 311
#define TYPE_BLAST 312
#define TYPE_PUNCH 313
#define TYPE_STAB 314
#define TYPE_BLAST 312
#define TYPE_PUNCH 313
#define TYPE_STAB 314
/** The total number of attack types */
#define NUM_ATTACK_TYPES 15
/* new attack types can be added here - up to TYPE_SUFFERING */
#define TYPE_SUFFERING 399
#define TYPE_SUFFERING 399
#define SAVING_PARA 0
#define SAVING_ROD 1
@ -175,24 +175,24 @@
#define TAR_FIGHT_SELF (1 << 3)
#define TAR_FIGHT_VICT (1 << 4)
#define TAR_SELF_ONLY (1 << 5) /* Only a check, use with i.e. TAR_CHAR_ROOM */
#define TAR_NOT_SELF (1 << 6) /* Only a check, use with i.e. TAR_CHAR_ROOM */
#define TAR_NOT_SELF (1 << 6) /* Only a check, use with i.e. TAR_CHAR_ROOM */
#define TAR_OBJ_INV (1 << 7)
#define TAR_OBJ_ROOM (1 << 8)
#define TAR_OBJ_WORLD (1 << 9)
#define TAR_OBJ_EQUIP (1 << 10)
#define TAR_OBJ_EQUIP (1 << 10)
struct spell_info_type {
byte min_position; /* Position for caster */
int mana_min; /* Min amount of mana used by a spell (highest lev) */
int mana_max; /* Max amount of mana used by a spell (lowest lev) */
int mana_change; /* Change in mana used by spell from lev to lev */
byte min_position; /* Position for caster */
int mana_min; /* Min amount of mana used by a spell (highest lev) */
int mana_max; /* Max amount of mana used by a spell (lowest lev) */
int mana_change; /* Change in mana used by spell from lev to lev */
int min_level[NUM_CLASSES];
int routines;
byte violent;
int targets; /* See below for use with TAR_XXX */
const char *name; /* Input size not limited. Originates from string constants. */
const char *wear_off_msg; /* Input size not limited. Originates from string constants. */
int min_level[NUM_CLASSES];
int routines;
byte violent;
int targets; /* See below for use with TAR_XXX */
const char *name; /* Input size not limited. Originates from string constants. */
const char *wear_off_msg; /* Input size not limited. Originates from string constants. */
};
/* Possible Targets:
@ -212,11 +212,9 @@ struct spell_info_type {
#define SPELL_TYPE_STAFF 3
#define SPELL_TYPE_SCROLL 4
#define ASPELL(spellname) \
void spellname(int level, struct char_data *ch, \
struct char_data *victim, struct obj_data *obj)
#define ASPELL(spellname) void spellname(int level, struct char_data *ch, struct char_data *victim, struct obj_data *obj)
#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict);
#define MANUAL_SPELL(spellname) spellname(level, caster, cvict, ovict);
ASPELL(spell_create_water);
ASPELL(spell_recall);
@ -233,11 +231,9 @@ ASPELL(spell_detect_poison);
int find_skill_num(char *name);
int mag_damage(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype);
int mag_damage(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype);
void mag_affects(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype);
void mag_affects(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype);
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype);
@ -247,28 +243,21 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype);
void mag_rooms(int level, struct char_data *ch, int spellnum);
void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
int spellnum, int savetype);
void mag_summons(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int savetype);
void mag_points(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype);
void mag_points(int level, struct char_data *ch, struct char_data *victim, int spellnum, int savetype);
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int type);
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim, int spellnum, int type);
void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
int spellnum, int type);
void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int type);
void mag_creations(int level, struct char_data *ch, int spellnum);
int call_magic(struct char_data *caster, struct char_data *cvict,
struct obj_data *ovict, int spellnum, int level, int casttype);
int call_magic(struct char_data *caster, struct char_data *cvict, struct obj_data *ovict, int spellnum, int level, int casttype);
void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
char *argument);
void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument);
int cast_spell(struct char_data *ch, struct char_data *tch,
struct obj_data *tobj, int spellnum);
int cast_spell(struct char_data *ch, struct char_data *tch, struct obj_data *tobj, int spellnum);
/* other prototypes */
void spell_level(int spell, int chclass, int level);

File diff suppressed because it is too large Load diff

View file

@ -1,29 +1,29 @@
/**
* @file sysdep.h
* Machine-specific defs based on values in conf.h (from configure)
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*
* All rights reserved. See license for complete information.
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.
*/
#ifndef _SYSDEP_H_
#define _SYSDEP_H_
/* Configurables: tbaMUD uses the crypt(3) function to encrypt player passwords
* in the players file so that they are never stored in plaintext form. However,
* due to U.S. export restrictions on machine-readable cryptographic software,
* the crypt() function is not available on some operating systems such as
* FreeBSD. By default, the 'configure' script will determine if you have
* crypt() available and enable or disable password encryption appropriately.
* due to U.S. export restrictions on machine-readable cryptographic software,
* the crypt() function is not available on some operating systems such as
* FreeBSD. By default, the 'configure' script will determine if you have
* crypt() available and enable or disable password encryption appropriately.
* #define NOCRYPT (by uncommenting the line below) if you'd like to explicitly
* disable password encryption (i.e., if you have moved your MUD from an OS that
* does not support encryption to one that does). */
/* #define NOCRYPT */
/* If you are porting tbaMUD to a new (untested) platform and you find that
/* If you are porting tbaMUD to a new (untested) platform and you find that
* POSIX-standard non-blocking I/O does *not* work, you can define the constant
* below to work around the problem. Not having non-blocking I/O can cause the
* MUD to freeze if someone types part of a command while the MUD waits for the
@ -32,17 +32,17 @@
* NOTE: **DO** **NOT** use this constant unless you are SURE you understand
* exactly what non-blocking I/O is, and you are SURE that your operating system
* does NOT have it! (The only UNIX system I've ever seen that has broken POSIX
* non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure
* why, do NOT use this constant. Use this constant ONLY if you're sure that
* non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure
* why, do NOT use this constant. Use this constant ONLY if you're sure that
* your MUD is freezing because of a non-blocking I/O problem. */
/* #define POSIX_NONBLOCK_BROKEN */
/* The code prototypes library functions to avoid compiler warnings. (Operating
* system header files *should* do this, but sometimes don't.) However, Circle's
* prototypes cause the compilation to fail under some combinations of operating
* systems and compilers. If your compiler reports "conflicting types" for
* functions, you need to define this constant to turn off library function
* prototyping. Note, **DO** **NOT** blindly turn on this constant unless you
* systems and compilers. If your compiler reports "conflicting types" for
* functions, you need to define this constant to turn off library function
* prototyping. Note, **DO** **NOT** blindly turn on this constant unless you
* are sure the problem is type conflicts between my header files and the header
* files of your operating system. The error message will look something like
* this: In file included from comm.c:14:
@ -51,7 +51,7 @@
* previous declaration of `random' */
/* #define NO_LIBRARY_PROTOTYPES */
/* If using the GNU C library, version 2+, then you can have it trace memory
/* If using the GNU C library, version 2+, then you can have it trace memory
* allocations to check for leaks, uninitialized uses, and bogus free() calls.
* To see if your version supports it, run:
* info libc 'Allocation Debugging' 'Tracing malloc'
@ -59,11 +59,11 @@
* MALLOC_TRACE=/tmp/circle-trace bin/circle
* Read the entire "Allocation Debugging" section of the GNU C library
* documentation before setting this to '1'. */
#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */
#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */
/* Do not change anything below this line. */
/* Set up various machine-specific things based on the values determined from
/* Set up various machine-specific things based on the values determined from
* configure and conf.h. */
#include <stdio.h>
@ -173,7 +173,7 @@ extern void abort (), exit ();
#ifndef HAVE_STRUCT_IN_ADDR
struct in_addr {
unsigned long int s_addr; /* for inet_addr, etc. */
unsigned long int s_addr; /* for inet_addr, etc. */
}
#endif
@ -219,7 +219,7 @@ struct in_addr {
# include <signal.h>
# undef _POSIX_C_SOURCE
# else
# include <signal.h> /* GNU libc 6 already defines _POSIX_C_SOURCE. */
# include <signal.h> /* GNU libc 6 already defines _POSIX_C_SOURCE. */
# endif
#endif
@ -251,39 +251,39 @@ struct in_addr {
#endif
#if !defined(__GNUC__)
# define __attribute__(x) /* nothing */
# define __attribute__(x) /* nothing */
#endif
#if defined(__MWERKS__)
# define isascii(c) (((c) & ~0x7f) == 0) /* So easy to have, but ... */
# define isascii(c) (((c) & ~0x7f) == 0) /* So easy to have, but ... */
#endif
/* Socket/header miscellany. */
#if defined(CIRCLE_WINDOWS) /* Definitions for Win32 */
#if defined(CIRCLE_WINDOWS) /* Definitions for Win32 */
# define snprintf _snprintf
# define vsnprintf _vsnprintf
# define PATH_MAX MAX_PATH
# if !defined(__BORLANDC__) && !defined(LCC_WIN32) /* MSVC */
# if !defined(__BORLANDC__) && !defined(LCC_WIN32) /* MSVC */
# define chdir _chdir
# pragma warning(disable:4761) /* Integral size mismatch. */
# pragma warning(disable:4244) /* Possible loss of data. */
# pragma warning(disable:4761) /* Integral size mismatch. */
# pragma warning(disable:4244) /* Possible loss of data. */
# endif
# if defined(__BORLANDC__) /* Silence warnings we don't care about. */
# pragma warn -par /* to turn off >parameter< 'ident' is never used. */
# pragma warn -pia /* to turn off possibly incorrect assignment. 'if (!(x=a))' */
# pragma warn -sig /* to turn off conversion may lose significant digits. */
# if defined(__BORLANDC__) /* Silence warnings we don't care about. */
# pragma warn -par /* to turn off >parameter< 'ident' is never used. */
# pragma warn -pia /* to turn off possibly incorrect assignment. 'if (!(x=a))' */
# pragma warn -sig /* to turn off conversion may lose significant digits. */
# endif
# ifndef _WINSOCK2API_ /* Winsock1 and Winsock 2 conflict. */
# ifndef _WINSOCK2API_ /* Winsock1 and Winsock 2 conflict. */
# include <winsock.h>
# endif
# ifndef FD_SETSIZE /* MSVC 6 is reported to have 64. */
# define FD_SETSIZE 1024
# ifndef FD_SETSIZE /* MSVC 6 is reported to have 64. */
# define FD_SETSIZE 1024
# endif
#elif defined(CIRCLE_VMS)
@ -302,17 +302,17 @@ struct in_addr {
/* SOCKET -- must be after the winsock.h #include. */
#ifdef CIRCLE_WINDOWS
# define CLOSE_SOCKET(sock) closesocket(sock)
typedef SOCKET socket_t;
# define CLOSE_SOCKET(sock) closesocket(sock)
typedef SOCKET socket_t;
#else
# define CLOSE_SOCKET(sock) close(sock)
typedef int socket_t;
# define CLOSE_SOCKET(sock) close(sock)
typedef int socket_t;
#endif
#if defined(__cplusplus) /* C++ */
#define cpp_extern extern
#else /* C */
#define cpp_extern /* Nothing */
#if defined(__cplusplus) /* C++ */
#define cpp_extern extern
#else /* C */
#define cpp_extern /* Nothing */
#endif
#ifndef CIRCLE_OS_X
@ -341,224 +341,224 @@ struct in_addr {
/* Function prototypes. */
/* Header files of many OS's do not contain function prototypes for the
* standard C library functions. This produces annoying warning messages
* standard C library functions. This produces annoying warning messages
* (sometimes, a lot of them) on such OS's when compiling with gcc's -Wall.
*
* Configuration script has been changed to detect which prototypes exist
* already; this header file only prototypes functions that aren't already
* prototyped by the system headers. A clash should be impossible. This
* Configuration script has been changed to detect which prototypes exist
* already; this header file only prototypes functions that aren't already
* prototyped by the system headers. A clash should be impossible. This
* should give us our strong type-checking back. */
#ifndef NO_LIBRARY_PROTOTYPES
#ifdef NEED_ATOI_PROTO
int atoi(const char *str);
int atoi(const char *str);
#endif
#ifdef NEED_ATOL_PROTO
long atol(const char *str);
long atol(const char *str);
#endif
/* bzero is deprecated - use memset() instead. This prototype is needed for
/* bzero is deprecated - use memset() instead. This prototype is needed for
* FD_xxx macros on some machines. */
#ifdef NEED_BZERO_PROTO
void bzero(char *b, int length);
void bzero(char *b, int length);
#endif
#ifdef NEED_CRYPT_PROTO
char *crypt(const char *key, const char *salt);
char *crypt(const char *key, const char *salt);
#endif
#ifdef NEED_FCLOSE_PROTO
int fclose(FILE *stream);
int fclose(FILE *stream);
#endif
#ifdef NEED_FDOPEN_PROTO
FILE *fdopen(int fd, const char *mode);
FILE *fdopen(int fd, const char *mode);
#endif
#ifdef NEED_FFLUSH_PROTO
int fflush(FILE *stream);
int fflush(FILE *stream);
#endif
#ifdef NEED_FPRINTF_PROTO
int fprintf(FILE *strm, const char *format, /* args */ ... );
int fprintf(FILE *strm, const char *format, /* args */ ... );
#endif
#ifdef NEED_FREAD_PROTO
size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
#endif
#ifdef NEED_FSCANF_PROTO
int fscanf(FILE *strm, const char *format, ...);
int fscanf(FILE *strm, const char *format, ...);
#endif
#ifdef NEED_FSEEK_PROTO
int fseek(FILE *stream, long offset, int ptrname);
int fseek(FILE *stream, long offset, int ptrname);
#endif
#ifdef NEED_FWRITE_PROTO
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
#endif
#ifdef NEED_GETPID_PROTO
pid_t getpid(void);
pid_t getpid(void);
#endif
#ifdef NEED_PERROR_PROTO
void perror(const char *s);
void perror(const char *s);
#endif
#ifdef NEED_QSORT_PROTO
void qsort(void *base, size_t nel, size_t width,
int (*compar) (const void *, const void *));
void qsort(void *base, size_t nel, size_t width,
int (*compar) (const void *, const void *));
#endif
#ifdef NEED_REWIND_PROTO
void rewind(FILE *stream);
void rewind(FILE *stream);
#endif
#ifdef NEED_SPRINTF_PROTO
int sprintf(char *s, const char *format, /* args */ ... );
int sprintf(char *s, const char *format, /* args */ ... );
#endif
#ifdef NEED_SSCANF_PROTO
int sscanf(const char *s, const char *format, ...);
int sscanf(const char *s, const char *format, ...);
#endif
#ifdef NEED_STRDUP_PROTO
char *strdup(const char *txt);
char *strdup(const char *txt);
#endif
#ifdef NEED_STRERROR_PROTO
char *strerror(int errnum);
char *strerror(int errnum);
#endif
#ifdef NEED_STRLCPY_PROTO
size_t strlcpy(char *dest, const char *src, size_t copylen);
size_t strlcpy(char *dest, const char *src, size_t copylen);
#endif
#ifdef NEED_SYSTEM_PROTO
int system(const char *string);
int system(const char *string);
#endif
#ifdef NEED_TIME_PROTO
time_t time(time_t *tloc);
time_t time(time_t *tloc);
#endif
#ifdef NEED_UNLINK_PROTO
int unlink(const char *path);
int unlink(const char *path);
#endif
#ifdef NEED_REMOVE_PROTO
int remove(const char *path);
int remove(const char *path);
#endif
#ifdef NEED_ACCEPT_PROTO
int accept(socket_t s, struct sockaddr *addr, int *addrlen);
int accept(socket_t s, struct sockaddr *addr, int *addrlen);
#endif
#ifdef NEED_BIND_PROTO
int bind(socket_t s, const struct sockaddr *name, int namelen);
int bind(socket_t s, const struct sockaddr *name, int namelen);
#endif
#ifdef NEED_CHDIR_PROTO
int chdir(const char *path);
int chdir(const char *path);
#endif
#ifdef NEED_CLOSE_PROTO
int close(int fildes);
int close(int fildes);
#endif
#ifdef NEED_FCNTL_PROTO
int fcntl(int fildes, int cmd, /* arg */ ...);
int fcntl(int fildes, int cmd, /* arg */ ...);
#endif
#ifdef NEED_FPUTC_PROTO
int fputc(char c, FILE *stream);
int fputc(char c, FILE *stream);
#endif
#ifdef NEED_FPUTS_PROTO
int fputs(const char *s, FILE *stream);
int fputs(const char *s, FILE *stream);
#endif
#ifdef NEED_GETPEERNAME_PROTO
int getpeername(socket_t s, struct sockaddr *name, int *namelen);
int getpeername(socket_t s, struct sockaddr *name, int *namelen);
#endif
#if defined(HAS_RLIMIT) && defined(NEED_GETRLIMIT_PROTO)
int getrlimit(int resource, struct rlimit *rlp);
int getrlimit(int resource, struct rlimit *rlp);
#endif
#ifdef NEED_GETSOCKNAME_PROTO
int getsockname(socket_t s, struct sockaddr *name, int *namelen);
int getsockname(socket_t s, struct sockaddr *name, int *namelen);
#endif
#ifdef NEED_GETTIMEOFDAY_PROTO
void gettimeofday(struct timeval *tp, void * );
void gettimeofday(struct timeval *tp, void * );
#endif
#ifdef NEED_HTONL_PROTO
ulong htonl(u_long hostlong);
ulong htonl(u_long hostlong);
#endif
#ifdef NEED_HTONS_PROTO
u_short htons(u_short hostshort);
u_short htons(u_short hostshort);
#endif
#if defined(HAVE_INET_ADDR) && defined(NEED_INET_ADDR_PROTO)
unsigned long int inet_addr(const char *cp);
unsigned long int inet_addr(const char *cp);
#endif
#if defined(HAVE_INET_ATON) && defined(NEED_INET_ATON_PROTO)
int inet_aton(const char *cp, struct in_addr *inp);
int inet_aton(const char *cp, struct in_addr *inp);
#endif
#ifdef NEED_INET_NTOA_PROTO
char *inet_ntoa(const struct in_addr in);
char *inet_ntoa(const struct in_addr in);
#endif
#ifdef NEED_LISTEN_PROTO
int listen(socket_t s, int backlog);
int listen(socket_t s, int backlog);
#endif
#ifdef NEED_NTOHL_PROTO
u_long ntohl(u_long netlong);
u_long ntohl(u_long netlong);
#endif
#ifdef NEED_PRINTF_PROTO
int printf(char *format, ...);
int printf(char *format, ...);
#endif
#ifdef NEED_READ_PROTO
ssize_t read(int fildes, void *buf, size_t nbyte);
ssize_t read(int fildes, void *buf, size_t nbyte);
#endif
#ifdef NEED_SELECT_PROTO
int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
#endif
#ifdef NEED_SETITIMER_PROTO
int setitimer(int which, const struct itimerval *value,
struct itimerval *ovalue);
int setitimer(int which, const struct itimerval *value,
struct itimerval *ovalue);
#endif
#if defined(HAS_RLIMIT) && defined(NEED_SETRLIMIT_PROTO)
int setrlimit(int resource, const struct rlimit *rlp);
int setrlimit(int resource, const struct rlimit *rlp);
#endif
#ifdef NEED_SETSOCKOPT_PROTO
int setsockopt(socket_t s, int level, int optname, const char *optval,
int optlen);
int setsockopt(socket_t s, int level, int optname, const char *optval,
int optlen);
#endif
#ifdef NEED_SOCKET_PROTO
int socket(int domain, int type, int protocol);
int socket(int domain, int type, int protocol);
#endif
#ifdef NEED_WRITE_PROTO
ssize_t write(int fildes, const void *buf, size_t nbyte);
ssize_t write(int fildes, const void *buf, size_t nbyte);
#endif
#endif /* NO_LIBRARY_PROTOTYPES */

View file

@ -1,14 +1,14 @@
/**
* @file telnet.h
* Function prototypes, defines and macros to handle socket connections.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
* of, and continuation of, CircleMUD.
*/
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -20,8 +20,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@ -38,7 +38,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
#ifndef _ARPA_TELNET_H
@ -47,205 +47,204 @@
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define SYNCH 242 /* for telfunc calls */
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
};
#else
extern char *telcmds[];
#endif
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
/* telnet options */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON",
0,
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON",
0,
};
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#endif
/* sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define NSLC 18
#define NSLC 18
/*
* For backwards compatability, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
#ifdef SLC_NAMES
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
/*
* AUTHENTICATION suboptions
@ -254,64 +253,64 @@ extern char *slc_names[];
/*
* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_CNT 5
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_CNT 5
#define AUTHTYPE_TEST 99
#define AUTHTYPE_TEST 99
#ifdef AUTH_NAMES
#ifdef AUTH_NAMES
char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
};
#else
extern char *authtype_names[];
#endif
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#ifdef ENCRYPT_NAMES
#ifdef ENCRYPT_NAMES
char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0,
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0,
};
char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64", 0,
"ANY", "DES_CFB64", "DES_OFB64", 0,
};
#else
extern char *encrypt_names[];
@ -319,9 +318,9 @@ extern char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#endif /* _ARPA_TELNET_H */

View file

@ -29,10 +29,10 @@
/* external declarations and prototypes */
/** direct all log() references to basic_mud_log() function. */
#define log basic_mud_log
#define log basic_mud_log
/** Standard line size, used for many string limits. */
#define READ_SIZE 256
#define READ_SIZE 256
/* Public functions made available from utils.c. Documentation for all functions
* are made available with the function definition. */
@ -40,10 +40,10 @@ void basic_mud_log(const char *format, ...) __attribute__ ((format (printf, 1, 2
void basic_mud_vlog(const char *format, va_list args);
int touch(const char *path);
void mudlog(int type, int level, int file, const char *str, ...) __attribute__ ((format (printf, 4, 5)));
int rand_number(int from, int to);
int dice(int number, int size);
size_t sprintbit(bitvector_t vektor, const char *names[], char *result, size_t reslen);
size_t sprinttype(int type, const char *names[], char *result, size_t reslen);
int rand_number(int from, int to);
int dice(int number, int size);
size_t sprintbit(bitvector_t vektor, const char *names[], char *result, size_t reslen);
size_t sprinttype(int type, const char *names[], char *result, size_t reslen);
void sprintbitarray(int bitvector[], const char *names[], int maxar, char *result);
int get_line(FILE *fl, char *buf);
int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_name);
@ -84,10 +84,10 @@ void weather_and_time(int mode);
/* Only provide our versions if one isn't in the C library. These macro names
* will be defined by sysdep.h if a strcasecmp or stricmp exists. */
#ifndef str_cmp
int str_cmp(const char *arg1, const char *arg2);
int str_cmp(const char *arg1, const char *arg2);
#endif
#ifndef strn_cmp
int strn_cmp(const char *arg1, const char *arg2, int n);
int strn_cmp(const char *arg1, const char *arg2, int n);
#endif
/* random functions in random.c */
@ -108,30 +108,30 @@ int MIN(int a, int b);
char *CAP(char *txt);
/* Followers */
int num_followers_charmed(struct char_data *ch);
void die_follower(struct char_data *ch);
void add_follower(struct char_data *ch, struct char_data *leader);
void stop_follower(struct char_data *ch);
bool circle_follow(struct char_data *ch, struct char_data *victim);
int num_followers_charmed(struct char_data *ch);
void die_follower(struct char_data *ch);
void add_follower(struct char_data *ch, struct char_data *leader);
void stop_follower(struct char_data *ch);
bool circle_follow(struct char_data *ch, struct char_data *victim);
/* in act.informative.c */
void look_at_room(struct char_data *ch, int mode);
void add_history(struct char_data *ch, char *msg, int type);
void look_at_room(struct char_data *ch, int mode);
void add_history(struct char_data *ch, char *msg, int type);
/* in act.movmement.c */
int do_simple_move(struct char_data *ch, int dir, int following);
int perform_move(struct char_data *ch, int dir, int following);
int do_simple_move(struct char_data *ch, int dir, int following);
int perform_move(struct char_data *ch, int dir, int following);
/* in limits.c */
int mana_gain(struct char_data *ch);
int hit_gain(struct char_data *ch);
int move_gain(struct char_data *ch);
void set_title(struct char_data *ch, char *title);
void gain_exp(struct char_data *ch, int gain);
void gain_exp_regardless(struct char_data *ch, int gain);
void gain_condition(struct char_data *ch, int condition, int value);
void point_update(void);
void update_pos(struct char_data *victim);
int mana_gain(struct char_data *ch);
int hit_gain(struct char_data *ch);
int move_gain(struct char_data *ch);
void set_title(struct char_data *ch, char *title);
void gain_exp(struct char_data *ch, int gain);
void gain_exp_regardless(struct char_data *ch, int gain);
void gain_condition(struct char_data *ch, int condition, int value);
void point_update(void);
void update_pos(struct char_data *victim);
void run_autowiz(void);
int increase_gold(struct char_data *ch, int amt);
int decrease_gold(struct char_data *ch, int amt);
@ -152,10 +152,10 @@ void char_from_furniture(struct char_data *ch);
/* various constants */
/* defines for mudlog() */
#define OFF 0 /**< Receive no mudlog messages. */
#define BRF 1 /**< Receive only the most important mudlog messages. */
#define NRM 2 /**< Receive the standard mudlog messages. */
#define CMP 3 /**< Receive every mudlog message. */
#define OFF 0 /**< Receive no mudlog messages. */
#define BRF 1 /**< Receive only the most important mudlog messages. */
#define NRM 2 /**< Receive the standard mudlog messages. */
#define CMP 3 /**< Receive every mudlog message. */
/* get_filename() types of files to open */
#define CRASH_FILE 0 /**< Open up a player crash save file */
@ -166,32 +166,32 @@ void char_from_furniture(struct char_data *ch);
#define MAX_FILES 4 /**< Max number of files types vailable */
/* breadth-first searching for graph function (tracking, etc) */
#define BFS_ERROR (-1) /**< Error in the search. */
#define BFS_ALREADY_THERE (-2) /**< Area traversed already. */
#define BFS_NO_PATH (-3) /**< No path through here. */
#define BFS_ERROR (-1) /**< Error in the search. */
#define BFS_ALREADY_THERE (-2) /**< Area traversed already. */
#define BFS_NO_PATH (-3) /**< No path through here. */
/** Number of real life seconds per mud hour.
* @todo The definitions based on SECS_PER_MUD_HOUR should be configurable.
* See act.informative.c and utils.c for other places to change. */
#define SECS_PER_MUD_HOUR 75
#define SECS_PER_MUD_HOUR 75
/** Real life seconds in one mud day.
* Current calculation = 30 real life minutes. */
#define SECS_PER_MUD_DAY (24*SECS_PER_MUD_HOUR)
#define SECS_PER_MUD_DAY (24*SECS_PER_MUD_HOUR)
/** Real life seconds per mud month.
* Current calculation = 17.5 real life hours */
#define SECS_PER_MUD_MONTH (35*SECS_PER_MUD_DAY)
#define SECS_PER_MUD_MONTH (35*SECS_PER_MUD_DAY)
/** Real life seconds per mud month.
* Current calculation ~= 12.4 real life days */
#define SECS_PER_MUD_YEAR (17*SECS_PER_MUD_MONTH)
#define SECS_PER_MUD_YEAR (17*SECS_PER_MUD_MONTH)
/** The number of seconds in a real minute. */
#define SECS_PER_REAL_MIN 60
#define SECS_PER_REAL_MIN 60
/** The number of seconds in a real hour. */
#define SECS_PER_REAL_HOUR (60*SECS_PER_REAL_MIN)
#define SECS_PER_REAL_HOUR (60*SECS_PER_REAL_MIN)
/** The number of seconds in a real day. */
#define SECS_PER_REAL_DAY (24*SECS_PER_REAL_HOUR)
#define SECS_PER_REAL_DAY (24*SECS_PER_REAL_HOUR)
/** The number of seconds in a real year. */
#define SECS_PER_REAL_YEAR (365*SECS_PER_REAL_DAY)
#define SECS_PER_REAL_YEAR (365*SECS_PER_REAL_DAY)
/* integer utils */
#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b)))
@ -221,10 +221,10 @@ void char_from_furniture(struct char_data *ch);
* @param type The type of memory (int, struct char_data, etc.).
* @param number How many of type to make. */
#define CREATE(result, type, number) do {\
if ((number) * sizeof(type) <= 0) \
log("SYSERR: Zero bytes or less requested at %s:%d.", __FILE__, __LINE__); \
if (!((result) = (type *) calloc ((number), sizeof(type)))) \
{ perror("SYSERR: malloc failure"); abort(); } } while(0)
if ((number) * sizeof(type) <= 0) \
log("SYSERR: Zero bytes or less requested at %s:%d.", __FILE__, __LINE__); \
if (!((result) = (type *) calloc ((number), sizeof(type)))) \
{ perror("SYSERR: malloc failure"); abort(); } } while(0)
/** A realloc based memory reallocation macro. Reminder: realloc can reduce
* the size of an array as well as increase it.
@ -233,7 +233,7 @@ void char_from_furniture(struct char_data *ch);
* @param number How many of type to make. */
#define RECREATE(result, type, number) do {\
if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\
{ perror("SYSERR: realloc failure"); abort(); } } while(0)
{ perror("SYSERR: realloc failure"); abort(); } } while(0)
/** Remove an item from a linked list and reset the links.
* If item is at the list head, change the head, else traverse the
@ -246,16 +246,16 @@ void char_from_furniture(struct char_data *ch);
* @param head Pointer to the head of the linked list.
* @param next The variable name pointing to the next in the list.
* */
#define REMOVE_FROM_LIST(item, head, next) \
if ((item) == (head)) \
head = (item)->next; \
else { \
temp = head; \
#define REMOVE_FROM_LIST(item, head, next) \
if ((item) == (head)) \
head = (item)->next; \
else { \
temp = head; \
while (temp && (temp->next != (item))) \
temp = temp->next; \
if (temp) \
temp->next = (item)->next; \
} \
temp = temp->next; \
if (temp) \
temp->next = (item)->next; \
} \
/* Connect 'link' to the end of a double-linked list
* The new item becomes the last in the linked list, and the last
@ -357,22 +357,22 @@ do \
/** Warn if accessing player_specials on a mob.
* @todo Subtle bug in the var reporting, but works well for now. */
#define CHECK_PLAYER_SPECIAL(ch, var) \
(*(((ch)->player_specials == &dummy_mob) ? (log("SYSERR: Mob using '"#var"' at %s:%d.", __FILE__, __LINE__), &(var)) : &(var)))
(*(((ch)->player_specials == &dummy_mob) ? (log("SYSERR: Mob using '"#var"' at %s:%d.", __FILE__, __LINE__), &(var)) : &(var)))
#else
#define CHECK_PLAYER_SPECIAL(ch, var) (var)
#define CHECK_PLAYER_SPECIAL(ch, var) (var)
#endif
/** The act flags on a mob. Synonomous with PLR_FLAGS. */
#define MOB_FLAGS(ch) ((ch)->char_specials.saved.act)
#define MOB_FLAGS(ch) ((ch)->char_specials.saved.act)
/** Player flags on a PC. Synonomous with MOB_FLAGS. */
#define PLR_FLAGS(ch) ((ch)->char_specials.saved.act)
#define PLR_FLAGS(ch) ((ch)->char_specials.saved.act)
/** Preference flags on a player (not to be used on mobs). */
#define PRF_FLAGS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.pref))
/** Affect flags on the NPC or PC. */
#define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by)
#define AFF_FLAGS(ch) ((ch)->char_specials.saved.affected_by)
/** Room flags.
* @param loc The real room number. */
#define ROOM_FLAGS(loc) (world[(loc)].room_flags)
#define ROOM_FLAGS(loc) (world[(loc)].room_flags)
/** Zone flags.
* @param rnum The real zone number. */
#define ZONE_FLAGS(rnum) (zone_table[(rnum)].zone_flags)
@ -384,16 +384,15 @@ do \
#define ZONE_MAXLVL(rnum) (zone_table[(rnum)].max_level)
/** References the routine element for a spell. Currently unused. */
#define SPELL_ROUTINES(spl) (spell_info[spl].routines)
#define SPELL_ROUTINES(spl) (spell_info[spl].routines)
/* IS_MOB() acts as a VALID_MOB_RNUM()-like function.*/
/** 1 if the character has the NPC bit set, 0 if the character does not.
* Used to prevents NPCs and mobs from doing things they shouldn't, even
* when mobs are possessed or charmed by a player. */
#define IS_NPC(ch) (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC))
#define IS_NPC(ch) (IS_SET_AR(MOB_FLAGS(ch), MOB_ISNPC))
/** 1 if the character is a real NPC, 0 if the character is not. */
#define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && \
GET_MOB_RNUM(ch) != NOBODY)
#define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && GET_MOB_RNUM(ch) != NOBODY)
/** 1 if ch is flagged an NPC and flag is set in the act bitarray, 0 if not. */
#define MOB_FLAGGED(ch, flag) (IS_NPC(ch) && IS_SET_AR(MOB_FLAGS(ch), (flag)))
@ -437,62 +436,57 @@ do \
/** Return the sector type for the room. If there is no sector type, return
* SECT_INSIDE. */
#define SECT(room) (VALID_ROOM_RNUM(room) ? \
world[(room)].sector_type : SECT_INSIDE)
#define SECT(room) (VALID_ROOM_RNUM(room) ? world[(room)].sector_type : SECT_INSIDE)
/** Return the zone number for this room */
#define GET_ROOM_ZONE(room) (VALID_ROOM_RNUM(room) ? world[(room)].zone : NOWHERE)
#define GET_ROOM_ZONE(room) (VALID_ROOM_RNUM(room) ? world[(room)].zone : NOWHERE)
/** TRUE if the room has no light, FALSE if not. */
#define IS_DARK(room) room_is_dark((room))
#define IS_DARK(room) room_is_dark((room))
/** TRUE if the room has light, FALSE if not. */
#define IS_LIGHT(room) (!IS_DARK(room))
/** 1 if this is a valid room number, 0 if not. */
#define VALID_ROOM_RNUM(rnum) ((rnum) != NOWHERE && (rnum) <= top_of_world)
#define VALID_ROOM_RNUM(rnum) ((rnum) != NOWHERE && (rnum) <= top_of_world)
/** The room number if this is a valid room, NOWHERE if it is not */
#define GET_ROOM_VNUM(rnum) \
((room_vnum)(VALID_ROOM_RNUM(rnum) ? world[(rnum)].number : NOWHERE))
#define GET_ROOM_VNUM(rnum) ((room_vnum)(VALID_ROOM_RNUM(rnum) ? world[(rnum)].number : NOWHERE))
/** Pointer to the room function, NULL if there is not one. */
#define GET_ROOM_SPEC(room) \
(VALID_ROOM_RNUM(room) ? world[(room)].func : NULL)
#define GET_ROOM_SPEC(room) (VALID_ROOM_RNUM(room) ? world[(room)].func : NULL)
/* char utils */
/** What room is PC/NPC in? */
#define IN_ROOM(ch) ((ch)->in_room)
#define IN_ROOM(ch) ((ch)->in_room)
/** What room was PC/NPC previously in? */
#define GET_WAS_IN(ch) ((ch)->was_in_room)
#define GET_WAS_IN(ch) ((ch)->was_in_room)
/** How old is PC/NPC, at last recorded time? */
#define GET_AGE(ch) (age(ch)->year)
/** Name of PC. */
#define GET_PC_NAME(ch) ((ch)->player.name)
#define GET_PC_NAME(ch) ((ch)->player.name)
/** Name of PC or short_descr of NPC. */
#define GET_NAME(ch) (IS_NPC(ch) ? \
(ch)->player.short_descr : GET_PC_NAME(ch))
(ch)->player.short_descr : GET_PC_NAME(ch))
/** Title of PC */
#define GET_TITLE(ch) ((ch)->player.title)
/** Level of PC or NPC. */
#define GET_LEVEL(ch) ((ch)->player.level)
/** Password of PC. */
#define GET_PASSWD(ch) ((ch)->player.passwd)
#define GET_PASSWD(ch) ((ch)->player.passwd)
/** The player file position of PC. */
#define GET_PFILEPOS(ch)((ch)->pfilepos)
/** Gets the level of a player even if the player is switched.
* @todo Make this the definition of GET_LEVEL. */
#define GET_REAL_LEVEL(ch) \
(ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : \
GET_LEVEL(ch))
#define GET_REAL_LEVEL(ch) (ch->desc && ch->desc->original ? GET_LEVEL(ch->desc->original) : GET_LEVEL(ch))
/** Class of ch. */
#define GET_CLASS(ch) ((ch)->player.chclass)
/** Height of ch. */
#define GET_HEIGHT(ch) ((ch)->player.height)
#define GET_HEIGHT(ch) ((ch)->player.height)
/** Weight of ch. */
#define GET_WEIGHT(ch) ((ch)->player.weight)
#define GET_WEIGHT(ch) ((ch)->player.weight)
/** Sex of ch. */
#define GET_SEX(ch) ((ch)->player.sex)
#define GET_SEX(ch) ((ch)->player.sex)
/** Current strength of ch. */
#define GET_STR(ch) ((ch)->aff_abils.str)
@ -510,34 +504,34 @@ do \
#define GET_CHA(ch) ((ch)->aff_abils.cha)
/** Experience points of ch. */
#define GET_EXP(ch) ((ch)->points.exp)
#define GET_EXP(ch) ((ch)->points.exp)
/** Armor class of ch. */
#define GET_AC(ch) ((ch)->points.armor)
#define GET_AC(ch) ((ch)->points.armor)
/** Current hit points (health) of ch. */
#define GET_HIT(ch) ((ch)->points.hit)
#define GET_HIT(ch) ((ch)->points.hit)
/** Maximum hit points of ch. */
#define GET_MAX_HIT(ch) ((ch)->points.max_hit)
#define GET_MAX_HIT(ch) ((ch)->points.max_hit)
/** Current move points (stamina) of ch. */
#define GET_MOVE(ch) ((ch)->points.move)
#define GET_MOVE(ch) ((ch)->points.move)
/** Maximum move points (stamina) of ch. */
#define GET_MAX_MOVE(ch) ((ch)->points.max_move)
/** Current mana points (magic) of ch. */
#define GET_MANA(ch) ((ch)->points.mana)
#define GET_MANA(ch) ((ch)->points.mana)
/** Maximum mana points (magic) of ch. */
#define GET_MAX_MANA(ch) ((ch)->points.max_mana)
#define GET_MAX_MANA(ch) ((ch)->points.max_mana)
/** Gold on ch. */
#define GET_GOLD(ch) ((ch)->points.gold)
#define GET_GOLD(ch) ((ch)->points.gold)
/** Gold in bank of ch. */
#define GET_BANK_GOLD(ch) ((ch)->points.bank_gold)
/** Current to-hit roll modifier for ch. */
#define GET_HITROLL(ch) ((ch)->points.hitroll)
#define GET_HITROLL(ch) ((ch)->points.hitroll)
/** Current damage roll modifier for ch. */
#define GET_DAMROLL(ch) ((ch)->points.damroll)
#define GET_DAMROLL(ch) ((ch)->points.damroll)
/** Current position (standing, sitting) of ch. */
#define GET_POS(ch) ((ch)->char_specials.position)
#define GET_POS(ch) ((ch)->char_specials.position)
/** Unique ID of ch. */
#define GET_IDNUM(ch) ((ch)->char_specials.saved.idnum)
#define GET_IDNUM(ch) ((ch)->char_specials.saved.idnum)
/** Returns contents of id field from x. */
/** Warning: GET_ID is deprecated and you should use char_script_id, obj_script_id, room_script_id */
/** #define GET_ID(x) ((x)->id) */
@ -546,97 +540,96 @@ do \
/** Number of items carried by ch. */
#define IS_CARRYING_N(ch) ((ch)->char_specials.carry_items)
/** Who or what ch is fighting. */
#define FIGHTING(ch) ((ch)->char_specials.fighting)
#define FIGHTING(ch) ((ch)->char_specials.fighting)
/** Who or what the ch is hunting. */
#define HUNTING(ch) ((ch)->char_specials.hunting)
#define HUNTING(ch) ((ch)->char_specials.hunting)
/** Saving throw i for character ch. */
#define GET_SAVE(ch, i) ((ch)->char_specials.saved.apply_saving_throw[i])
#define GET_SAVE(ch, i) ((ch)->char_specials.saved.apply_saving_throw[i])
/** Alignment value for ch. */
#define GET_ALIGNMENT(ch) ((ch)->char_specials.saved.alignment)
/** Return condition i (DRUNK, HUNGER, THIRST) of ch. */
#define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.conditions[(i)]))
#define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.conditions[(i)]))
/** The room to load player ch into. */
#define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.load_room))
#define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.load_room))
/** Number of skill practice sessions remaining for ch. */
#define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.spells_to_learn))
#define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.spells_to_learn))
/** Current invisibility level of ch. */
#define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.invis_level))
#define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.invis_level))
/** Current wimpy level of ch. */
#define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.wimp_level))
#define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.wimp_level))
/** Current freeze level (god command) inflicted upon ch. */
#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level))
#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.freeze_level))
/** Current number of bad password attempts at logon. */
#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws))
#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.bad_pws))
/** Not used?
* @deprecated Should not be used, as the talks field has been removed. */
#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i]))
#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.talks[i]))
/** The poofin string for the ch. */
#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin))
#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin))
/** The poofout string for the ch. */
#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout))
#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout))
/** The OLC zoon permission for ch.
* @deprecated Currently unused? */
#define GET_OLC_ZONE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.olc_zone))
#define GET_OLC_ZONE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.olc_zone))
/** Currently unused?
* @deprecated Currently unused? */
#define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ))
#define GET_LAST_OLC_TARG(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_targ))
/** Currently unused?
* @deprecated Currently unused? */
#define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode))
#define GET_LAST_OLC_MODE(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_olc_mode))
/** Retrieve command aliases for ch. */
#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases))
#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases))
/** Who ch last spoke to with the 'tell' command. */
#define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell))
#define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell))
/** Get unique session id for ch. */
#define GET_PREF(ch) ((ch)->pref)
#define GET_PREF(ch) ((ch)->pref)
/** Get host name or ip of ch. */
#define GET_HOST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->host))
#define GET_LAST_MOTD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastmotd))
#define GET_LAST_NEWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastnews))
#define GET_HOST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->host))
#define GET_LAST_MOTD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastmotd))
#define GET_LAST_NEWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.lastnews))
/** Get channel history i for ch. */
#define GET_HISTORY(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.comm_hist[i]))
#define GET_HISTORY(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.comm_hist[i]))
/** Return the page length (height) for ch. */
#define GET_PAGE_LENGTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.page_length))
#define GET_PAGE_LENGTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.page_length))
/** Return the page width for ch */
#define GET_SCREEN_WIDTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.screen_width))
#define GET_SCREEN_WIDTH(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.screen_width))
/* Autoquests data */
/** Return the number of questpoints ch has. */
#define GET_QUESTPOINTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.questpoints))
#define GET_QUESTPOINTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.questpoints))
/** Return the current quest that a player has assigned */
#define GET_QUEST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.current_quest))
#define GET_QUEST(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.current_quest))
/** Number of goals completed for this quest. */
#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter))
#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter))
/** Time remaining to complete the quest ch is currently on. */
#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time))
#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time))
/** The number of quests completed by ch. */
#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests))
#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests))
/** The type of quest ch is currently participating in. */
#define GET_QUEST_TYPE(ch) (real_quest(GET_QUEST((ch))) != NOTHING ? aquest_table[real_quest(GET_QUEST((ch)))].type : AQ_UNDEFINED )
#define GET_QUEST_TYPE(ch) (real_quest(GET_QUEST((ch))) != NOTHING ? aquest_table[real_quest(GET_QUEST((ch)))].type : AQ_UNDEFINED )
/** The current skill level of ch for skill i. */
#define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.skills[i]))
#define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.skills[i]))
/** Copy the current skill level i of ch to pct. */
#define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->saved.skills[i]) = pct; } while(0)
#define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->saved.skills[i]) = pct; } while(0)
/** The player's default sector type when buildwalking */
#define GET_BUILDWALK_SECTOR(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->buildwalk_sector))
/** Get obj worn in position i on ch. */
#define GET_EQ(ch, i) ((ch)->equipment[i])
#define GET_EQ(ch, i) ((ch)->equipment[i])
/** If ch is a mob, return the special function, else return NULL. */
#define GET_MOB_SPEC(ch) (IS_MOB(ch) ? mob_index[(ch)->nr].func : NULL)
#define GET_MOB_SPEC(ch) (IS_MOB(ch) ? mob_index[(ch)->nr].func : NULL)
/** Get the real number of the mob instance. */
#define GET_MOB_RNUM(mob) ((mob)->nr)
#define GET_MOB_RNUM(mob) ((mob)->nr)
/** If mob is a mob, return the virtual number of it. */
#define GET_MOB_VNUM(mob) (IS_MOB(mob) ? \
mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY)
#define GET_MOB_VNUM(mob) (IS_MOB(mob) ? mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY)
/** Return the default position of ch. */
#define GET_DEFAULT_POS(ch) ((ch)->mob_specials.default_pos)
#define GET_DEFAULT_POS(ch) ((ch)->mob_specials.default_pos)
/** Return the memory of ch. */
#define MEMORY(ch) ((ch)->mob_specials.memory)
#define MEMORY(ch) ((ch)->mob_specials.memory)
/** Return the equivalent strength of ch if ch has level 18 strength. */
#define STRENGTH_APPLY_INDEX(ch) \
@ -654,8 +647,7 @@ do \
/** Return whether or not ch is awake. */
#define AWAKE(ch) (GET_POS(ch) > POS_SLEEPING)
/** Defines if ch can see in general in the dark. */
#define CAN_SEE_IN_DARK(ch) \
(AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
#define CAN_SEE_IN_DARK(ch) (AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
/** Defines if ch is good. */
#define IS_GOOD(ch) (GET_ALIGNMENT(ch) >= 350)
@ -669,16 +661,16 @@ do \
#define WAIT_STATE(ch, cycle) do { GET_WAIT_STATE(ch) = (cycle); } while(0)
/** Old check wait.
* @deprecated Use GET_WAIT_STATE */
#define CHECK_WAIT(ch) ((ch)->wait > 0)
#define CHECK_WAIT(ch) ((ch)->wait > 0)
/** Old mob wait check.
* @deprecated Use GET_WAIT_STATE */
#define GET_MOB_WAIT(ch) GET_WAIT_STATE(ch)
#define GET_MOB_WAIT(ch) GET_WAIT_STATE(ch)
/** Use this macro to check the wait state of ch. */
#define GET_WAIT_STATE(ch) ((ch)->wait)
#define GET_WAIT_STATE(ch) ((ch)->wait)
/* Descriptor-based utils. */
/** Connected state of d. */
#define STATE(d) ((d)->connected)
#define STATE(d) ((d)->connected)
/** Defines whether d is using an OLC or not. */
#define IS_IN_OLC(d) ((STATE(d) >= FIRST_OLC_STATE) && (STATE(d) <= LAST_OLC_STATE))
@ -687,62 +679,58 @@ do \
#define IS_PLAYING(d) (IS_IN_OLC(d) || STATE(d) == CON_PLAYING)
/** Defines if it is ok to send a message to ch. */
#define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \
(to_sleeping || AWAKE(ch)) && \
!PLR_FLAGGED((ch), PLR_WRITING))
#define SENDOK(ch) (((ch)->desc || SCRIPT_CHECK((ch), MTRIG_ACT)) && \
(to_sleeping || AWAKE(ch)) && \
!PLR_FLAGGED((ch), PLR_WRITING))
/* object utils */
/** Check for NOWHERE or the top array index? If using unsigned types, the top
* array index will catch everything. If using signed types, NOTHING will
* catch the majority of bad accesses. */
#define VALID_OBJ_RNUM(obj) (GET_OBJ_RNUM(obj) <= top_of_objt && \
GET_OBJ_RNUM(obj) != NOTHING)
#define VALID_OBJ_RNUM(obj) (GET_OBJ_RNUM(obj) <= top_of_objt && \
GET_OBJ_RNUM(obj) != NOTHING)
/** Level of obj. */
#define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level)
#define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level)
/** Type of obj. */
#define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag)
#define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag)
/** Cost of obj. */
#define GET_OBJ_COST(obj) ((obj)->obj_flags.cost)
#define GET_OBJ_COST(obj) ((obj)->obj_flags.cost)
/** Cost per day to rent obj, if rent is turned on. */
#define GET_OBJ_RENT(obj) ((obj)->obj_flags.cost_per_day)
#define GET_OBJ_RENT(obj) ((obj)->obj_flags.cost_per_day)
/** Affect flags on obj. */
#define GET_OBJ_AFFECT(obj) ((obj)->obj_flags.bitvector)
#define GET_OBJ_AFFECT(obj) ((obj)->obj_flags.bitvector)
/** Extra flags bit array on obj. */
#define GET_OBJ_EXTRA(obj) ((obj)->obj_flags.extra_flags)
#define GET_OBJ_EXTRA(obj) ((obj)->obj_flags.extra_flags)
/** Extra flags field bit array field i on obj. */
#define GET_OBJ_EXTRA_AR(obj, i) ((obj)->obj_flags.extra_flags[(i)])
/** Wear flags on obj. */
#define GET_OBJ_WEAR(obj) ((obj)->obj_flags.wear_flags)
#define GET_OBJ_WEAR(obj) ((obj)->obj_flags.wear_flags)
/** Return value val for obj. */
#define GET_OBJ_VAL(obj, val) ((obj)->obj_flags.value[(val)])
#define GET_OBJ_VAL(obj, val) ((obj)->obj_flags.value[(val)])
/** Weight of obj. */
#define GET_OBJ_WEIGHT(obj) ((obj)->obj_flags.weight)
#define GET_OBJ_WEIGHT(obj) ((obj)->obj_flags.weight)
/** Current timer of obj. */
#define GET_OBJ_TIMER(obj) ((obj)->obj_flags.timer)
#define GET_OBJ_TIMER(obj) ((obj)->obj_flags.timer)
/** Real number of obj instance. */
#define GET_OBJ_RNUM(obj) ((obj)->item_number)
#define GET_OBJ_RNUM(obj) ((obj)->item_number)
/** Virtual number of obj, or NOTHING if not a real obj. */
#define GET_OBJ_VNUM(obj) (VALID_OBJ_RNUM(obj) ? \
obj_index[GET_OBJ_RNUM(obj)].vnum : NOTHING)
#define GET_OBJ_VNUM(obj) (VALID_OBJ_RNUM(obj) ? obj_index[GET_OBJ_RNUM(obj)].vnum : NOTHING)
/** Special function attached to obj, or NULL if nothing attached. */
#define GET_OBJ_SPEC(obj) (VALID_OBJ_RNUM(obj) ? \
obj_index[GET_OBJ_RNUM(obj)].func : NULL)
#define GET_OBJ_SPEC(obj) (VALID_OBJ_RNUM(obj) ? obj_index[GET_OBJ_RNUM(obj)].func : NULL)
/** Defines if an obj is a corpse. */
#define IS_CORPSE(obj) (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && \
GET_OBJ_VAL((obj), 3) == 1)
#define IS_CORPSE(obj) (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && GET_OBJ_VAL((obj), 3) == 1)
/** Can the obj be worn on body part? */
#define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part))
#define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part))
/** Return short description of obj. */
#define GET_OBJ_SHORT(obj) ((obj)->short_description)
#define GET_OBJ_SHORT(obj) ((obj)->short_description)
/* Compound utilities and other macros. */
/** Used to compute version. To see if the code running is newer than 3.0pl13,
* you would use: if _CIRCLEMUD > CIRCLEMUD_VERSION(3,0,13) */
#define CIRCLEMUD_VERSION(major, minor, patchlevel) \
(((major) << 16) + ((minor) << 8) + (patchlevel))
#define CIRCLEMUD_VERSION(major, minor, patchlevel) (((major) << 16) + ((minor) << 8) + (patchlevel))
/** Figures out possessive pronoun for ch. */
#define HSHR(ch) (GET_SEX(ch) ? (GET_SEX(ch)==SEX_MALE ? "his":"her") :"its")
@ -761,7 +749,7 @@ do \
/* Various macros building up to CAN_SEE */
/** Defines if there is enough light for sub to see in. */
#define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \
#define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \
(IS_LIGHT(IN_ROOM(sub)) || AFF_FLAGGED((sub), AFF_INFRAVISION) || \
GET_LEVEL(sub) >= LVL_IMMORT))
@ -776,8 +764,7 @@ do \
/** Defines if sub character can see obj character, assuming immortal
* and mortal settings. */
#define IMM_CAN_SEE(sub, obj) \
(MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT)))
#define IMM_CAN_SEE(sub, obj) (MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT)))
/** Is obj character the same as sub character? */
#define SELF(sub, obj) ((sub) == (obj))
@ -789,21 +776,18 @@ do \
/* End of CAN_SEE */
/** Can the sub character see the obj if it is invisible? */
#define INVIS_OK_OBJ(sub, obj) \
(!OBJ_FLAGGED((obj), ITEM_INVISIBLE) || AFF_FLAGGED((sub), AFF_DETECT_INVIS))
#define INVIS_OK_OBJ(sub, obj) (!OBJ_FLAGGED((obj), ITEM_INVISIBLE) || AFF_FLAGGED((sub), AFF_DETECT_INVIS))
/** Is anyone carrying this object and if so, are they visible? */
#define CAN_SEE_OBJ_CARRIER(sub, obj) \
((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \
((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \
(!obj->worn_by || CAN_SEE(sub, obj->worn_by)))
/** Can sub character see the obj, using mortal only checks? */
#define MORT_CAN_SEE_OBJ(sub, obj) \
(LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj))
#define MORT_CAN_SEE_OBJ(sub, obj) (LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj))
/** Can sub character see the obj, using mortal and immortal checks? */
#define CAN_SEE_OBJ(sub, obj) \
(MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT)))
#define CAN_SEE_OBJ(sub, obj) (MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT)))
/** Can ch carry obj? */
#define CAN_CARRY_OBJ(ch,obj) \
@ -820,12 +804,10 @@ do \
/** If vict can see obj, return obj short description, else return
* "something". */
#define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \
(obj)->short_description : "something")
#define OBJS(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? (obj)->short_description : "something")
/** If vict can see obj, return obj name, else return "something". */
#define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? \
fname((obj)->name) : "something")
#define OBJN(obj, vict) (CAN_SEE_OBJ((vict), (obj)) ? fname((obj)->name) : "something")
/** Does direction door exist in the same room as ch? */
#define EXIT(ch, door) (world[IN_ROOM(ch)].dir_option[door])
@ -839,31 +821,27 @@ do \
/** Can ch walk through direction door. */
#define CAN_GO(ch, door) (EXIT(ch,door) && \
(EXIT(ch,door)->to_room != NOWHERE) && \
!IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
(EXIT(ch,door)->to_room != NOWHERE) && \
!IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
/** True total number of directions available to move in. */
#define DIR_COUNT ((CONFIG_DIAGONAL_DIRS) ? 10 : 6)
/* Returns TRUE if the direction is a diagonal one */
#define IS_DIAGONAL(dir) (((dir) == NORTHWEST) || ((dir) == NORTHEAST) || \
((dir) == SOUTHEAST) || ((dir) == SOUTHWEST) )
((dir) == SOUTHEAST) || ((dir) == SOUTHWEST) )
/** Return the class abbreviation for ch. */
#define CLASS_ABBR(ch) (IS_NPC(ch) ? "--" : class_abbrevs[(int)GET_CLASS(ch)])
/** 1 if ch is magic user class, 0 if not. */
#define IS_MAGIC_USER(ch) (!IS_NPC(ch) && \
(GET_CLASS(ch) == CLASS_MAGIC_USER))
#define IS_MAGIC_USER(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_MAGIC_USER))
/** 1 if ch is cleric class, 0 if not. */
#define IS_CLERIC(ch) (!IS_NPC(ch) && \
(GET_CLASS(ch) == CLASS_CLERIC))
#define IS_CLERIC(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_CLERIC))
/** 1 if ch is thief class, 0 if not. */
#define IS_THIEF(ch) (!IS_NPC(ch) && \
(GET_CLASS(ch) == CLASS_THIEF))
#define IS_THIEF(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_THIEF))
/** 1 if ch is warrior class, 0 if not. */
#define IS_WARRIOR(ch) (!IS_NPC(ch) && \
(GET_CLASS(ch) == CLASS_WARRIOR))
#define IS_WARRIOR(ch) (!IS_NPC(ch) && (GET_CLASS(ch) == CLASS_WARRIOR))
/** Defines if ch is outdoors or not. */
#define OUTSIDE(ch) (!ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS))
@ -915,11 +893,11 @@ do \
/* defines for fseek */
#ifndef SEEK_SET
/** define for fseek */
#define SEEK_SET 0
#define SEEK_SET 0
/** define for fseek */
#define SEEK_CUR 1
#define SEEK_CUR 1
/** define for fseek */
#define SEEK_END 2
#define SEEK_END 2
#endif
/* NOCRYPT can be defined by an implementor manually in sysdep.h. CIRCLE_CRYPT

View file

@ -1,13 +1,13 @@
/**
* @file zmalloc.h
* A simple memory allocation monitor, header.
*
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
*
* This code was not part of the original CircleMUD distribution. It has been
* included in tbaMUD and is attributed to:
* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com
* Version 1.1 Copyright 1996, 1998, 1999, 2000 Eric Murray ericm@lne.com
*/
#ifndef _ZMALLOC_H_
@ -20,11 +20,11 @@ void zmalloc_init(void);
void zmalloc_check(void);
char *zstrdup(const char *, char *, int);
#define malloc(x) zmalloc((x),__FILE__,__LINE__)
#define calloc(n,x) zmalloc((n*x),__FILE__,__LINE__)
#define realloc(r,x) zrealloc((unsigned char *)(r),(x),__FILE__,__LINE__)
#define free(x) zfree((unsigned char *)(x),__FILE__,__LINE__)
#define malloc(x) zmalloc((x),__FILE__,__LINE__)
#define calloc(n,x) zmalloc((n*x),__FILE__,__LINE__)
#define realloc(r,x) zrealloc((unsigned char *)(r),(x),__FILE__,__LINE__)
#define free(x) zfree((unsigned char *)(x),__FILE__,__LINE__)
#undef strdup
#define strdup(x) zstrdup((x), __FILE__, __LINE__)
#define strdup(x) zstrdup((x), __FILE__, __LINE__)
#endif /* _ZMALLOC_H_ */