* available in a global config space, with the compiled-in
* entries as defaults:
* WIZARD ( a value of * allows anyone to be wizard)
+ * MAXPLAYERS (see MAX_NR_OF_PLAYERS above and nethack.sh)
+ * SUPPORT (how to get local support)(no default)
+ * RECOVER (how to recover a game at your site)(no default)
*
* The following options select how the config space is stored:
* SYSCF_FILE in the named file
/*
* If it is desirable to limit the number of people that can play Hack
- * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
+ * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS (or use
+ * MAXPLAYERS under SYSCF).
* #define MAX_NR_OF_PLAYERS 6
*/
#endif /* CHDIR */
char *support; /* local support contact */
char *recover; /* how to run recover - may be overridden by win port */
char *wizards;
+ int maxplayers;
};
E struct sysopt sysopt;
if(sysopt.recover) free(sysopt.recover);
sysopt.recover = alloc(strlen(bufp));
(void) strcpy(sysopt.recover, bufp);
+ } else if ( (src==SET_IN_SYS) && match_varname(buf, "MAXPLAYERS", 10)) {
+ int temp = atoi(bufp);
+ /* XXX to get more than 25, need to rewrite all lock code */
+ if(temp > 0 && temp <= 25){
+ sysopt.maxplayers = temp;
+ } else {
+ raw_printf("Illegal value in MAXPLAYERS.");
+ return 0;
+ }
#endif
} else if (match_varname(buf, "BOULDER", 3)) {
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
/* replace use of WIZARD vs WIZARD_NAME vs KR1ED, by filling this in */
#endif
sysopt.wizards = NULL;
+ sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
}
CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
# XXX -g vs -O should go here, -I../include goes in the makefile
-CFLAGS=-g -I../include $(CFLAGS2)
+CFLAGS=-g -I../include $(CFLAGS2) $(CFLAGS3)
CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
+CFLAGS3=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
WINSRC = $(WINTTYSRC)
WINOBJ = $(WINTTYOBJ)
HACKDIR=/usr/games/lib/nethackdir
export HACKDIR
HACK=$HACKDIR/nethack
+# NB: MAXNROFPLAYERS is deprecated in favor of MAXPLAYERS in SYSCF.
MAXNROFPLAYERS=4
# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
#include "hack.h"
#include "dlb.h"
+#include <ctype.h>
#include <sys/stat.h>
#include <signal.h>
#include <pwd.h>
}
}
+ /* XXX This is deprecated in favor of SYSCF with MAXPLAYERS. Make
+ * an error in next release. */
if(argc > 1)
locknum = atoi(argv[1]);
#ifdef MAX_NR_OF_PLAYERS
+ /* limit to compile-time limit */
if(!locknum || locknum > MAX_NR_OF_PLAYERS)
locknum = MAX_NR_OF_PLAYERS;
#endif
+#ifdef SYSCF
+ /* let syscf override compile-time limit */
+ if(!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))
+ locknum = sysopt.maxplayers;
+#endif
}
#ifdef CHDIR