Add MAX_STATUENAME_RANK sysconf setting

MAX_STATUENAME_RANK tells how many score file entries to use
for random statue names.
This commit is contained in:
Pasi Kallinen
2015-03-11 19:59:52 +02:00
parent 3243b332a3
commit a335f8306f
6 changed files with 17 additions and 1 deletions
+4
View File
@@ -2945,6 +2945,10 @@ Minimum number of points to get an entry in the score file.
PERS_IS_UID PERS_IS_UID
0 or 1 to use user names or numeric userids, respectively, to identify 0 or 1 to use user names or numeric userids, respectively, to identify
unique people for the score file. 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 .hn 1
Scoring Scoring
.pg .pg
+1
View File
@@ -22,6 +22,7 @@ struct sysopt {
int pers_is_uid; int pers_is_uid;
int entrymax; int entrymax;
int pointsmin; int pointsmin;
int tt_oname_maxrank;
#ifdef PANICTRACE #ifdef PANICTRACE
/* panic options */ /* panic options */
char *gdbpath; char *gdbpath;
+7
View File
@@ -2209,6 +2209,13 @@ int src;
return 0; return 0;
} }
sysopt.pointsmin = n; 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 # ifdef PANICTRACE
} else if (src == SET_IN_SYS && } else if (src == SET_IN_SYS &&
match_varname(buf, "PANICTRACE_LIBC", 15)) { match_varname(buf, "PANICTRACE_LIBC", 15)) {
+1
View File
@@ -29,6 +29,7 @@ sys_early_init(){
sysopt.entrymax = ENTRYMAX; sysopt.entrymax = ENTRYMAX;
sysopt.pointsmin = POINTSMIN; sysopt.pointsmin = POINTSMIN;
sysopt.pers_is_uid = PERS_IS_UID; sysopt.pers_is_uid = PERS_IS_UID;
sysopt.tt_oname_maxrank = 10;
/* sanity checks */ /* sanity checks */
if(PERSMAX<1) sysopt.persmax = 1; if(PERSMAX<1) sysopt.persmax = 1;
+1 -1
View File
@@ -975,7 +975,7 @@ struct obj *otmp;
} }
tt = &tt_buf; tt = &tt_buf;
rank = rnd(10); rank = rnd(sysopt.tt_oname_maxrank);
pickentry: pickentry:
for(i = rank; i; i--) { for(i = rank; i; i--) {
readentry(rfile, tt); readentry(rfile, tt);
+3
View File
@@ -45,6 +45,9 @@ MAXPLAYERS=10
# numeric (1) user id. # numeric (1) user id.
#PERS_IS_UID=1 #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 # 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; # 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 # using LIBC only works if NetHack is linked with a libc that supports the