Article View: net.sources.games
Article #855Rogue Aggravate() bug.
From: Robert A. Monio
Date: Mon, 16 Mar 1987 05:25
Date: Mon, 16 Mar 1987 05:25
54 lines
2807 bytes
2807 bytes
In the recent posting of the rogue source a bug exists which causes a
core dump when you read a aggravate monster scroll. ("High Pitched
Humming Noise") I have not seen any postings from anyone concerning
this problem so I figured I would post this fix.
The problem exists in the file monster.c. The aggravate() routine
uses a while loop to "aggravate" the monsters on the level that the
player is currently on. While looping through the list of monsters on
that level, the pointer to the next monster is updated and the monster
is referenced before the pointer can be checked correctly. To fix
this problem, do the followng:
In monster.c, module aggravate()'s while loop looks like this in the
original posting :
while (monster) {
wake_up(monster);
monster->m_flags &= (~IMITATES);
monster = monster->next_monster;
if (rogue_can_see(monster->row, monster->col)) {
mvaddch(monster->row, monster->col, monster->m_char);
}
To correct the updating problem (and thus get rid of the core dump),
you should correct the block to look like this :
while (monster) {
wake_up(monster);
monster->m_flags &= (~IMITATES);
if (rogue_can_see(monster->row, monster->col)) {
mvaddch(monster->row, monster->col, monster->m_char);
monster = monster->next_monster;
}
Note that the monster pointer is now being updated after the if
block and that the null pointer will now be caught by the while loop.
I hope this helps anyone who has run into the same problem I have. For
anyone who is interested, I have this running on a NCR Tower XP
running SYS VR2 NCR Release 3.01. All of the previous patches (SYS V
updates and the fix to the unpack_armor routines) are installed. I've
encountered no other problems with this rogue source.
Good luck with this and Happy Hunting!
-Bob
--
Robert A. Monio UUCP: ihnp4!meccts!nis!pnessutt
Systems/Analyst - Technical Services ATT: (612) 894-9494
National Information Systems, Inc.
"These Proceedings are Closed!"
Technical Details
Message-ID:
<197@nis.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ll-xn!ames!amdahl!meccts!nis!pnessuttShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ll-xn!ames!amdahl!meccts!nis!pnessutt From: pnessutt@nis.UUCP (Robert A. Monio) Newsgroups: net.sources.games Subject: Rogue Aggravate() bug. Message-ID: <197@nis.UUCP> Date: Mon, 16-Mar-87 00:25:43 EST Article-I.D.: nis.197 Posted: Mon Mar 16 00:25:43 1987 Date-Received: Tue, 17-Mar-87 03:48:21 EST Reply-To: pnessutt@nis.UUCP (Robert A. Monio) Distribution: na Organization: National Information Systems, Inc., Minneapolis Lines: 54 Keywords: aggravate,hummer,bug fix