CC=$cc
CCFLAGS=$optimize -I.. -I../hdrs -Wall -Wno-comment -Wno-parentheses -Wno-switch -Werror $ccflags $warnings
LDFLAGS=$ldflags
-CLIBS=-ltdl $libs $cryptlib $libssl $libcrypto $libmysqlclient
+CLIBS=-lltdl $libs $cryptlib $libssl $libcrypto $libmysqlclient
INSTALL=$install
INSTALLDIR=$installdir
CP=$cp
# List of C files, used for make depend:
C_FILES=access.c atr_tab.c attrib.c boolexp.c bsd.c bufferq.c \
- chunk.c cmdlocal.c cmds.c \
+ chunk.c cmds.c \
command.c compress.c conf.c cque.c create.c cron.c db.c destroy.c division.c extchat.c \
- extmail.c filecopy.c flaglocal.c flags.c funcrypt.c function.c \
- fundb.c fundiv.c funlist.c funlocal.c funmath.c funmisc.c funstr.c funtime.c \
- funufun.c game.c help.c htab.c ident.c local.c lock.c log.c look.c \
+ extmail.c filecopy.c flags.c funcrypt.c function.c \
+ fundb.c fundiv.c funlist.c funmath.c funmisc.c funstr.c funtime.c \
+ funufun.c game.c help.c htab.c ident.c lock.c log.c look.c \
malias.c match.c memcheck.c move.c modules.c mushlua.c mushlua_wrap.c mycrypt.c mymalloc.c mysocket.c \
myssl.c notify.c parse.c pcre.c player.c plyrlist.c \
predicat.c privtab.c prog.o ptab.c rob.c rplog.c services.c set.c shs.c \
# .o versions of above - these are used in the build
COMMON_O_FILES=access.o atr_tab.o attrib.o boolexp.o bufferq.o \
- chunk.o cmdlocal.o cmds.o \
+ chunk.o cmds.o \
command.o compress.o conf.o cque.o create.o cron.o db.o destroy.o division.o extchat.o \
- extmail.o filecopy.o flaglocal.o flags.o funcrypt.o function.o \
- fundb.o funlist.o fundiv.o funlocal.o funmath.o funmisc.o funstr.o funtime.o \
- funufun.o game.o help.o htab.o ident.o local.o lock.o log.o look.o \
+ extmail.o filecopy.o flags.o funcrypt.o function.o \
+ fundb.o funlist.o fundiv.o funmath.o funmisc.o funstr.o funtime.o \
+ funufun.o game.o help.o htab.o ident.o lock.o log.o look.o \
malias.o match.o memcheck.o move.o modules.o mushlua.o mushlua_wrap.o mycrypt.o mymalloc.o \
mysocket.o myssl.o notify.o parse.o pcre.o player.o plyrlist.o predicat.o privtab.o \
prog.o ptab.o rob.o rplog.o services.o set.o shs.o sig.o speech.o sql.o strdup.o \
@echo "#define RDEFS \"$(RDEFS)\"" >> ../hdrs/buildinf.h
@echo "#define IDEFS \"$(IDEFS)\"" >> ../hdrs/buildinf.h
-# If funlocal.c doesn't exist, we want to build it from
-# funlocal.dst.
-funlocal.c: funlocal.dst
- @if [ ! -f funlocal.c ]; then \
- cp funlocal.dst funlocal.c; \
- else \
- echo "********************************************************"; \
- echo "NOTE! funlocal.dst has been changed. You may need to incorporate these" ; \
- echo "changes into your funlocal.c. Edit or touch funlocal.c to prevent this message"; \
- echo "********************************************************"; \
- fi
-
-flaglocal.c: flaglocal.dst
- @if [ ! -f flaglocal.c ]; then \
- cp flaglocal.dst flaglocal.c; \
- else \
- echo "********************************************************"; \
- echo "NOTE! flaglocal.dst has been changed. You may need to incorporate these" ; \
- echo "changes into your flaglocal.c. Edit or touch flaglocal.c to prevent this message"; \
- echo "********************************************************"; \
- fi
-
-cmdlocal.c: cmdlocal.dst
- @if [ ! -f cmdlocal.c ]; then \
- cp cmdlocal.dst cmdlocal.c; \
- else \
- echo "********************************************************"; \
- echo "NOTE! cmdlocal.dst has been changed. You may need to incorporate these" ; \
- echo "changes into your cmdlocal.c. Edit or touch cmdlocal.c to prevent this message"; \
- echo "********************************************************"; \
- fi
mushlua_wrap.c: mushlua.i
@echo "Generating mushlua_wrap.c"
swig -o mushlua_wrap.c -lua mushlua.i
-local.c: local.dst
- @if [ ! -f local.c ]; then \
- cp local.dst local.c; \
- else \
- echo "********************************************************"; \
- echo "NOTE! local.dst has been changed. You may need to incorporate these" ; \
- echo "changes into your local.c. Edit or touch local.c to prevent this message"; \
- echo "********************************************************"; \
- fi
-
-
../po/pennmush.pot: $(C_FILES) $(H_FILES)
xgettext -d pennmush -kT -o ../po/pennmush.pot $(C_FILES) $(H_FILES)
ctags:
ctags *.c
-depend: funlocal.c cmdlocal.c local.c flaglocal.c
+depend:
makedepend -fMakefile.SH -w10 -- -I../hdrs -I.. $(CFLAGS) -- $(C_FILES) $(H_FILES)
perl ../utils/fixdepend.pl Makefile.SH
-rm -f a.out core gmon.out $(OUTFILES)
distclean: clean
- -rm -f *~ *.orig *.rej *.bak funlocal.c cmdlocal.c flaglocal.c local.c \#*
+ -rm -f *~ *.orig *.rej *.bak \#*
test_compress: comp_h.c
$(CC) $(CFLAGS) -o test_compress -DSTANDALONE comp_h.c
chunk.o: ../hdrs/intrface.h
chunk.o: ../hdrs/log.h
chunk.o: ../hdrs/mymalloc.h
-cmdlocal.o: ../hdrs/copyrite.h
-cmdlocal.o: ../config.h
-cmdlocal.o: ../hdrs/conf.h
-cmdlocal.o: ../options.h
-cmdlocal.o: ../hdrs/mushtype.h
-cmdlocal.o: ../hdrs/htab.h
-cmdlocal.o: ../hdrs/externs.h
-cmdlocal.o: ../hdrs/compile.h
-cmdlocal.o: ../hdrs/dbdefs.h
-cmdlocal.o: ../hdrs/mushdb.h
-cmdlocal.o: ../hdrs/flags.h
-cmdlocal.o: ../hdrs/ptab.h
-cmdlocal.o: ../hdrs/division.h
-cmdlocal.o: ../hdrs/chunk.h
-cmdlocal.o: ../hdrs/bufferq.h
-cmdlocal.o: ../confmagic.h
-cmdlocal.o: ../hdrs/parse.h
-cmdlocal.o: ../hdrs/command.h
-cmdlocal.o: ../hdrs/boolexp.h
-cmdlocal.o: ../hdrs/switches.h
-cmdlocal.o: ../hdrs/cmds.h
cmds.o: ../hdrs/copyrite.h
cmds.o: ../config.h
cmds.o: ../hdrs/conf.h
extmail.o: ../hdrs/log.h
extmail.o: ../hdrs/lock.h
extmail.o: ../hdrs/dbio.h
-flaglocal.o: ../hdrs/copyrite.h
-flaglocal.o: ../config.h
-flaglocal.o: ../hdrs/conf.h
-flaglocal.o: ../options.h
-flaglocal.o: ../hdrs/mushtype.h
-flaglocal.o: ../hdrs/htab.h
-flaglocal.o: ../hdrs/externs.h
-flaglocal.o: ../hdrs/compile.h
-flaglocal.o: ../hdrs/dbdefs.h
-flaglocal.o: ../hdrs/mushdb.h
-flaglocal.o: ../hdrs/flags.h
-flaglocal.o: ../hdrs/ptab.h
-flaglocal.o: ../hdrs/division.h
-flaglocal.o: ../hdrs/chunk.h
-flaglocal.o: ../hdrs/bufferq.h
-flaglocal.o: ../confmagic.h
flags.o: ../config.h
flags.o: ../hdrs/conf.h
flags.o: ../hdrs/copyrite.h
funlist.o: ../hdrs/command.h
funlist.o: ../hdrs/switches.h
funlist.o: ../hdrs/lock.h
-funlocal.o: ../hdrs/copyrite.h
-funlocal.o: ../config.h
-funlocal.o: ../hdrs/conf.h
-funlocal.o: ../options.h
-funlocal.o: ../hdrs/mushtype.h
-funlocal.o: ../hdrs/htab.h
-funlocal.o: ../hdrs/externs.h
-funlocal.o: ../hdrs/compile.h
-funlocal.o: ../hdrs/dbdefs.h
-funlocal.o: ../hdrs/mushdb.h
-funlocal.o: ../hdrs/flags.h
-funlocal.o: ../hdrs/ptab.h
-funlocal.o: ../hdrs/division.h
-funlocal.o: ../hdrs/chunk.h
-funlocal.o: ../hdrs/bufferq.h
-funlocal.o: ../confmagic.h
-funlocal.o: ../hdrs/parse.h
-funlocal.o: ../hdrs/boolexp.h
-funlocal.o: ../hdrs/function.h
funmath.o: ../hdrs/copyrite.h
funmath.o: ../config.h
funmath.o: ../hdrs/conf.h
ident.o: ../hdrs/ident.h
ident.o: ../hdrs/mysocket.h
ident.o: ../hdrs/mymalloc.h
-local.o: ../hdrs/copyrite.h
-local.o: ../config.h
-local.o: ../hdrs/conf.h
-local.o: ../options.h
-local.o: ../hdrs/mushtype.h
-local.o: ../hdrs/htab.h
-local.o: ../hdrs/dbio.h
-local.o: ../hdrs/externs.h
-local.o: ../hdrs/compile.h
-local.o: ../hdrs/dbdefs.h
-local.o: ../hdrs/mushdb.h
-local.o: ../hdrs/flags.h
-local.o: ../hdrs/ptab.h
-local.o: ../hdrs/division.h
-local.o: ../hdrs/chunk.h
-local.o: ../hdrs/bufferq.h
-local.o: ../confmagic.h
-local.o: ../hdrs/parse.h
-local.o: ../hdrs/command.h
-local.o: ../hdrs/boolexp.h
-local.o: ../hdrs/switches.h
lock.o: ../hdrs/copyrite.h
lock.o: ../config.h
lock.o: ../hdrs/conf.h
FILE *id;
#endif
FILE *newerr;
+ struct module_entry_t *m;
+ void (*handle)();
+
+
/* read the configuration file */
if (argc < 2) {
#endif
dump_database();
-
- local_shutdown();
+
+ /* Replacement for local_shutdown */
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_shutdown");
#ifdef RPMODE_SYS
rplog_shutdown();
do_look_around(player);
if (Haven(player))
notify(player, T("Your HAVEN flag is set. You cannot receive pages."));
- local_connect(player, isnew, num);
+ /* Replacement for local_connect */
MODULE_ITER(m)
MODULE_FUNC(handle, m->handle, "module_connect", player, isnew, num);
char tbuf1[BUFFER_LEN];
dbref zone, obj;
int j;
+ struct module_entry_t *m;
+ void (*handle)(dbref, int);
+
+
loc = Location(player);
if (!GoodObject(loc))
set_flag_internal(player, "GOING");
set_flag_internal(player, "GOING_TWICE");
}
- local_disconnect(player, num);
+ /* Replacement for local_disconnect */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_disconnect", player, num);
+
+
}
/** Set an motd message.
void
do_reboot(dbref player, int flag)
{
+ struct module_entry_t *m;
+ void (*handle)();
+
if (player == NOTHING) {
flag_broadcast(0, 0,
T
#if !defined(COMPILE_CONSOLE) && defined(INFO_SLAVE)
kill_info_slave();
#endif
- local_shutdown();
+ /* Replacement for local_shutdown */
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_shutdown");
end_all_logs();
#ifndef WIN32
execl("netmush", "netmush", confname, NULL);
+++ /dev/null
-/*-----------------------------------------------------------------
- * Local stuff
- *
- * This file contains custom stuff, and some of the items here are
- * called from within PennMUSH at specific times.
- */
-
-/* Here are some includes you're likely to need or want.
- */
-#include "copyrite.h"
-#include "config.h"
-#include <string.h>
-#include "conf.h"
-#include "externs.h"
-#include "parse.h"
-#include "htab.h"
-#include "flags.h"
-#include "command.h"
-#include "cmds.h"
-#include "confmagic.h"
-
-extern HASHTAB htab_reserved_aliases;
-
-/* Called during the command init sequence before any commands are
- * added (including local_commands, below). This is where you
- * want to reserve any strings that you *don't* want any command
- * to alias to (because you want to preserve it for matching exits
- * or globals)
- */
-void
-reserve_aliases()
-{
-#ifdef EXAMPLE
- /* Example: Don't alias any commands to cardinal directions.
- * Remove the #ifdef EXAMPLE and #endif to use this code
- */
- reserve_alias("W");
- reserve_alias("E");
- reserve_alias("S");
- reserve_alias("N");
- reserve_alias("NW");
- reserve_alias("NE");
- reserve_alias("SW");
- reserve_alias("SE");
- reserve_alias("U");
- reserve_alias("D");
-#endif
-}
-
-#ifdef EXAMPLE
-COMMAND (cmd_local_silly) {
- if (SW_ISSET(sw, SWITCH_NOISY))
- notify_format(player, "Noisy silly with %s", arg_left);
- notify_format(player, "SillyCommand %s", arg_left);
-}
-#endif
-
-
-/* Called during the command init sequence.
- * This is where you'd put calls to command_add to insert a local
- * command into the command hash table. Any command you add here
- * will be auto-aliased for you.
- * The way to call command_add is illustrated below. The arguments are:
- * Name of the command, a string ("@SILLY")
- * Command parsing modifiers, a bitmask (see hdrs/command.h)
- * Flags to restrict command to, a string ("TRUST") or NULL
- * (Someone with *any* one of these flags can use the command)
- * Powers to restrict command to, a string ("Site Privilege") or NULL
- * (Someone with this power can use the command)
- * Switches the command can take, a string or NULL ("NOISY NOEVAL")
- * Hardcoded function the command should call (cmd_local_silly)
- */
-void
-local_commands()
-{
-#ifdef EXAMPLE
- command_add("@SILLY", CMD_T_ANY, NULL, NULL, "NOISY NOEVAL",
- cmd_local_silly);
-#endif
-}
ptab_init(&ptab_command);
hashinit(&htab_reserved_aliases, 16, sizeof(COMMAND_INFO));
- reserve_aliases();
+/* reserve_aliases(); this can now be handeled in respective modules */
ptab_start_inserts(&ptab_command);
for (cmd = commands; cmd->name; cmd++) {
ptab_insert(&ptab_command, cmd->name,
ptab_insert(&ptab_command_perms, c->name, c);
ptab_end_inserts(&ptab_command_perms);
- local_commands();
+ /* no longer needed with modules. local_commands(); */
}
/** Initialize commands (after reading config file).
#include "copyrite.h"
#include "config.h"
#include <string.h>
+#include <ltdl.h>
#include "conf.h"
#include "externs.h"
#include "mushdb.h"
#include "game.h"
#include "command.h"
#include "confmagic.h"
+#include "modules.h"
+
+extern struct module_entry_t *module_list;
static dbref parse_linkable_room(dbref player, const char *room_name);
static dbref check_var_link(const char *dest_name);
do_real_open(dbref player, const char *direction, const char *linkto,
dbref pseudo)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref);
+
+
dbref loc =
(pseudo !=
NOTHING) ? pseudo : (IsExit(player) ? Source(player) : Location(player));
}
}
current_state.exits++;
- local_data_create(new_exit);
+ /* Replacement for local_data_create */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", new_exit);
+
return new_exit;
}
return NOTHING;
dbref
do_dig(dbref player, const char *name, char **argv, int tport)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref);
dbref room;
/* we don't need to know player's location! hooray! */
do_real_open(player, argv[2], "here", room);
}
current_state.rooms++;
- local_data_create(room);
+
+ /* Replacement for local_data_create */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", room);
+
if (tport) {
/* We need to use the full command, because we need NO_TEL
* and Z_TEL checking */
dbref
do_create(dbref player, char *name, int cost)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref);
dbref loc;
dbref thing;
/* and we're done */
notify_format(player, "Created: Object %s.", unparse_dbref(thing));
current_state.things++;
- local_data_create(thing);
+ /* Replacement for local_data_create */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", thing);
+
return thing;
}
return NOTHING;
dbref
do_clone(dbref player, char *name, char *newname, int preserve)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref , dbref);
dbref clone, thing;
char dbnum[BUFFER_LEN];
else
moveto(clone, Location(player));
current_state.things++;
- local_data_clone(clone, thing);
+ /* Replacement for local_data_clone */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_clone", clone,thing);
+
real_did_it(player, clone, NULL, NULL, NULL, NULL, "ACLONE", NOTHING,
global_eval_context.wenv, 0);
return clone;
Exits(clone) = NOTHING;
notify_format(player, T("Cloned: Room #%d."), clone);
current_state.rooms++;
- local_data_clone(clone, thing);
+ /* local_data_clone replacement */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_clone", clone,thing);
real_did_it(player, clone, NULL, NULL, NULL, NULL, "ACLONE", NOTHING,
global_eval_context.wenv, 0);
return clone;
if (Warnings(clone) || DPBITS(clone))
notify(player, T("Warning: @CLONE/PRESERVE on an exit with powers or warnings."));
notify_format(player, T("Cloned: Exit #%d."), clone);
- local_data_clone(clone, thing);
- return clone;
+ /* Replacement for local_data_clone */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_clone", clone,thing);
+ return clone;
}
}
return NOTHING;
dbref copy_room(dbref room, dbref newowner) {
dbref new_room;
+ struct module_entry_t *m;
+ void (*handle)(dbref);
+
/* Copy room and all its shit but not exits or zone */
new_room = new_object();
/* spruce up more later.. just copying basic room for now */
current_state.rooms++;
- local_data_create(room);
+
+ /* Replacement for local_data_create */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", room);
return new_room;
}
#include <time.h>
#endif
#include <stdlib.h>
+#include <ltdl.h>
#include "conf.h"
#include "dbio.h"
#include "externs.h"
#include "htab.h"
#include "extmail.h"
#include "confmagic.h"
+#include "modules.h"
+
+extern struct module_entry_t *module_list;
#ifdef WIN32
#pragma warning( disable : 4761) /* disable warning re conversion */
void
create_minimal_db(void)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref);
+
dbref start_room, god, master_room, master_division;
int desc_flags = AF_VISUAL | AF_NOPROG | AF_PREFIXMATCH;
PUSH(god, Contents(start_room));
add_player(god);
s_Pennies(god, START_BONUS);
- local_data_create(god);
+
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_create", god);
+
current_state.players++;
set_name(master_room, "Master Room");
#include <limits.h>
#include <stdlib.h>
#include <string.h>
+#include <ltdl.h>
#include "copyrite.h"
#include "conf.h"
#include "flags.h"
#include "lock.h"
#include "confmagic.h"
+#include "modules.h"
+extern struct module_entry_t *module_list;
dbref first_free = NOTHING; /**< Object at top of free list */
void
free_object(dbref thing)
{
+ struct module_entry_t *m;
+ void (*handle)(dbref);
+
dbref i, loc;
if (!GoodObject(thing))
return;
- local_data_free(thing);
+
+ /* Replacement for data_free */
+ MODULE_ITER(m)
+ MODULE_FUNC(handle, m->handle, "module_data_free", thing);
switch (Typeof(thing)) {
case TYPE_DIVISION:
void
dbck(void)
{
+ struct module_entry_t *m;
+ void (*handle)();
+
check_fields();
check_contents();
check_locations();
check_connected_rooms();
check_zones();
check_divisions();
- local_dbck();
+
+ /* Replacement for local_dbck */
+ MODULE_ITER(m)
+ MODULE_FUNC_NOARGS(handle, m->handle, "module_dbck");
}
/* Do division integrity checks */
+++ /dev/null
-/*-----------------------------------------------------------------
- * Local flags
- *
- * This file is reserved for local flags that you may wish
- * to hack into PennMUSH.
- * This file will not be overwritten when you update
- * to a new distribution, so it's preferable to add new flags
- * here and leave flag.c alone.
- *
- * YOU ARE RESPONSIBLE FOR SEEING THAT YOU DO THIS RIGHT -
- * It's probably smarter to have God @flag/add rather than
- * do it here, as @flag/add does extensive checks for safety,
- * and add_flag() doesn't! Remember that flags are saved in the
- * database, so flags added here won't overwrite flags that
- * are already defined. When in doubt, use @flag.
- *
- * It is explicitly safe to try to add_flag() an existing flag.
- * It won't do anything, but it won't be harmful.
- *
- */
-
-/* Here are some includes you're likely to need or want.
- */
-#include "copyrite.h"
-#include "config.h"
-#include <string.h>
-#include "conf.h"
-#include "externs.h"
-#include "flags.h"
-#include "confmagic.h"
-
-void local_flags(void);
-
-
-void
-local_flags()
-{
-#ifdef EXAMPLE
- add_flag("BIG", 'B', TYPE_PLAYER | TYPE_THING, F_ANY, F_ANY);
-#endif
-}
flag_add(hashfind("FLAG", &htab_flagspaces), "CHAN_FIRSTMATCH", f);
if (!match_flag("CHAN_MATCHFIRST"))
flag_add(hashfind("FLAG", &htab_flagspaces), "CHAN_MATCHFIRST", f);
-
- local_flags();
}
/** Extract object type from old-style flag value.
#include "confmagic.h"
static void func_hash_insert(const char *name, FUN *func);
-extern void local_functions(void);
static int apply_restrictions(unsigned int result, const char *restriction);
USERFN_ENTRY *userfn_tab; /**< Table of user-defined functions */
for (ftp = flist; ftp->name; ftp++) {
function_add(ftp->name, ftp->fun, ftp->minargs, ftp->maxargs, ftp->flags);
}
- local_functions();
+ /* local_functions() no longer needed with modules */
}
/** Function initization to perform after reading the config file.
+++ /dev/null
-/*-----------------------------------------------------------------
- * Local functions
- *
- * This file is reserved for local functions that you may wish
- * to hack into PennMUSH. Read parse.h for information on adding
- * functions. This file will not be overwritten when you update
- * to a new distribution, so it's preferable to add new functions
- * here and leave the other fun*.c files alone.
- *
- */
-
-/* Here are some includes you're likely to need or want.
- * If your functions are doing math, include <math.h>, too.
- */
-#include "copyrite.h"
-#include "config.h"
-#include <string.h>
-#include "conf.h"
-#include "externs.h"
-#include "parse.h"
-#include "confmagic.h"
-#include "boolexp.h"
-#include "function.h"
-
-void local_functions(void);
-
-/* Here you can use the new add_function instead of hacking into function.c
- * Example included :)
- */
-
-#ifdef EXAMPLE
-FUNCTION(local_fun_silly)
-{
- safe_format(buff, bp, "Silly%sSilly", args[0]);
-}
-
-#endif
-
-void
-local_functions()
-{
-#ifdef EXAMPLE
- function_add("SILLY", local_fun_silly, 1, 1, FN_REG);
-#endif
-}
#endif
return 1;
} else {
- local_dump_database();
+ /* Replacement local_dump_database */
MODULE_ITER(m)
MODULE_FUNC_NOARGS(handle, m->handle, "module_dump_database");
memset(¤t_state, 0, sizeof current_state);
/* Load all the config file stuff except restrict_* */
- local_configs();
+ /* local_configs() replacement */
MODULE_ITER(m)
MODULE_FUNC_NOARGS(handler, m->handle, "module_configs");
start_cron(); /* Start the MUSH Cron Daemon */
#endif /* CRON */
/* Call Local Startup */
- local_startup();
+ /* local_startup() replacement */
MODULE_ITER(m)
MODULE_FUNC_NOARGS(handle, m->handle, "module_startup");
+++ /dev/null
-/*-----------------------------------------------------------------
- * Local stuff
- *
- * This file contains custom stuff, and some of the items here are
- * called from within PennMUSH at specific times.
- */
-
-/* Here are some includes you're likely to need or want.
- */
-#include "copyrite.h"
-#include "config.h"
-#include <string.h>
-#include "conf.h"
-#include "dbio.h"
-#include "externs.h"
-#include "parse.h"
-#include "htab.h"
-#include "command.h"
-#include "confmagic.h"
-
-extern HASHTAB htab_reserved_aliases;
-
-/* Called after all MUSH init is done.
- */
-void
-local_startup(void)
-{
-}
-
-/* Add you own runtime configuration options here, and you can set
- * them in mush.cnf.
- */
-void
-local_configs()
-{
-#ifdef EXAMPLE
- /* For each config parameter you add, you should initialize it as a
- * static variable here (or a global variable elsewhere in your
- * code)
- */
- static int config_example = 1;
- static char config_string[BUFFER_LEN];
-#endif
-
- /* Initial size of this hashtable should be close to the number of
- * add_config()'s you plan to do.
- */
- hashinit(&local_options, 4, sizeof(COBRA_CONF));
-
-#ifdef EXAMPLE
- /* Call add_config for each config parameter you want to add.
- * Note the use of &config_example for simple types (bool, int),
- * but just config_string for strings.
- */
- add_config("use_example", cf_bool, &config_example, sizeof config_example,
- "cosmetic");
- add_config("some_string", cf_str, config_string, sizeof config_string,
- "cosmetic");
-#endif
-}
-
-
-/* Wrap any calls to stdio functions in local_dump_database() and stuff
- * it calls in the OUTPUT() macro, which does error checking so we can
- * report problems with a save so it's caught before damage is
- * done and you loose a db. . putref(), putstring(), and such don't need
- * them.
- * For example:
- *
- * putref(fp, 18);
- * OUTPUT(putc('\n', fp));
- */
-
-/* Called when the database will be saved
- * This is called JUST before we dump the
- * database to disk
- * Use to save any in-memory structures
- * back to disk
- */
-void
-local_dump_database(void)
-{
-}
-
-/* Called when the MUSH is shutting down.
- * The DB has been saved and descriptors closed
- * The log files are still open though.
- */
-void
-local_shutdown(void)
-{
-}
-
-/* Called when the MUSH is performing a dbck database check,
- * at the end of the check. A good place to add any regular
- * consistency checking you require.
- */
-void
-local_dbck(void)
-{
-}
-
-/* This is called exactly once a second
- * After the MUSH has done all it's stuff
- */
-void
-local_timer(void)
-{
-}
-
-/* Called when a player connects. If this is a new creation,
- * isnew will be true. num gives the number of connections by
- * that player (so if num > 1, this is a multiple connect).
- */
-void
-local_connect(dbref player __attribute__ ((__unused__)),
- int isnew __attribute__ ((__unused__)),
- int num __attribute__ ((__unused__)))
-{
-}
-
-/* Called when a player disconnects. If num > 1, this is
- * a partial disconnect.
- */
-void
-local_disconnect(dbref player __attribute__ ((__unused__)),
- int num __attribute__ ((__unused__)))
-{
-}
-
-
-/* For serious hackers only */
-
-/* Those who are depraved enough to do so (Like me), can always
- * abuse this as a new and better way of Always Doing Stuff
- * to objects.
- * Like, say you want to put out a message on the admin
- * channel every time an object is destroyed, do so in the
- * local_data_destroy() routine.
- */
-
-/* Called when a object is created with @create (or @dig, @link)
- * This is done AFTER object-specific setup, so the types
- * etc will already be set, and object-specific initialization
- * will be done.
- * Note that the game will ALWAYS set the LocData to NULL before
- * this routine is called.
- */
-
-/* For a well-commented example of how to use this code,
- * see: ftp://bimbo.hive.no/pub/PennMUSH/coins.tar.gz
- */
-
-void
-local_data_create(dbref object __attribute__ ((__unused__)))
-{
-}
-
-/* Called when an object is cloned. Since clone is a rather
- * specific form of creation, it has it's own function.
- * Note that local_data_create() is NOT called for this object
- * first, but the system will always set LocData to NULL first.
- * Clone is the 'new' object, while source is the one it's
- * being copied from.
- */
-
-void
-local_data_clone(dbref clone __attribute__ ((__unused__)),
- dbref source __attribute__ ((__unused__)))
-{
-}
-
-/* Called when a object is REALLY destroyed, not just set
- * Going.
- */
-
-void
-local_data_free(dbref object __attribute__ ((__unused__)))
-{
-}
-
-/* Initiation of objects after a reload or dumping to disk should
- * be handled in local_dump_database() and local_startup().
- */
-
-
-/* This function is called *before* most standard interaction checks,
- * and can override them. You probably want to do as little as possible
- * here and do most of the work in local_can_interact_last instead.
- * If this returns NOTHING, it means 'go on to more checks'
- */
-int
-local_can_interact_first(dbref from __attribute__ ((__unused__)),
- dbref to __attribute__ ((__unused__)), int type
- __attribute__ ((__unused__)))
-{
-
- return NOTHING;
-}
-
-/* This one is called *after* most standard interaction checks. */
-int
-local_can_interact_last(dbref from __attribute__ ((__unused__)),
- dbref to __attribute__ ((__unused__)), int type
- __attribute__ ((__unused__)))
-{
- /* from is where the message is coming from, in theory. It makes sense
- * for sound, but think of it as light rays for visiblity or matching.
- * The rays come *from* someone standing in a room, and go *to* the person
- * looking around.
- */
-
-#ifdef NEVER
- /* Various examples follow */
-
- switch (type) {
- case INTERACT_SEE:
- /* Someone standing in a room, or doing
- * @verb type stuff that's @bar, @obar, and @abar
- */
-
- /* Probably a good idea */
- if (See_All(to))
- return 1;
-
- break;
-
- case INTERACT_PRESENCE:
- /* Someone arriving or leaving, connecting or disconnecting,
- * and (for objects) growing or losing ears.
- */
-
- /* To prevent spying, always notice presence */
- return 1;
-
- break;
-
- case INTERACT_HEAR:
- /* People talking */
-
- /* Telepathy example. Players who can hear telepathy get @set
- * HEAR_TELEPATHY, players currently using telepathy should be
- * @set USE_TELEPATHY. */
-
- if (has_flag_by_name(from, "USE_TELEPATHY", NOTYPE))
- return has_flag_by_name(to, "HEAR_TELEPATHY", NOTYPE);
-
- break;
-
- case INTERACT_MATCH:
- /* Matching object names so you can pick them up, go through exits,
- etc. */
-
- break;
- }
-
- /* Splits the universe in half, half FOO and half not. */
- return (has_flag_by_name(to, "FOO", NOTYPE) ==
- has_flag_by_name(from, "FOO", NOTYPE));
-
-
-#endif /* NEVER */
-
- /* You want to return NOTHING if you haven't made up your mind */
- return NOTHING;
-
-}
current_state.players++;
- local_data_create(player);
+ /* Replacement for local_data_create */
MODULE_ITER(m)
MODULE_FUNC(handle, m->handle, "module_data_create", player);
rplog_reset();
#endif
- local_timer();
-
+ /* Replacement for local_timer */
MODULE_ITER(m)
MODULE_FUNC_NOARGS(handle, m->handle, "module_timer");
}
#include <wtypes.h>
#include <winbase.h> /* For GetCurrentProcessId() */
#endif
+#include <ltdl.h>
#include "conf.h"
#include "match.h"
#include "parse.h"
#include "lock.h"
#include "confmagic.h"
+#include "modules.h"
+
+
+extern struct module_entry_t *module_list;
dbref find_entrance(dbref door);
void initialize_mt(void);
can_interact(dbref from, dbref to, int type)
{
int lci;
+ struct module_entry_t *m;
+ int (*handle)(dbref, dbref, int);
/* This shouldn't even be checked for rooms and garbage, but we're
* paranoid. Trying to stop interaction with yourself will not work 99%
return 1;
/* This function can override standard checks! */
- lci = local_can_interact_first(from, to, type);
- if (lci != NOTHING)
- return lci;
+ /* This doohicky is the replacement for local_can_interact_first */
+ MODULE_ITER(m) {
+ handle = MODULE_FUNCRET(m->handle, "module_can_interact_first")
+ if(handle) {
+ if((lci = handle(from, to , type)) != NOTHING)
+ return lci;
+ }
+ }
/* Standard checks */
if ((from == Location(to)) || (to == Location(from)) || controls(to, from))
return 1;
- lci = local_can_interact_last(from, to, type);
- if (lci != NOTHING)
- return lci;
+ MODULE_ITER(m) {
+ handle = MODULE_FUNCRET(m->handle, "module_can_interact_first")
+ if(handle) {
+ if((lci = handle(from, to , type)) != NOTHING)
+ return lci;
+ }
+ }
return 1;
}