jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line

Minor Bugfix: All game configuration settings now reference the world config 
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
 rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line

Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines

Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line

Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
 Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line

Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line

Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines

Changed Makefile.in to use glob expressions when building the objects. This 
translates into no longer a need to update Makefile.in whenever a new .c file 
is added to the mud code. Other Makefile.* have not yet been changed (and 
need review, anyway).

All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using 
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with 
the special CXREF codes required to effectively use the program. Since Doxygen 
is easier to use, and provides almost as much functionality as CXREF, CXREF 
support has been dropped.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line

Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line

Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master) 
will no longer attempt to wander off.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines

Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.

Bug fix: Clone can now be cast. It is an 'ignore' target spell.

Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161, 
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines

Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines

Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
 door.

Documentation: do_simple_move documented.
------------------------------------------------------------------------
 Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line

Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line

asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line

Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines

Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT   24
#define SCMD_AUTOGOLD   25
#define SCMD_AUTOSPLIT  26
#define SCMD_AUTOSAC    27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line

The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines

Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int 
index types.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines

Added a new atoidx() conversion function for dealing with string to IDXTYPE 
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
 Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line

Fixed direction mapping to give readable directions instead of sub commands. 
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines

Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in 
act.wizard.c).
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines

Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
 jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines

- do_file heads or tails files correctly and has also been enhanced to return 
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by 
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and 
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
 Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line

Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line

Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
 Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line

 Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc() 
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line

Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
 Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line

Updated levels command to use an arg/range and added color parsing to greetings.
 (thanks Jamdog)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line

Doxygen comments completed for weather.c
------------------------------------------------------------------------
 Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line

Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
 Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line

Added get_flag_by_name allowing for new trigedit variable checks like 
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines

COMPLETE: tbaMUD code re-org of global and local scope function and variable 
declarations. There may be a few things that I did not catch (some non extern 
keyword declarations of function prototypes within other functions, for 
example).

BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines

Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of 
the char * returned from title_female and title_male.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines

More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and 
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines

- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c 
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line

All act*.c functions, defines and globals have been prototyped/declared in 
act.h. The file act.h does not contain every ACMD, only those ACMDs and 
utility functions available within the act*.c files.
------------------------------------------------------------------------
 Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line

Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
 Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines

Adding a column formatter for lists.  Accepts printf-like arguments.
Only used by medit right now.

------------------------------------------------------------------------
 jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines

- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
 Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line

Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line

act.h created and added. This header will be the external entry point for the 
functions, function subcommands and variables within the act*.c files. It is 
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line

Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line

Modularizing and organizing files continues. Committing comm.c and comm.h 
because they are hairy, and I don't want to do them over if my hard drive 
crashes.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines

- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line

* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line

* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines

* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the 
POSITION_* defines.)
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line

Added Appendix A - Coder Support. Right now, it simply speaks to the fact that 
we have included doxygen config files, are working to document the source code, 
and provides a rudimentary "do this" guide to create the doxygen cross 
references.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines

- All .h files now have doxygen recognized headers, and the format is slightly 
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line

constants.h, structs.h and utils.h now protected from multiple includes. This is
 sometimes overkill, but good practice overall.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line

Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines

The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is 
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.

Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line

Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line

*bugfix* do_drink command: When a container is empty, the correct, "It is 
empty." message is now displayed.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines

Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
This commit is contained in:
Rumble 2008-04-12 01:31:58 +00:00
parent 70f648c85b
commit ebc985f010
120 changed files with 9028 additions and 4364 deletions

View file

@ -13,6 +13,8 @@
#include "conf.h"
#include "sysdep.h"
/* Begin conf.h dependent includes */
#if CIRCLE_GNU_LIBC_MEMORY_TRACK
# include <mcheck.h>
#endif
@ -47,6 +49,14 @@
# include <sys/ioctl.h>
#endif
#ifdef HAVE_ARPA_TELNET_H
#include <arpa/telnet.h>
#else
#include "telnet.h"
#endif
/* end conf.h dependent includes */
/* Note, most includes for all platforms are in sysdep.h. The list of
* files that is included is controlled by conf.h for that platform. */
@ -61,121 +71,95 @@
#include "genolc.h"
#include "dg_scripts.h"
#include "dg_event.h"
#ifdef HAVE_ARPA_TELNET_H
#include <arpa/telnet.h>
#else
#include "telnet.h"
#endif
#include "screen.h" /* to support the gemote act type command */
#include "constants.h" /* For mud versions */
#include "boards.h"
#include "act.h"
#include "ban.h"
#include "fight.h"
#include "spells.h" /* for affect_update */
#include "modify.h"
#include "quest.h"
#ifndef INVALID_SOCKET
#define INVALID_SOCKET (-1)
#endif
/* externs */
extern struct ban_list_element *ban_list;
extern int num_invalid;
extern char *GREETINGS;
extern const char *tbamud_version;
extern const char *oasisolc_version;
extern const char *ascii_pfiles_version;
extern int circle_restrict;
extern int mini_mud;
extern int no_rent_check;
extern int *cmd_sort_info;
extern struct time_info_data time_info; /* In db.c */
extern char *help;
/* local globals */
struct descriptor_data *descriptor_list = NULL; /* master desc list */
struct txt_block *bufpool = 0; /* pool of large output buffers */
int buf_largecount = 0; /* # of large buffers which exist */
int buf_overflows = 0; /* # of overflows of output */
int buf_switches = 0; /* # of switches from small to large buf */
int circle_shutdown = 0; /* clean shutdown */
int circle_reboot = 0; /* reboot the game after a shutdown */
int no_specials = 0; /* Suppress ass. of special routines */
int max_players = 0; /* max descriptors available */
int tics_passed = 0; /* for extern checkpointing */
int scheck = 0; /* for syntax checking mode */
struct timeval null_time; /* zero-valued time structure */
byte reread_wizlist; /* signal: SIGUSR1 */
byte emergency_unban; /* signal: SIGUSR2 */
FILE *logfile = NULL; /* Where to send the log messages. */
int dg_act_check; /* toggle for act_trigger */
unsigned long pulse = 0; /* number of pulses since game start */
static bool fCopyOver; /* Are we booting in copyover mode? */
/* locally defined globals, used externally */
struct descriptor_data *descriptor_list = NULL; /* master desc list */
int buf_largecount = 0; /* # of large buffers which exist */
int buf_overflows = 0; /* # of overflows of output */
int buf_switches = 0; /* # of switches from small to large buf */
int circle_shutdown = 0; /* clean shutdown */
int circle_reboot = 0; /* reboot the game after a shutdown */
int no_specials = 0; /* Suppress ass. of special routines */
int scheck = 0; /* for syntax checking mode */
FILE *logfile = NULL; /* Where to send the log messages. */
unsigned long pulse = 0; /* number of pulses since game start */
ush_int port;
socket_t mother_desc;
int log_this_messg;
char *last_act_message = NULL;
/* used with do_tell and handle_webster_file utility */
long last_webster_teller = -1L;
/* local functions */
RETSIGTYPE reread_wizlists(int sig);
RETSIGTYPE unrestrict_game(int sig);
RETSIGTYPE reap(int sig);
RETSIGTYPE checkpointing(int sig);
RETSIGTYPE hupsig(int sig);
ssize_t perform_socket_read(socket_t desc, char *read_point,size_t space_left);
ssize_t perform_socket_write(socket_t desc, const char *txt,size_t length);
void echo_off(struct descriptor_data *d);
void echo_on(struct descriptor_data *d);
void circle_sleep(struct timeval *timeout);
int get_from_q(struct txt_q *queue, char *dest, int *aliased);
void init_game(ush_int port);
void signal_setup(void);
void game_loop(socket_t mother_desc);
socket_t init_socket(ush_int port);
int new_descriptor(socket_t s);
int get_max_players(void);
int process_output(struct descriptor_data *t);
int process_input(struct descriptor_data *t);
void timediff(struct timeval *diff, struct timeval *a, struct timeval *b);
void timeadd(struct timeval *sum, struct timeval *a, struct timeval *b);
void flush_queues(struct descriptor_data *d);
void nonblock(socket_t s);
int perform_subst(struct descriptor_data *t, char *orig, char *subst);
void record_usage(void);
char *make_prompt(struct descriptor_data *point);
void check_idle_passwords(void);
void heartbeat(int heart_pulse);
void init_descriptor (struct descriptor_data *newd, int desc);
/* static local global variable declarations (current file scope only) */
static struct txt_block *bufpool = 0; /* pool of large output buffers */
static int max_players = 0; /* max descriptors available */
static int tics_passed = 0; /* for extern checkpointing */
static struct timeval null_time; /* zero-valued time structure */
static byte reread_wizlist; /* signal: SIGUSR1 */
/* normally signal SIGUSR2, currently orphaned in favor of Webster dictionary
* lookup
static byte emergency_unban;
*/
static int dg_act_check; /* toggle for act_trigger */
static bool fCopyOver; /* Are we booting in copyover mode? */
static char *last_act_message = NULL;
static byte webster_file_ready = FALSE;/* signal: SIGUSR2 */
struct in_addr *get_bind_addr(void);
int parse_ip(const char *addr, struct in_addr *inaddr);
int set_sendbuf(socket_t s);
void free_bufpool(void);
void setup_log(const char *filename, int fd);
int open_logfile(const char *filename, FILE *stderr_fp);
/* static local function prototypes (current file scope only) */
static RETSIGTYPE reread_wizlists(int sig);
/* Appears to be orphaned right now...
static RETSIGTYPE unrestrict_game(int sig);
*/
static RETSIGTYPE reap(int sig);
static RETSIGTYPE checkpointing(int sig);
static RETSIGTYPE hupsig(int sig);
static ssize_t perform_socket_read(socket_t desc, char *read_point,size_t space_left);
static ssize_t perform_socket_write(socket_t desc, const char *txt,size_t length);
static void circle_sleep(struct timeval *timeout);
static int get_from_q(struct txt_q *queue, char *dest, int *aliased);
static void init_game(ush_int port);
static void signal_setup(void);
static socket_t init_socket(ush_int port);
static int new_descriptor(socket_t s);
static int get_max_players(void);
static int process_output(struct descriptor_data *t);
static int process_input(struct descriptor_data *t);
static void timediff(struct timeval *diff, struct timeval *a, struct timeval *b);
static void timeadd(struct timeval *sum, struct timeval *a, struct timeval *b);
static void flush_queues(struct descriptor_data *d);
static void nonblock(socket_t s);
static int perform_subst(struct descriptor_data *t, char *orig, char *subst);
static void record_usage(void);
static char *make_prompt(struct descriptor_data *point);
static void check_idle_passwords(void);
static void init_descriptor (struct descriptor_data *newd, int desc);
static struct in_addr *get_bind_addr(void);
static int parse_ip(const char *addr, struct in_addr *inaddr);
static int set_sendbuf(socket_t s);
static void free_bufpool(void);
static void setup_log(const char *filename, int fd);
static int open_logfile(const char *filename, FILE *stderr_fp);
#if defined(POSIX)
sigfunc *my_signal(int signo, sigfunc *func);
static sigfunc *my_signal(int signo, sigfunc *func);
#endif
/* Webster Dictionary Lookup functions */
static RETSIGTYPE websterlink(int sig);
static size_t proc_colors(char *txt, size_t maxlen, int parse);
static void handle_webster_file();
byte webster_file_ready = FALSE;/* signal: SIGUSR2 */
RETSIGTYPE websterlink(int sig);
extern void handle_webster_file();
void copyover_recover(void);
size_t proc_colors(char *txt, size_t maxlen, int parse);
/* extern functions */
void reboot_wizlists(void);
void boot_world(void);
void affect_update(void); /* In magic.c */
void mobile_activity(void);
void perform_violence(void);
void show_string(struct descriptor_data *d, char *input);
int isbanned(char *hostname);
void weather_and_time(int mode);
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
void free_messages(void);
void board_clear_all(void);
void free_social_messages(void);
void free_invalid_list(void);
void free_command_list(void);
void free_save_list(void);
void load_config(void);
void new_hist_messg(struct descriptor_data *d, const char *msg);
/* externally defined functions, used locally */
#ifdef __CXREF__
#undef FD_ZERO
#undef FD_SET
@ -369,17 +353,17 @@ int main(int argc, char **argv)
if (!scheck) {
log("Clearing other memory.");
free_bufpool(); /* comm.c */
free_player_index(); /* players.c */
free_messages(); /* fight.c */
free_text_files(); /* db.c */
board_clear_all(); /* boards.c */
free(cmd_sort_info); /* act.informative.c */
free_command_list(); /* act.informative.c */
free_social_messages(); /* act.social.c */
free_help_table(); /* db.c */
free_invalid_list(); /* ban.c */
free_save_list(); /* genolc.c */
free_bufpool(); /* comm.c */
free_player_index(); /* players.c */
free_messages(); /* fight.c */
free_text_files(); /* db.c */
board_clear_all(); /* boards.c */
free(cmd_sort_info); /* act.informative.c */
free_command_list(); /* act.informative.c */
free_social_messages(); /* act.social.c */
free_help_table(); /* db.c */
free_invalid_list(); /* ban.c */
free_save_list(); /* genolc.c */
free_strings(&config_info, OASIS_CFG); /* oasis_delete.c */
}
@ -398,9 +382,6 @@ int main(int argc, char **argv)
return (0);
}
int enter_player_game(struct descriptor_data *d);
extern time_t boot_time;
/* Reload players after a copyover */
void copyover_recover()
{
@ -426,7 +407,7 @@ void copyover_recover()
unlink (COPYOVER_FILE);
/* read boot_time - first line in file */
fscanf(fp, "%ld\n", &boot_time);
fscanf(fp, "%ld\n", (long *)&boot_time);
for (;;) {
fOld = TRUE;
@ -484,7 +465,7 @@ void copyover_recover()
}
/* Init sockets, run game, and cleanup sockets */
void init_game(ush_int port)
static void init_game(ush_int port)
{
/* We don't want to restart if we crash before we get up. */
touch(KILLSCRIPT_FILE);
@ -545,7 +526,7 @@ void init_game(ush_int port)
/* init_socket sets up the mother descriptor - creates the socket, sets
* its options up, binds it, and listens. */
socket_t init_socket(ush_int port)
static socket_t init_socket(ush_int port)
{
socket_t s;
struct sockaddr_in sa;
@ -633,7 +614,7 @@ socket_t init_socket(ush_int port)
return (s);
}
int get_max_players(void)
static int get_max_players(void)
{
#ifndef CIRCLE_UNIX
return (CONFIG_MAX_PLAYING);
@ -929,6 +910,7 @@ void game_loop(socket_t mother_desc)
mudlog(CMP, LVL_IMMORT, TRUE, "Signal received - rereading wizlists.");
reboot_wizlists();
}
/* Orphaned right now as signal trapping is used for Webster lookup
if (emergency_unban) {
emergency_unban = FALSE;
mudlog(BRF, LVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)");
@ -936,6 +918,7 @@ void game_loop(socket_t mother_desc)
circle_restrict = 0;
num_invalid = 0;
}
*/
if (webster_file_ready) {
webster_file_ready = FALSE;
handle_webster_file();
@ -969,11 +952,12 @@ void heartbeat(int heart_pulse)
if (!(heart_pulse % PULSE_VIOLENCE))
perform_violence();
if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) {
if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) { /* Tick ! */
weather_and_time(1);
check_time_triggers();
affect_update();
point_update();
check_timed_quests();
}
if (CONFIG_AUTO_SAVE && !(heart_pulse % PULSE_AUTOSAVE)) { /* 1 minute */
@ -999,7 +983,7 @@ void heartbeat(int heart_pulse)
* Based on code submitted by ss@sirocco.cup.hp.com. Code to return the time
* difference between a and b (a-b). Always returns a nonnegative value
* (floors at 0). */
void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
static void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
{
if (a->tv_sec < b->tv_sec)
*rslt = null_time;
@ -1021,7 +1005,7 @@ void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
}
/* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */
void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
static void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
{
rslt->tv_sec = a->tv_sec + b->tv_sec;
rslt->tv_usec = a->tv_usec + b->tv_usec;
@ -1032,7 +1016,7 @@ void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
}
}
void record_usage(void)
static void record_usage(void)
{
int sockets_connected = 0, sockets_playing = 0;
struct descriptor_data *d;
@ -1097,7 +1081,7 @@ const char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0;
#undef A
const char CCODE[] = "@nNdbgcrmywDBGCRMYW01234567luoe!";
size_t proc_colors(char *txt, size_t maxlen, int parse)
static size_t proc_colors(char *txt, size_t maxlen, int parse)
{
char *d, *s, *c, *p;
int i;
@ -1158,7 +1142,7 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
return strlen(txt);
}
char *make_prompt(struct descriptor_data *d)
static char *make_prompt(struct descriptor_data *d)
{
static char prompt[MAX_PROMPT_LENGTH];
@ -1262,7 +1246,7 @@ void write_to_q(const char *txt, struct txt_q *queue, int aliased)
}
/* NOTE: 'dest' must be at least MAX_INPUT_LENGTH big. */
int get_from_q(struct txt_q *queue, char *dest, int *aliased)
static int get_from_q(struct txt_q *queue, char *dest, int *aliased)
{
struct txt_block *tmp;
@ -1282,7 +1266,7 @@ int get_from_q(struct txt_q *queue, char *dest, int *aliased)
}
/* Empty the queues before closing connection */
void flush_queues(struct descriptor_data *d)
static void flush_queues(struct descriptor_data *d)
{
if (d->large_outbuf) {
d->large_outbuf->next = bufpool;
@ -1373,7 +1357,7 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
return (t->bufspace);
}
void free_bufpool(void)
static void free_bufpool(void)
{
struct txt_block *tmp;
@ -1392,7 +1376,7 @@ void free_bufpool(void)
* address, we try to bind to it; otherwise, we bind to INADDR_ANY.
* Note that inet_aton() is preferred over inet_addr() so we use it if
* we can. If neither is available, we always bind to INADDR_ANY. */
struct in_addr *get_bind_addr()
static struct in_addr *get_bind_addr()
{
static struct in_addr bind_addr;
@ -1423,7 +1407,7 @@ struct in_addr *get_bind_addr()
#ifdef HAVE_INET_ATON
/* inet_aton's interface is the same as parse_ip's: 0 on failure, non-0 if
* successful. */
int parse_ip(const char *addr, struct in_addr *inaddr)
static int parse_ip(const char *addr, struct in_addr *inaddr)
{
return (inet_aton(addr, inaddr));
}
@ -1454,7 +1438,7 @@ int parse_ip(const char *addr, struct in_addr *inaddr)
#endif /* INET_ATON and INET_ADDR */
/* Sets the kernel's send buffer size for the descriptor */
int set_sendbuf(socket_t s)
static int set_sendbuf(socket_t s)
{
#if defined(SO_SNDBUF) && !defined(CIRCLE_MACINTOSH)
int opt = MAX_SOCK_BUF;
@ -1469,7 +1453,7 @@ int set_sendbuf(socket_t s)
}
/* Initialize a descriptor */
void init_descriptor (struct descriptor_data *newd, int desc)
static void init_descriptor (struct descriptor_data *newd, int desc)
{
static int last_desc = 0; /* last descriptor number */
@ -1488,7 +1472,7 @@ void init_descriptor (struct descriptor_data *newd, int desc)
newd->desc_num = last_desc;
}
int new_descriptor(socket_t s)
static int new_descriptor(socket_t s)
{
socket_t desc;
int sockets_connected = 0;
@ -1496,6 +1480,7 @@ int new_descriptor(socket_t s)
struct descriptor_data *newd;
struct sockaddr_in peer;
struct hostent *from;
char greet_copy[MAX_STRING_LENGTH];
/* accept the new connection */
i = sizeof(peer);
@ -1556,7 +1541,12 @@ int new_descriptor(socket_t s)
newd->next = descriptor_list;
descriptor_list = newd;
write_to_output(newd, "%s", GREETINGS);
/* This is where the greetings are actually sent to the new player */
/* Adjusted by Jamdog to show color codes on the greetings page */
*greet_copy = '\0';
sprintf(greet_copy, "%s", GREETINGS);
proc_colors(greet_copy, MAX_STRING_LENGTH, TRUE);
write_to_output(newd, "%s", greet_copy);
return (0);
}
@ -1567,7 +1557,7 @@ int new_descriptor(socket_t s)
* 14 bytes: overflow message
* 2 bytes: extra \r\n for non-comapct
* 14 bytes: unused */
int process_output(struct descriptor_data *t)
static int process_output(struct descriptor_data *t)
{
char i[MAX_SOCK_BUF], *osb = i + 2;
int result;
@ -1691,7 +1681,7 @@ ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length)
#endif
/* perform_socket_write for all Non-Windows platforms */
ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length)
static ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length)
{
ssize_t result;
@ -1763,7 +1753,7 @@ int write_to_descriptor(socket_t desc, const char *txt)
/* Same information about perform_socket_write applies here. I like
* standards, there are so many of them. -gg 6/30/98 */
ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left)
static ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left)
{
ssize_t ret;
@ -1834,7 +1824,7 @@ ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left)
* above, 'tmp' lost the '+8' since it doesn't need it and the code has been
* changed to reserve space by accepting one less character. (Do you really
* need 256 characters on a line?) -gg 1/21/2000 */
int process_input(struct descriptor_data *t)
static int process_input(struct descriptor_data *t)
{
int buf_length, failed_subst;
ssize_t bytes_read;
@ -1985,7 +1975,7 @@ int process_input(struct descriptor_data *t)
/* Perform substitution for the '^..^' csh-esque syntax orig is the orig string,
* i.e. the one being modified. subst contains the substition string, i.e.
* "^telm^tell" */
int perform_subst(struct descriptor_data *t, char *orig, char *subst)
static int perform_subst(struct descriptor_data *t, char *orig, char *subst)
{
char newsub[MAX_INPUT_LENGTH + 5];
@ -2115,7 +2105,7 @@ void close_socket(struct descriptor_data *d)
free(d);
}
void check_idle_passwords(void)
static void check_idle_passwords(void)
{
struct descriptor_data *d, *next_d;
@ -2182,7 +2172,7 @@ void nonblock(socket_t s)
#define O_NONBLOCK O_NDELAY
#endif
void nonblock(socket_t s)
static void nonblock(socket_t s)
{
int flags;
@ -2198,25 +2188,28 @@ void nonblock(socket_t s)
/* signal-handling functions (formerly signals.c). UNIX only. */
#if defined(CIRCLE_UNIX) || defined(CIRCLE_MACINTOSH)
RETSIGTYPE reread_wizlists(int sig)
static RETSIGTYPE reread_wizlists(int sig)
{
reread_wizlist = TRUE;
}
RETSIGTYPE unrestrict_game(int sig)
/* Orphaned right now in place of Webster ...
static RETSIGTYPE unrestrict_game(int sig)
{
emergency_unban = TRUE;
}
*/
RETSIGTYPE websterlink(int sig)
static RETSIGTYPE websterlink(int sig)
{
webster_file_ready = TRUE;
}
#ifdef CIRCLE_UNIX
/* clean up our zombie kids to avoid defunct processes */
RETSIGTYPE reap(int sig)
static RETSIGTYPE reap(int sig)
{
while (waitpid(-1, NULL, WNOHANG) > 0);
@ -2224,7 +2217,7 @@ RETSIGTYPE reap(int sig)
}
/* Dying anyway... */
RETSIGTYPE checkpointing(int sig)
static RETSIGTYPE checkpointing(int sig)
{
#ifndef MEMORY_DEBUG
if (!tics_passed) {
@ -2236,7 +2229,7 @@ RETSIGTYPE checkpointing(int sig)
}
/* Dying anyway... */
RETSIGTYPE hupsig(int sig)
static RETSIGTYPE hupsig(int sig)
{
log("SYSERR: Received SIGHUP, SIGINT, or SIGTERM. Shutting down...");
exit(1); /* perhaps something more elegant should substituted */
@ -2257,7 +2250,7 @@ RETSIGTYPE hupsig(int sig)
#ifndef POSIX
#define my_signal(signo, func) signal(signo, func)
#else
sigfunc *my_signal(int signo, sigfunc *func)
static sigfunc *my_signal(int signo, sigfunc *func)
{
struct sigaction sact, oact;
@ -2275,7 +2268,7 @@ sigfunc *my_signal(int signo, sigfunc *func)
}
#endif /* POSIX */
void signal_setup(void)
static void signal_setup(void)
{
#ifndef CIRCLE_MACINTOSH
struct itimerval itime;
@ -2582,7 +2575,6 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
return NULL;
}
#include "screen.h"
if (type == TO_GMOTE && !IS_NPC(ch)) {
struct descriptor_data *i;
char buf[MAX_STRING_LENGTH];
@ -2623,7 +2615,7 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
}
/* Prefer the file over the descriptor. */
void setup_log(const char *filename, int fd)
static void setup_log(const char *filename, int fd)
{
FILE *s_fp;
@ -2667,7 +2659,7 @@ void setup_log(const char *filename, int fd)
exit(1);
}
int open_logfile(const char *filename, FILE *stderr_fp)
static int open_logfile(const char *filename, FILE *stderr_fp)
{
if (stderr_fp) /* freopen() the descriptor. */
logfile = freopen(filename, "w", stderr_fp);
@ -2692,7 +2684,7 @@ void circle_sleep(struct timeval *timeout)
}
#else
void circle_sleep(struct timeval *timeout)
static void circle_sleep(struct timeval *timeout)
{
if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) {
if (errno != EINTR) {
@ -2703,3 +2695,41 @@ void circle_sleep(struct timeval *timeout)
}
#endif /* CIRCLE_WINDOWS */
static void handle_webster_file(void) {
FILE *fl;
struct char_data *ch = find_char(last_webster_teller);
char info[MAX_STRING_LENGTH], line[READ_SIZE];
size_t len = 0, nlen = 0;
last_webster_teller = -1L;
if (!ch) /* they quit ? */
return;
fl = fopen("websterinfo", "r");
if (!fl) {
send_to_char(ch, "It seems Merriam-Webster is offline..\r\n");
return;
}
unlink("websterinfo");
get_line(fl, line);
while (!feof(fl)) {
nlen = snprintf(info + len, sizeof(info) - len, "%s\r\n", line);
if (len + nlen >= sizeof(info) || nlen < 0)
break;
len += nlen;
get_line(fl, line);
}
if (len >= sizeof(info)) {
const char *overflow = "\r\n**OVERFLOW**\r\n";
strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */
}
fclose(fl);
send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n");
page_string(ch->desc, info, 1);
}