/**************************************************************
 *  Myth Mud improvements ALL by David Spink aka Morglum.     *
 *  This mud is NOT to be copied in whole or in part! No one  *
 *  has the permission to authorise the use of this code.     *
 *  In order to use this code you MUST comply with the terms  *
 *  and conditions in 'license.myth' (as shipped).            *
 **************************************************************/


// Macros.
#define DO_COM( function ) void ( function )( CHAR_DATA *ch, char *argument )
#define	STC( text, ch )	send_to_char( text, ch )
#define	MSL	(MAX_STRING_LENGTH)
#define	MIL	(MAX_INPUT_LENGTH)

#define	FILL_STRING( string, text )					\
				if ( text != NULL )			\
				{					\
				    smash_tilde( text );		\
				    free_string( string );		\
				    string = str_dup( text );		\
				}					\
				else					\
				{					\
				    bugf(				\
			"FILL_STRING: trying to write a null string" );	\
				    free_string( string );		\
				    string = str_dup( "(NULL-BUGGED)" );\
				}

#define PERS(ch, looker)	( can_see( looker, (ch) ) ?		\
				( IS_NPC(ch) ? (ch)->short_descr	\
				: ( IS_AFFECTED( (ch), AFF_POLYMORPH) ? \
				(ch)->morph : (ch)->name ) )		\
				: "someone" )

#define	PERS2( ch, looker )	( can_see( looker, (ch) ) ?		\
				( IS_NPC(ch) ? (ch)->short_descr	\
				: (ch)->name )				\
				: "someone" )

#define IS_HYBRID(ch) ((ch)->class == CLASS_ABOMINATION || \
						(ch)->class == CLASS_LICH || \
						(ch)->class == CLASS_SKINDANCER || \
						(ch)->class == CLASS_BAALI || \
						(ch)->class == CLASS_BSD || \
						(ch)->class == CLASS_NEPHANDI)


#define MAX_CHAIN(ch) ((ch)->class == CLASS_MAGE ? 5 : \
                       (ch)->class == CLASS_SKINDANCER ? 4 : 3)

#define CH(descriptor)  ((descriptor)->original ? \
(descriptor)->original : (descriptor)->character)

// Other Defines.
#define PULSE_SUN_DAMAGE	120
#define MOB_VNUM_GREMLIN1	30002
#define MOB_VNUM_GREMLIN2	30003
#define MOB_VNUM_GREMLIN3	30004
#define MOB_VNUM_GREMLIN4	30005

// Bits for moonphases
#define MOON_NEW		0
#define MOON_CRESCENT		1
#define MOON_HALF		2
#define MOON_GIBBOUS		3
#define MOON_FULL		4
#define MOON_WANING		5

#define MOON_RISE		0
#define MOON_UP			1
#define MOON_SET		2
#define MOON_DOWN		3

#define MORNING			0
#define DAY			1
#define EVENING			2
#define NIGHT			3

/*
 * These save you haveing to work out blah * 2 :-p
 */

#define BIN_0		1
#define BIN_1		(BIN_0 * 2)
#define BIN_2		(BIN_1 * 2)
#define BIN_3		(BIN_2 * 2)
#define BIN_4		(BIN_3 * 2)
#define BIN_5		(BIN_4 * 2)
#define BIN_6		(BIN_5 * 2)
#define BIN_7		(BIN_6 * 2)
#define BIN_8		(BIN_7 * 2)
#define BIN_9		(BIN_8 * 2)
#define BIN_10		(BIN_9 * 2)
#define BIN_11		(BIN_10 * 2)
#define BIN_12		(BIN_11 * 2)
#define BIN_13		(BIN_12 * 2)
#define BIN_14		(BIN_13 * 2)
#define BIN_15		(BIN_14 * 2)
#define BIN_16		(BIN_15 * 2)
#define BIN_17		(BIN_16 * 2)
#define BIN_18		(BIN_17 * 2)
#define BIN_19		(BIN_18 * 2)
#define BIN_20		(BIN_19 * 2)
#define BIN_21		(BIN_20 * 2)
#define BIN_22		(BIN_21 * 2)
#define BIN_23		(BIN_22 * 2)
#define BIN_24		(BIN_23 * 2)
#define BIN_25		(BIN_24 * 2)
#define BIN_26		(BIN_25 * 2)
#define BIN_27		(BIN_26 * 2)
#define BIN_28		(BIN_27 * 2)
#define BIN_29		(BIN_28 * 2)
#define BIN_30		(BIN_29 * 2)

// Commands.
DECLARE_DO_FUN(	do_addlag	);
DECLARE_DO_FUN(	do_advance	);
DECLARE_DO_FUN(	do_afk	);
DECLARE_DO_FUN(	do_anarch	);
DECLARE_DO_FUN(	do_apply	);
DECLARE_DO_FUN(	do_autostance	);
DECLARE_DO_FUN(	do_bounty	);
DECLARE_DO_FUN(	do_brew	);
DECLARE_DO_FUN(	do_chill	);
DECLARE_DO_FUN(	do_circleattack	);
DECLARE_DO_FUN(	do_clearpks	);
DECLARE_DO_FUN(	do_colour	);
DECLARE_DO_FUN(	do_compress	);
DECLARE_DO_FUN(	do_copyover	);
DECLARE_DO_FUN(	do_cset	);
DECLARE_DO_FUN(	do_cshow	);
DECLARE_DO_FUN(	do_delete	);
DECLARE_DO_FUN(	do_demonpowers	);
DECLARE_DO_FUN(	do_demonweapon	);
DECLARE_DO_FUN(	do_dinduct	);
DECLARE_DO_FUN(	do_disable	);
DECLARE_DO_FUN(	do_discset	);
DECLARE_DO_FUN(	do_doutcast	);
DECLARE_DO_FUN(	do_earthquake	);
DECLARE_DO_FUN(	do_etoken	);
DECLARE_DO_FUN(	do_favourmage	);
DECLARE_DO_FUN(	do_ftalk	);
DECLARE_DO_FUN(	do_gate	);
DECLARE_DO_FUN(	do_giftset	);
DECLARE_DO_FUN(	do_grab	);
DECLARE_DO_FUN(	do_hearttwister	);
DECLARE_DO_FUN(	do_idemon	);
DECLARE_DO_FUN(	do_image	);
DECLARE_DO_FUN(	do_itribe	);
DECLARE_DO_FUN(	do_ivamp	);
DECLARE_DO_FUN(	do_klaive	);
DECLARE_DO_FUN(	do_learn	);
DECLARE_DO_FUN(	do_leave	);
DECLARE_DO_FUN(	do_logscan	);
DECLARE_DO_FUN(	do_mageq	);
DECLARE_DO_FUN(	do_magetalk	);
DECLARE_DO_FUN(	do_mageupkeep	);
DECLARE_DO_FUN(	do_makepreg	);
DECLARE_DO_FUN(	do_minorcreate	);
DECLARE_DO_FUN(	do_moonbridge	);
DECLARE_DO_FUN(	do_newbiepack	);
DECLARE_DO_FUN(	do_paradox	);
DECLARE_DO_FUN(	do_pfilescan	);
DECLARE_DO_FUN(	do_phase	);
DECLARE_DO_FUN(	do_pinfo	);
DECLARE_DO_FUN(	do_pmort	);
DECLARE_DO_FUN(	do_pshow	);
DECLARE_DO_FUN(	do_pstat	);
DECLARE_DO_FUN(	do_recolour	);
DECLARE_DO_FUN(	do_renamep	);
DECLARE_DO_FUN(	do_resetarea	);
DECLARE_DO_FUN(	do_resetpassword	);
DECLARE_DO_FUN(	do_rolldirt	);
DECLARE_DO_FUN(	do_ronin	);
DECLARE_DO_FUN(	do_selfrestore	);
DECLARE_DO_FUN(	do_swetalk	);
DECLARE_DO_FUN(	do_teachmastery	);
DECLARE_DO_FUN(	do_undeny	);
DECLARE_DO_FUN(	do_unlevel	);
DECLARE_DO_FUN(	do_waitplayer	);

// Spells
DECLARE_SPELL_FUN(	spell_aura_no_magic	);
DECLARE_SPELL_FUN(	spell_enchant_armour	);
DECLARE_SPELL_FUN(	spell_mana_to_hp	);
DECLARE_SPELL_FUN(	spell_move_to_hp	);
DECLARE_SPELL_FUN(	spell_page_element	);
DECLARE_SPELL_FUN(	spell_read_aura		);
DECLARE_SPELL_FUN(	spell_scry	);
DECLARE_SPELL_FUN(	spell_true_sight	);


/* mccp.c */
bool compressStart(DESCRIPTOR_DATA *desc);
bool compressEnd(DESCRIPTOR_DATA *desc);
bool processCompressed(DESCRIPTOR_DATA *desc);
bool writeCompressed(DESCRIPTOR_DATA *desc, char *txt, int length);

/* morg_fight.c */
void	autodrop	args( ( CHAR_DATA *ch) );

/* morg_file.c */
void	bugf			args( ( char *fmt, ... ) );
char *	strip_small_args	args( ( char *argument ) );
void	check_mortal		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void	log_string_sil		args( ( const char *str, CHAR_DATA *ch ) );
void	act4			args( ( const char *format, CHAR_DATA *ch,
				const void *arg1, const void *arg2, int type ) );
void	stcprintf		args( ( CHAR_DATA *ch, char *txt, ... ) );
char *	status_name		args( ( sh_int status, sh_int class, bool expand ) );
char *	short_date		args( ( time_t time ) );
void	display_sire		args( ( CHAR_DATA *ch, char *argument ) );
void	class_info		args( ( char *argument, CHAR_DATA *ch ) );

/* morg_spell.c */
bool	magic_immune		args( ( CHAR_DATA *ch, CHAR_DATA *victim, bool global ) );

/* morg_wiz.c */
void    status_who		args( ( CHAR_DATA *ch ) );
void    ftalk_who		args( ( CHAR_DATA *ch ) );