When SEDUCE is disabled, instead of swapping attacks in mons[] once,
do it on the fly in getmattk() whenever needed.  That allows mons[]
to become readonly, although this doesn't declare it 'const' because
doing so will require a zillion 'struct permonst *' updates to match.

This seemed trickier than it should be, but that turned out to be
because the old behavior was broken.  Setting SEDUCE=0 in sysconf or
user's own configuration file resulted in all succubus and incubus
attacks being described as monster smiles engagingly or seductively
rather than hitting (while dishing out physical damage).  I didn't
try rebuilding 3.4.3 to see whether this was already broken before
being migrated to SYSCF.
This commit is contained in:
PatR
2019-01-10 03:10:35 -08:00
parent 79d40658c7
commit b1782b813f
6 changed files with 59 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sys.c $NHDT-Date: 1448241785 2015/11/23 01:23:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* NetHack 3.6 sys.c $NHDT-Date: 1547118632 2019/01/10 11:10:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -120,13 +120,17 @@ sysopt_release()
return;
}
extern struct attack sa_yes[NATTK];
extern struct attack sa_no[NATTK];
extern const struct attack sa_yes[NATTK];
extern const struct attack sa_no[NATTK];
void
sysopt_seduce_set(val)
int val;
{
#if 0
/*
* Attack substitution is now done on the fly in getmattk(mhitu.c).
*/
struct attack *setval = val ? sa_yes : sa_no;
int x;
@@ -134,6 +138,9 @@ int val;
mons[PM_INCUBUS].mattk[x] = setval[x];
mons[PM_SUCCUBUS].mattk[x] = setval[x];
}
#else
nhUse(val);
#endif /*0*/
return;
}