From: Pasi Kallinen Date: Wed, 11 Mar 2015 17:56:34 +0000 (+0200) Subject: Add MAX_STATUENAME_RANK sysconf setting X-Git-Tag: NetHack-3.6.0_RC01~613 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a335f8306f29739dd1ea1172e9d973bb12fd326e;p=nethack Add MAX_STATUENAME_RANK sysconf setting MAX_STATUENAME_RANK tells how many score file entries to use for random statue names. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 8ce5dbaad..4c499ac96 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -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 diff --git a/include/sys.h b/include/sys.h index 713e33a55..8358021a2 100644 --- a/include/sys.h +++ b/include/sys.h @@ -22,6 +22,7 @@ struct sysopt { int pers_is_uid; int entrymax; int pointsmin; + int tt_oname_maxrank; #ifdef PANICTRACE /* panic options */ char *gdbpath; diff --git a/src/files.c b/src/files.c index 2cae9fb7f..d4c216276 100644 --- a/src/files.c +++ b/src/files.c @@ -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)) { diff --git a/src/sys.c b/src/sys.c index 5f17a0a91..14e0aa642 100644 --- 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; diff --git a/src/topten.c b/src/topten.c index 58079a6de..db2e6fccb 100644 --- a/src/topten.c +++ b/src/topten.c @@ -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); diff --git a/sys/unix/sysconf b/sys/unix/sysconf index 74e7fb1ae..cff28b04f 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -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