Add sysconf BONES_POOLS to allow more bones-files per level

Reduce the chance of a player playing on a public server encountering
their own bones, by implementing separate bones pools. The pool a player
belongs to is determined at game start, and only bones in that pool
are used. The sysconf BONES_POOLS allows the sysadmin to define how
many pools there are.
This commit is contained in:
Pasi Kallinen
2017-08-20 23:04:59 +03:00
parent 7bb4cb1b1e
commit 1eca824321
7 changed files with 34 additions and 0 deletions
+1
View File
@@ -615,6 +615,7 @@ blinded hero or monster who eats a nurse corpse will have blindness cured
blinded hero or monster who breathes vapor from broken potion of healing, blinded hero or monster who breathes vapor from broken potion of healing,
extra healing, or full healing might have blindness cured (depends on extra healing, or full healing might have blindness cured (depends on
potion: full == always; extra == if not-cursed; plain == if blessed) potion: full == always; extra == if not-cursed; plain == if blessed)
sysconf definition BONES_POOLS to allow more bones files per level
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+1
View File
@@ -27,6 +27,7 @@ struct sysopt {
int seduce; int seduce;
int check_save_uid; /* restoring savefile checks UID? */ int check_save_uid; /* restoring savefile checks UID? */
int check_plname; /* use plname for checking wizards/explorers/shellers */ int check_plname; /* use plname for checking wizards/explorers/shellers */
int bones_pools;
/* record file */ /* record file */
int persmax; int persmax;
+7
View File
@@ -704,6 +704,10 @@ d_level *lev;
Sprintf(dptr, ".%c", sptr->boneid); Sprintf(dptr, ".%c", sptr->boneid);
else else
Sprintf(dptr, ".%d", lev->dlevel); Sprintf(dptr, ".%d", lev->dlevel);
#ifdef SYSCF
if (sysopt.bones_pools > 1)
Sprintf(eos(file), ".%d", (ubirthday % sysopt.bones_pools));
#endif
#ifdef VMS #ifdef VMS
Strcat(dptr, ";1"); Strcat(dptr, ";1");
#endif #endif
@@ -2278,6 +2282,9 @@ int src;
if (sysopt.genericusers) if (sysopt.genericusers)
free((genericptr_t) sysopt.genericusers); free((genericptr_t) sysopt.genericusers);
sysopt.genericusers = dupstr(bufp); sysopt.genericusers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "BONES_POOLS", 10)) {
n = atoi(bufp);
sysopt.bones_pools = (n < 0) ? 0 : n;
} else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) { } else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) {
if (sysopt.support) if (sysopt.support)
free((genericptr_t) sysopt.support); free((genericptr_t) sysopt.support);
+1
View File
@@ -40,6 +40,7 @@ sys_early_init()
sysopt.explorers = (char *) 0; sysopt.explorers = (char *) 0;
sysopt.genericusers = (char *) 0; sysopt.genericusers = (char *) 0;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */ sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
sysopt.bones_pools = 0;
/* record file */ /* record file */
sysopt.persmax = PERSMAX; sysopt.persmax = PERSMAX;
+8
View File
@@ -98,6 +98,14 @@ MAXPLAYERS=10
# %N first character of player name # %N first character of player name
#DUMPLOGFILE=/tmp/nethack.%n.%d.log #DUMPLOGFILE=/tmp/nethack.%n.%d.log
# Number of bones file pools.
# The pool you belong to is determined at game start. You will
# load and save bones only from that pool. Generally useful
# for public servers only.
# Changing this might make existing bones inaccessible.
# Disabled by setting to 0, or commenting out.
#BONES_POOLS=10
# Try to get more info in case of a program bug or crash. Only used # Try to get more info in case of a program bug or crash. Only used
# if the program is built with the PANICTRACE compile-time option enabled. # if the program is built with the PANICTRACE compile-time option enabled.
# By default PANICTRACE is enabled if BETA is defined, otherwise disabled. # By default PANICTRACE is enabled if BETA is defined, otherwise disabled.
+8
View File
@@ -53,6 +53,14 @@
# Maximum number of score file entries to use for random statue names # Maximum number of score file entries to use for random statue names
#MAX_STATUENAME_RANK=10 #MAX_STATUENAME_RANK=10
# Number of bones file pools.
# The pool you belong to is determined at game start. You will
# load and save bones only from that pool. Generally useful
# for public servers only.
# Changing this might make existing bones inaccessible.
# Disabled by setting to 0, or commenting out.
#BONES_POOLS=10
# Show debugging information originating from these source files. # Show debugging information originating from these source files.
# Use '*' for all, or list source files separated by spaces. # Use '*' for all, or list source files separated by spaces.
# Only available if game has been compiled with DEBUG, and can be # Only available if game has been compiled with DEBUG, and can be
+8
View File
@@ -32,6 +32,14 @@ WIZARDS=*
# %N first character of player name # %N first character of player name
#DUMPLOGFILE=nethack-%n-%d.log #DUMPLOGFILE=nethack-%n-%d.log
# Number of bones file pools.
# The pool you belong to is determined at game start. You will
# load and save bones only from that pool. Generally useful
# for public servers only.
# Changing this might make existing bones inaccessible.
# Disabled by setting to 0, or commenting out.
#BONES_POOLS=10
# Limit the number of simultaneous games (see also nethack.sh). # Limit the number of simultaneous games (see also nethack.sh).
#MAXPLAYERS=10 #MAXPLAYERS=10