Home | History | Annotate | Download | only in rogue
History log of /src/games/rogue/monster.c
RevisionDateAuthorComments
 1.18  07-Apr-2025  hgutch Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe@snert.com>
(committed with a small modification of said patch).
 1.17  11-Aug-2013  dholland branches: 1.17.36;
WARNS=5
 1.16  19-Oct-2009  dholland branches: 1.16.6; 1.16.12;
Fix '=' for '==' in a test. From NAKAJIMA Yoshihiro in PR 42177.
 1.15  12-Aug-2009  dholland sprinkle static
 1.14  14-Jan-2008  dholland branches: 1.14.10; 1.14.16;
ANSIfy. Remove unnecessary casts. Clean up for -Wsign-compare. Make more
things file-static. Other minor tidyups, and fix a couple minor bugs found
along the way.
 1.13  14-Jan-2008  dholland Whitespace/KNF nits.
 1.12  27-Dec-2007  dholland Comprehensive (or at least extensive) string handling cleanup for rogue.

This patch dates (mostly) back to 2002; the critical parts of it were
handled back then by security-officer. As far as I know, there's
nothing exploitable fixed herein.

A slightly earlier version of this patch was reviewed by Christian Biere
when I filed it as PR 34750.
 1.11  30-Mar-2006  jnemeth branches: 1.11.10;
Coverity CID 1287: not checking for error return
 1.10  09-Jun-2005  tron Change marker from "pmppc" to "powerpc" because a NetBSD-macppc build
is also affected.
 1.9  09-Jun-2005  he Add an initialization to placate -Wuninitialized.
Marked with XXXGCC for pmppc (found while compiling for it).
 1.8  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.7  10-Nov-1998  hubertf constify, per PR 6148
 1.6  11-Sep-1998  hubertf fix prototype of mon_sees(), per PR#5867
 1.5  21-Jul-1998  hubertf As per PR bin/5806 by Joseph Myers <jsm28@cam.ac.uk>/lash@tellabs.com:
- Init Random by time, not by pid
- Fix lossage with fire-spitting, monster-killing dragons
 1.4  12-Oct-1997  lukem WARNSify (not an insignificant task...)
 1.3  22-Apr-1995  cgd clean up import, NetBSD RCS Ids
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  22-Apr-1995  cgd src/games/rogue from Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.11.10.2  23-Mar-2008  matt sync with HEAD
 1.11.10.1  09-Jan-2008  matt sync with HEAD
 1.14.16.1  21-Apr-2010  matt sync to netbsd-5
 1.14.10.1  09-Dec-2009  snj Pull up following revision(s) (requested by jdarrow in ticket #1186):
games/rogue/monster.c: revision 1.16
Fix '=' for '==' in a test. From NAKAJIMA Yoshihiro in PR 42177.
 1.16.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.36.1  12-Apr-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1090):

games/rogue/rogue.h: revision 1.25
games/rogue/play.c: revision 1.11
games/rogue/monster.c: revision 1.18
games/rogue/save.c: revision 1.15
games/rogue/object.c: revision 1.15

Fix segfault when canceling "Quit" operation

When pressing 'Q' followed by anything other than 'y', make sure not to
end up calling __unreachable().
Pointed out by Anthony C Howe <achowe%snert.com@localhost>

Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe%snert.com@localhost>
(committed with a small modification of said patch).

RSS XML Feed