]> granicus.if.org Git - nethack/commitdiff
Add sysconf BONES_POOLS to allow more bones-files per level
authorPasi Kallinen <paxed@alt.org>
Sun, 20 Aug 2017 20:04:55 +0000 (23:04 +0300)
committerPasi Kallinen <paxed@alt.org>
Sun, 20 Aug 2017 20:04:59 +0000 (23:04 +0300)
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.

doc/fixes36.1
include/sys.h
src/files.c
src/sys.c
sys/unix/sysconf
sys/vms/sysconf
sys/winnt/sysconf

index 5e78268553f44637a9fe3ac01bf0c32cafa54b07..530523f43b083e3f6877cf0f0763fae430287498 100644 (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,
        extra healing, or full healing might have blindness cured (depends on
        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
index 91c5d3522fd6f9d933a4696c89ee2ae346ddf5dc..17bbadb85f871a2d0859e40377cee7347eb29dbd 100644 (file)
@@ -27,6 +27,7 @@ struct sysopt {
     int seduce;
     int check_save_uid; /* restoring savefile checks UID? */
     int check_plname; /* use plname for checking wizards/explorers/shellers */
+    int bones_pools;
 
     /* record file */
     int persmax;
index 1c55133cb5c82429f984d7fd44e18dd4dbe0c38b..abda2a7704ff073b6606296d7d7d4cf9b1459ec1 100644 (file)
@@ -704,6 +704,10 @@ d_level *lev;
         Sprintf(dptr, ".%c", sptr->boneid);
     else
         Sprintf(dptr, ".%d", lev->dlevel);
+#ifdef SYSCF
+    if (sysopt.bones_pools > 1)
+        Sprintf(eos(file), ".%d", (ubirthday % sysopt.bones_pools));
+#endif
 #ifdef VMS
     Strcat(dptr, ";1");
 #endif
@@ -2278,6 +2282,9 @@ int src;
         if (sysopt.genericusers)
             free((genericptr_t) sysopt.genericusers);
         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)) {
         if (sysopt.support)
             free((genericptr_t) sysopt.support);
index c0803d480cc8700d67cf258e5044cb4648ceca46..6adc8f71fbf37bedd8596220647b77f3c35c942f 100644 (file)
--- a/src/sys.c
+++ b/src/sys.c
@@ -40,6 +40,7 @@ sys_early_init()
     sysopt.explorers = (char *) 0;
     sysopt.genericusers = (char *) 0;
     sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
+    sysopt.bones_pools = 0;
 
     /* record file */
     sysopt.persmax = PERSMAX;
index d83aeff7df69b4e9aa1091483abdae3afdd38f23..eacca35ed0ec07ff2f07a83b0e8e6f59d7c941b1 100644 (file)
@@ -98,6 +98,14 @@ MAXPLAYERS=10
 #   %N first character of player name
 #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
 # if the program is built with the PANICTRACE compile-time option enabled.
 # By default PANICTRACE is enabled if BETA is defined, otherwise disabled.
index 8b52270da7b49a7c2f84b0d1c1d29c755d063b65..0d46cd4f65dbf7c32c0f37f4a8b3bdbd34c7135a 100644 (file)
 # Maximum number of score file entries to use for random statue names
 #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.
 # Use '*' for all, or list source files separated by spaces.
 # Only available if game has been compiled with DEBUG, and can be
index 2ce1da300ea8d4916d91201ca51cc3d08213bc68..7e4d9da0adb08b4ffc1772b84bbdb4da496b4669 100644 (file)
@@ -32,6 +32,14 @@ WIZARDS=*
 #   %N first character of player name
 #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).
 #MAXPLAYERS=10