add MAXPLAYERS to SYSCF (trunk only)

Add MAXPLAYERS to SYSCF config file; deprecate (but continue to support)
 MAX_NR_OF_PLAYERS in nethack.sh since it is trivially overridden in many
 (all?) cases and isn't useful for ports that don't use nethack.sh.
This commit is contained in:
keni
2008-04-07 22:27:18 +00:00
parent 47d1eea0dd
commit 97abafd41a
7 changed files with 28 additions and 2 deletions

View File

@@ -18,8 +18,9 @@ HACKDIR=$(PREFIX)/nethackdir
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)

View File

@@ -4,6 +4,7 @@
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

View File

@@ -7,6 +7,7 @@
#include "hack.h"
#include "dlb.h"
#include <ctype.h>
#include <sys/stat.h>
#include <signal.h>
#include <pwd.h>
@@ -373,12 +374,20 @@ char *argv[];
}
}
/* 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