/**************************************************************
* FFTacticsMUD : main.h *
**************************************************************
* (c) 2002 Damien Dailidenas (Trenton). All rights reserved. *
**************************************************************/
#define args(list) list
#include <string>
#include "colors.h"
#include "commands.h"
#include "skills.h"
#include "ch.h"
#include "area.h"
#include "obj.h"
#include "battle.h"
#include "jobs.h"
#define DB_LOC "localhost"
#define DB_NAME "FFTacticsMUD"
#define DB_USER "username"
#define DB_PASS "password"
#define ENDL "\n\r"
typedef long long llong;
#define MSL 4608
#define MIL 256
#define PPS 4
#define PULSE_TICK (60 * PPS)
struct TID {
int hour, day, month, year;
};
struct social_type {
const char *social, *to_ch, *to_room;
};
struct wiznet_type {
char *name;
long flag;
};
struct connected_type {
char *status;
};
struct colors {
char *code;
};
struct weather_type {
char *condition;
};
struct month {
char *name;
short length;
};
#define A 1
#define B 2
#define C 4
#define D 8
#define E 16
#define F 32
#define G 64
#define H 128
#define I 256
#define J 512
#define DIR_N 0
#define DIR_E 1
#define DIR_S 2
#define DIR_W 3
#define DIR_NE 4
#define DIR_NW 5
#define DIR_SE 6
#define DIR_SW 7
#define DIR_UP 8
#define DIR_DOWN 9
template <class T>
inline void zap(T& x) {
assert(x != NULL);
delete x;
x = NULL;
}
template <class T*>
inline void zap(T*& x) {
assert(x != NULL);
delete x;
x = NULL;
}
template <class T>
inline void zap_array(T& x) {
assert(x != NULL);
delete [] x;
x = NULL;
}
#define MIN(a, b) ((a) < (b) ? (b) : (a))
#define MAX(a, b) ((a) > (b) ? (b) : (a))
#define UMAX(a, b) ((a) > (b) ? (a) : (b))
#define URANGE(a, b, c) ((b) < (a) ? (a) : ((b) > (c) ? (c) : (b)))
#define LOWER(c) ((c) >= 'A' && (c) <= 'Z' ? (c)+'a'-'A' : (c))
#define UPPER(c) ((c) >= 'a' && (c) <= 'z' ? (c)+'A'-'a' : (c))
#define IS_SET(flag, bit) ((flag) & (bit))
#define SET_BIT(var, bit) ((var) |= (bit))
#define REM_BIT(var, bit) ((var) &= ~(bit))
#define IS_INVIS(ch) (IS_SET(ch->act, PLR_INVIS))
#define IS_OMNIPOTENT(ch) (IS_SET(ch->act, PLR_OMNIPOTENT))
#define WAIT_STATE(ch, npulse) ((ch)->wait = UMAX((ch)->wait, (npulse)))
#define PERS(ch, looker) ((ch)->name)
extern const struct month month_table[];
extern const struct weather_type weather_table[];
extern const struct status_type status_table[];
extern const struct npc_type npc_table[];
extern const struct wiznet_type wiznet_table[];
extern const struct connected_type connected_table[];
extern const struct social_type social_table[];
extern const struct colors color[];
extern const struct flag_type sector_flags[];
extern const struct flag_type act_flags[];
extern const char *dir_name[];
extern const char *sh_dir_name[];
extern const short rev_dir[];
extern string lcom;
extern string lfun;
extern time_t current_time;
extern TID time_info;
extern string str_boot_time;
void reboot args(());
void copyover_recover args(());
string print_flags args((int flag));
int gcf args((int x, int y));
long flag_convert args((char letter));
int num_range args((int from, int to));
int num_percent args(());
long number_mm args(());
void append_file args((CH *ch, const string str_file, const string str = ""));
void update_handler args(());
void mysql args((CH *ch, const string query));
bool can_equip args((const CH *ch, const OBJ *obj, const short loc));
short get_status_id args((STATUSTYPE *type));
void wiz_echo args((const string str, long flag = 0));
OBJ *create_obj args((const string name));
OBJ *create_obj args((const short id));
void load_global_settings args(());
//commands.cpp
string cmd_name args((const short id));
short cmd_id args((DO_FUN *fun));
//desc.cpp
bool write_to_desc args((const short desc, const string str));
//main.cpp
void bug args((const string str));
//misc.cpp
void mysql_print_res args((CH *ch, const string query));
//move.cpp
short dir_id args((const string str));
//room.cpp
ROOM *get_room_by_id args((const string str));
//startup.cpp
void startup args(());
void load_battle_areas args(());
void load_shops args(());
long db_read_flags args((const string str_flags));
//status.cpp
short get_status_id_by_name args((const string name));
//string.cpp
int number_arg args((const string str1, string &str2));
void log_string args((const string str));
string str_time args(());
string f_str_box args((const string str, const bool line_t = true, const bool line_b = true, const string c_box = "{3"));
string f_str args((const string str));
string str_bar args((const llong stat, const llong max, const string color));
string capitalize args((const string str));
bool check_name args((const string name));
string colour args((const char type));
string header args((const string str, const bool center = false, const string color="{3"));
string clock args((const long minutes));
bool is_num args((const string str));
bool find args((const string str1, const string str2, const bool case_ = false));
void split args((string &args, string &arg));
int strlen args((const string str));
string str_comma args((const llong number));
string dialogue_box(const string name, const string str, const bool more=false);