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:
@@ -149,6 +149,9 @@
|
|||||||
* available in a global config space, with the compiled-in
|
* available in a global config space, with the compiled-in
|
||||||
* entries as defaults:
|
* entries as defaults:
|
||||||
* WIZARD ( a value of * allows anyone to be wizard)
|
* 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:
|
* The following options select how the config space is stored:
|
||||||
* SYSCF_FILE in the named file
|
* SYSCF_FILE in the named file
|
||||||
@@ -270,7 +273,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If it is desirable to limit the number of people that can play Hack
|
* 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
|
* #define MAX_NR_OF_PLAYERS 6
|
||||||
*/
|
*/
|
||||||
#endif /* CHDIR */
|
#endif /* CHDIR */
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ struct sysopt {
|
|||||||
char *support; /* local support contact */
|
char *support; /* local support contact */
|
||||||
char *recover; /* how to run recover - may be overridden by win port */
|
char *recover; /* how to run recover - may be overridden by win port */
|
||||||
char *wizards;
|
char *wizards;
|
||||||
|
int maxplayers;
|
||||||
};
|
};
|
||||||
E struct sysopt sysopt;
|
E struct sysopt sysopt;
|
||||||
|
|
||||||
|
|||||||
@@ -2078,6 +2078,15 @@ int src;
|
|||||||
if(sysopt.recover) free(sysopt.recover);
|
if(sysopt.recover) free(sysopt.recover);
|
||||||
sysopt.recover = alloc(strlen(bufp));
|
sysopt.recover = alloc(strlen(bufp));
|
||||||
(void) strcpy(sysopt.recover, 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
|
#endif
|
||||||
} else if (match_varname(buf, "BOULDER", 3)) {
|
} else if (match_varname(buf, "BOULDER", 3)) {
|
||||||
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
|
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE,
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ sys_early_init(){
|
|||||||
/* replace use of WIZARD vs WIZARD_NAME vs KR1ED, by filling this in */
|
/* replace use of WIZARD vs WIZARD_NAME vs KR1ED, by filling this in */
|
||||||
#endif
|
#endif
|
||||||
sysopt.wizards = NULL;
|
sysopt.wizards = NULL;
|
||||||
|
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ HACKDIR=$(PREFIX)/nethackdir
|
|||||||
CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
|
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
|
# 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)\"
|
CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
|
||||||
|
CFLAGS3=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||||
|
|
||||||
WINSRC = $(WINTTYSRC)
|
WINSRC = $(WINTTYSRC)
|
||||||
WINOBJ = $(WINTTYOBJ)
|
WINOBJ = $(WINTTYOBJ)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
HACKDIR=/usr/games/lib/nethackdir
|
HACKDIR=/usr/games/lib/nethackdir
|
||||||
export HACKDIR
|
export HACKDIR
|
||||||
HACK=$HACKDIR/nethack
|
HACK=$HACKDIR/nethack
|
||||||
|
# NB: MAXNROFPLAYERS is deprecated in favor of MAXPLAYERS in SYSCF.
|
||||||
MAXNROFPLAYERS=4
|
MAXNROFPLAYERS=4
|
||||||
|
|
||||||
# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
|
# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "dlb.h"
|
#include "dlb.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pwd.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)
|
if(argc > 1)
|
||||||
locknum = atoi(argv[1]);
|
locknum = atoi(argv[1]);
|
||||||
#ifdef MAX_NR_OF_PLAYERS
|
#ifdef MAX_NR_OF_PLAYERS
|
||||||
|
/* limit to compile-time limit */
|
||||||
if(!locknum || locknum > MAX_NR_OF_PLAYERS)
|
if(!locknum || locknum > MAX_NR_OF_PLAYERS)
|
||||||
locknum = MAX_NR_OF_PLAYERS;
|
locknum = MAX_NR_OF_PLAYERS;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SYSCF
|
||||||
|
/* let syscf override compile-time limit */
|
||||||
|
if(!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))
|
||||||
|
locknum = sysopt.maxplayers;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHDIR
|
#ifdef CHDIR
|
||||||
|
|||||||
Reference in New Issue
Block a user