]> granicus.if.org Git - nethack/commitdiff
Add MAX_STATUENAME_RANK sysconf setting
authorPasi Kallinen <paxed@alt.org>
Wed, 11 Mar 2015 17:56:34 +0000 (19:56 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 11 Mar 2015 17:59:52 +0000 (19:59 +0200)
MAX_STATUENAME_RANK tells how many score file entries to use
for random statue names.

doc/Guidebook.mn
include/sys.h
src/files.c
src/sys.c
src/topten.c
sys/unix/sysconf

index 8ce5dbaad2af93a7c966a7db48e81b49202c441f..4c499ac96fcbad21bc75db232817b0f5fc39ddcb 100644 (file)
@@ -2945,6 +2945,10 @@ Minimum number of points to get an entry in the score file.
 PERS_IS_UID
 0 or 1 to use user names or numeric userids, respectively, to identify
 unique people for the score file.
+.lp
+MAX_STATUENAME_RANK
+Maximum number of score file entries to use for random statue names
+(default is 10).
 .hn 1
 Scoring
 .pg
index 713e33a557520a328298310f00e6f55ec0e9b0f5..8358021a20eef501a9f523a7e0d6c4dfe6f6d417 100644 (file)
@@ -22,6 +22,7 @@ struct sysopt {
        int pers_is_uid;
        int entrymax;
        int pointsmin;
+       int tt_oname_maxrank;
 #ifdef PANICTRACE
                /* panic options */
        char *gdbpath;
index 2cae9fb7f80515a7c5430111d24184d6808c1ac2..d4c216276a67c0b88ace3886abf206ed93f215d1 100644 (file)
@@ -2209,6 +2209,13 @@ int              src;
                return 0;
            }
            sysopt.pointsmin = n;
+       } else if (src == SET_IN_SYS && match_varname(buf, "MAX_STATUENAME_RANK", 10)) {
+           n = atoi(bufp);
+           if (n < 1) {
+               raw_printf("Illegal value in MAX_STATUENAME_RANK (minimum is 1).");
+               return 0;
+           }
+           sysopt.tt_oname_maxrank = n;
 # ifdef PANICTRACE
        } else if (src == SET_IN_SYS &&
                match_varname(buf, "PANICTRACE_LIBC", 15)) {
index 5f17a0a91f22ab96981a731a1796df99b7f63461..14e0aa642f6d333e4ff16a9d942b8841ca4a4501 100644 (file)
--- a/src/sys.c
+++ b/src/sys.c
@@ -29,6 +29,7 @@ sys_early_init(){
        sysopt.entrymax = ENTRYMAX;
        sysopt.pointsmin = POINTSMIN;
        sysopt.pers_is_uid = PERS_IS_UID;
+       sysopt.tt_oname_maxrank = 10;
 
                /* sanity checks */
        if(PERSMAX<1) sysopt.persmax = 1;
index 58079a6dead27f49316f27f532fd38b916dc2d4f..db2e6fccb52fa3483e4d0c1386d194825704716c 100644 (file)
@@ -975,7 +975,7 @@ struct obj *otmp;
        }
 
        tt = &tt_buf;
-       rank = rnd(10);
+       rank = rnd(sysopt.tt_oname_maxrank);
 pickentry:
        for(i = rank; i; i--) {
            readentry(rfile, tt);
index 74e7fb1ae90126864fd30123ecb8a3eefd25f5de..cff28b04f4b1adeadf6967514fef83f2a744bd5e 100644 (file)
@@ -45,6 +45,9 @@ MAXPLAYERS=10
 # numeric (1) user id.
 #PERS_IS_UID=1
 
+# Maximum number of score file entries to use for random statue names
+#MAX_STATUENAME_RANK=10
+
 # Try to get more info in case of a program bug or crash.  Using GDB can
 # get more information and works on more systems but requires gdb be available;
 # using LIBC only works if NetHack is linked with a libc that supports the