]> granicus.if.org Git - nethack/commitdiff
Guidebook update and SEDUCE runtime switch
authorkeni <keni>
Thu, 13 May 2010 00:54:13 +0000 (00:54 +0000)
committerkeni <keni>
Thu, 13 May 2010 00:54:13 +0000 (00:54 +0000)
add SYSCF docs to the Guidebook because it's info needed in a binary distro
Guidebook.tex - also add some missing italics to some "NetHack" occurances
call nethack.org "official"
Guidebook.txt - didn't regenerate cleanly so no diff
add SEDUCE to SYSCF (only partly inspired by the recent email)

12 files changed:
doc/Guidebook.mn
include/config.h
include/extern.h
include/sys.h
src/files.c
src/mhitu.c
src/monst.c
src/sounds.c
src/sys.c
src/uhitm.c
src/zap.c
sys/unix/sysconf

index a1c17507e2a5d525e0169d34f08cac619c86b44e..43d1e1dc22ec72e079c3ee6bd05b87ebe0733a88 100644 (file)
@@ -1650,7 +1650,8 @@ command allows you to view all options and change most of them.
 You can also set options automatically by placing them in the
 NETHACKOPTIONS environment variable or in a configuration file.
 Some versions of NetHack also have front-end programs that allow
-you to set options before starting the game.
+you to set options before starting the game or a global configuration
+for system administrators.
 .hn 2
 Using the NETHACKOPTIONS environment variable
 .pg
@@ -2638,6 +2639,56 @@ This will assist in the interface to speech synthesizers.
 A lot of speech access programs use the number-pad to review the screen.
 If this is the case, disable the number_pad option and use the traditional
 Rogue-like commands.
+.hn 2
+Global Configuration for System Administrators
+.pg
+If NetHack is compiled with the SYSCF option, a system administrator
+should set up a global configuration; this is a file in the
+same format as the traditional per-user configuration file (see above).
+This file should be named sysconf and placed in the same directory as
+the other NetHack support files.
+The options recognized in this file are listed below.  Any option not
+set uses a compiled-in default (which may not be appropriate for your
+system).
+.pg
+.lp
+WIZARDS
+A space-separated list of user names who are allowed to play in wizard
+mode (the debugging mode, not the magic-using role).  A value of a single
+asterisk (*) allows anyone to start a game in wizard mode.
+.lp
+SHELLERS
+A list of users who are allowed to use the shell escape command (!).  The
+syntax is the same as WIZARDS.
+.lp
+MAXPLAYERS
+Limit the maximum number of games that can be running at the same time.
+.lp
+SUPPORT
+A string explaining how to get local support (no default value).
+.lp
+RECOVER
+A string explaining how to recover a game on this system (no default value).
+.lp
+SEDUCE
+0 or 1 to disable or enable, respectively, the SEDUCE option (see the source
+for details on this function).
+.pg
+The following options affect the score file:
+.pg
+.lp
+PERSMAX
+Maximum number of entries for one person.
+.lp
+ENTRYMAX
+Maximum number of entries in the score file.
+.lp
+POINTSMIN
+Minimum number of points to get an entry in the score file.
+.lp
+PERS_IS_UID
+0 or 1 to use user names or numeric userids, respectively, to identify
+unique people for the score file.
 .hn 1
 Scoring
 .pg
@@ -2881,7 +2932,7 @@ it for 3.3.1.
 \fBChristian ``Marvin'' Bressler\fP maintained 3.5 for the Atari after he 
 resurrected it for 3.3.1.
 .pg
-There is a NetHack web site maintained by \fBKen Lorber\fP at http://www.nethack.org/.
+The official NetHack web site is maintained by \fBKen Lorber\fP at http://www.nethack.org/.
 .pg
                           - - - - - - - - - -
 .pg
index 9d39b4da8160d090525eabff43b09a6a674bbf7d..1497e361baa4387577fd469392b29b35a3cbcf2c 100644 (file)
  *             ENTRYMAX        (max entries in the record file)
  *             POINTSMIN       (min points to get an entry)
  *             PERS_IS_UID     (0 or 1 - person is name or (numeric) userid)
+ *             SEDUCE          (0 or 1 - runtime disable/enable SEDUCE option)
  *
  *             The following options select how the config space is stored:
  *             SYSCF_FILE      in the named file
index cf50c0d037bfe5422a94b547a9c9cbaf7b6b66e8..0dd3580b334ac3dbdba7c046661bdc91cf0c25db 100644 (file)
@@ -2118,6 +2118,12 @@ E int FDECL(add_sound_mapping, (const char *));
 E void FDECL(play_sound_for_message, (const char *));
 #endif
 
+/* ### sys.c ### */
+
+#ifdef SYSCF
+E void FDECL(sysopt_seduce_set,(int));
+#endif
+
 /* ### sys/msdos/sound.c ### */
 
 #ifdef MSDOS
index 26cab6a508f0dc9f18bc0caf319df91a9277d06c..a45478fc49f3820e3018c12cb8ac7c2dd24bf2d0 100644 (file)
@@ -29,8 +29,15 @@ struct sysopt {
        int panictrace_glibc;
 # endif
 #endif
+       int seduce;
 };
 E struct sysopt sysopt;
 
+#ifdef SEDUCE
+# define SYSOPT_SEDUCE sysopt.seduce
+#else
+# define SYSOPT_SEDUCE 0
+#endif
+
 #endif /* SYS_H */
 
index c9d157927adc16c43800f3950ea5a7d887d80b78..394854c6c48e78e2c5a022c11b05b45e3f8b55de 100644 (file)
@@ -2092,6 +2092,15 @@ int              src;
            if(sysopt.recover) free(sysopt.recover);
            sysopt.recover = (char*)alloc(strlen(bufp)+1);
            Strcpy(sysopt.recover, bufp);
+       } else if ( match_varname(buf, "SEDUCE", 6)) {
+           int temp = !!atoi(bufp);    /* XXX this could be tighter */
+               /* allow anyone to turn it off, but only sysconf to turn it on*/
+           if(src!=SET_IN_SYS && temp!=0){
+               raw_printf("Illegal value in SEDUCE");
+               return 0;
+           }
+           sysopt.seduce = temp;
+           sysopt_seduce_set(temp);
        } else if ( (src==SET_IN_SYS) && match_varname(buf, "MAXPLAYERS", 10)) {
            int temp = atoi(bufp);
                /* XXX to get more than 25, need to rewrite all lock code */
index 3055c624edfeb68b9a730db249b8bb26da5f1716..e5d6f84b99f4e2c939a40be96c832f0ec55acd72 100644 (file)
@@ -1251,6 +1251,17 @@ dopois:
                if(!mtmp->mcan) stealgold(mtmp);
                break;
 
+#ifdef SEDUCE
+           case AD_SSEX:
+               if(SYSOPT_SEDUCE){
+               if(could_seduce(mtmp, &youmonst, mattk) == 1
+                       && !mtmp->mcan)
+                   if (doseduce(mtmp))
+                       return 3;
+               break;
+               }
+               /* else FALLTHRU */
+#endif
            case AD_SITM:       /* for now these are the same */
            case AD_SEDU:
                if (is_animal(mtmp->data)) {
@@ -1259,7 +1270,7 @@ dopois:
                        /* Continue below */
                } else if (dmgtype(youmonst.data, AD_SEDU)
 #ifdef SEDUCE
-                       || dmgtype(youmonst.data, AD_SSEX)
+                       || (SYSOPT_SEDUCE && dmgtype(youmonst.data, AD_SSEX))
 #endif
                                                ) {
                        pline("%s %s.", Monnam(mtmp), mtmp->minvent ?
@@ -1300,14 +1311,7 @@ dopois:
                        return 3;
                }
                break;
-#ifdef SEDUCE
-           case AD_SSEX:
-               if(could_seduce(mtmp, &youmonst, mattk) == 1
-                       && !mtmp->mcan)
-                   if (doseduce(mtmp))
-                       return 3;
-               break;
-#endif
+
            case AD_SAMU:
                hitmsg(mtmp, mattk);
                /* when the Wiz hits, 1/20 steals the amulet */
@@ -2196,7 +2200,7 @@ struct attack *mattk;
 
        if(agrinvis && !defperc
 #ifdef SEDUCE
-               && mattk && mattk->adtyp != AD_SSEX
+               && (!SYSOPT_SEDUCE || ( mattk && mattk->adtyp != AD_SSEX))
 #endif
                )
                return 0;
@@ -2204,7 +2208,7 @@ struct attack *mattk;
        if(pagr->mlet != S_NYMPH
                && ((pagr != &mons[PM_INCUBUS] && pagr != &mons[PM_SUCCUBUS])
 #ifdef SEDUCE
-                   || (mattk && mattk->adtyp != AD_SSEX)
+                   || (SYSOPT_SEDUCE && mattk && mattk->adtyp != AD_SSEX)
 #endif
                   ))
                return 0;
index 72eb609e5f76163c019047ba01bab0ad1f3d1fd9..5e1aeb4c63ae8473caf1be5e6d290ea645b31e85 100644 (file)
@@ -2548,14 +2548,16 @@ struct permonst _mons2[] = {
        M3_INFRAVISIBLE|M3_INFRAVISION, CLR_BLUE),
        /* standard demons & devils
         */
-#ifdef SEDUCE
-# define SEDUCTION_ATTACKS \
+#define SEDUCTION_ATTACKS_YES \
        A(ATTK(AT_BITE, AD_SSEX, 0, 0), ATTK(AT_CLAW, AD_PHYS, 1, 3), \
          ATTK(AT_CLAW, AD_PHYS, 1, 3), NO_ATTK, NO_ATTK, NO_ATTK)
-#else
-# define SEDUCTION_ATTACKS \
+#define SEDUCTION_ATTACKS_NO \
        A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), \
          ATTK(AT_BITE, AD_DRLI, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK)
+#ifdef SEDUCE
+# define SEDUCTION_ATTACKS SEDUCTION_ATTACKS_YES
+#else
+# define SEDUCTION_ATTACKS SEDUCTION_ATTACKS_NO
 #endif
     MON("succubus", S_DEMON,
        LVL(6, 12, 0, 70, -9), (G_NOCORPSE|1),
@@ -3479,6 +3481,10 @@ monst_init()
 {
     return;
 }
+
+struct attack sa_yes[NATTK] = SEDUCTION_ATTACKS_YES;
+struct attack sa_no[NATTK] = SEDUCTION_ATTACKS_NO;
+
 #endif
 
 /*monst.c*/
index 54921d554ce3185bba364087d44be9f60a36f5d9..9dfba7fc0bf476a55d445e41848f55eba0744480 100644 (file)
@@ -779,17 +779,20 @@ register struct monst *mtmp;
            }
            break;
        case MS_SEDUCE:
+           {
+           int swval;
 #ifdef SEDUCE
-           if (ptr->mlet != S_NYMPH &&
+           if (SYSOPT_SEDUCE) {
+             if (ptr->mlet != S_NYMPH &&
                could_seduce(mtmp, &youmonst, (struct attack *)0) == 1) {
                        (void) doseduce(mtmp);
                        break;
-           }
-           switch ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0)
-#else
-           switch ((poly_gender() == 0) ? rn2(3) : 0)
+             }
+             swval = ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0);
+           } else
 #endif
-           {
+             swval = ((poly_gender() == 0) ? rn2(3) : 0);
+           switch(swval){
                case 2:
                        verbl_msg = "Hello, sailor.";
                        break;
@@ -799,6 +802,7 @@ register struct monst *mtmp;
                default:
                        pline_msg = "cajoles you.";
            }
+           }
            break;
 #ifdef KOPS
        case MS_ARREST:
index 5dedfb71ef565201419bd9084d3280f967430a15..655cecfe67bb7d52c0ad85f5e737ee4a841c3a53 100644 (file)
--- a/src/sys.c
+++ b/src/sys.c
@@ -47,5 +47,25 @@ sys_early_init(){
 #  endif
 # endif
 #endif
+
+#ifdef SEDUCE
+       sysopt.seduce = 1;      /* if it's compiled in, default to on */
+       sysopt_seduce_set(sysopt.seduce);
+#endif
 }
 
+
+extern struct attack sa_yes[NATTK];
+extern struct attack sa_no[NATTK];
+
+void
+sysopt_seduce_set(val)
+       int val;
+{
+       struct attack *setval = val ? sa_yes : sa_no;
+       int x;
+       for(x=0; x<NATTK; x++){
+               mons[PM_INCUBUS].mattk[x] = setval[x];
+               mons[PM_SUCCUBUS].mattk[x] = setval[x];
+       }
+}
index 8017d5dba85972391fd671ac2e6d94582956a303..b1c769a34be73c0ccd5818fbca096916ddc44168 100644 (file)
@@ -2075,7 +2075,8 @@ use_weapon:
                        /* succubi/incubi are humanoid, but their _second_
                         * attack is AT_CLAW, not their first...
                         */
-                       if (i==1 && uwep && (u.umonnum == PM_SUCCUBUS ||
+                       if (SYSOPT_SEDUCE && i==1 && uwep &&
+                               (u.umonnum == PM_SUCCUBUS ||
                                u.umonnum == PM_INCUBUS)) goto use_weapon;
 #endif
                case AT_KICK:
index 684d5f1d8edd3f48683a87046bef4e6144069dc3..6a2a06f84386bc41f57ce339c9e9e6ff7bf8bfa2 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -589,7 +589,7 @@ coord *cc;
                   but some need to stay cancelled */
                if (!dmgtype(mtmp2->data, AD_SEDU)
 #ifdef SEDUCE
-                               && !dmgtype(mtmp2->data, AD_SSEX)
+                               && (!SYSOPT_SEDUCE || !dmgtype(mtmp2->data, AD_SSEX))
 #endif
                    ) mtmp2->mcan = 0;
                mtmp2->mcansee = 1;     /* set like in makemon */
index f2181c77f22513d5dcae39782b6797344291980a..1f9da26ee6fda8de494a997bd062b742729dd90b 100644 (file)
@@ -23,6 +23,9 @@ MAXPLAYERS=10
 # If not null, displayed at the end of a panic-save sequence.
 #RECOVER=Run the recover program.
 
+# Uncomment the next line to disable the SEDUCE option.
+#SEDUCE=0
+
 # Record (high score) file options.
 # CAUTION: changing these after people have started playing games can
 #  lead to lost high scores!