[net.sources.games] Bug in rogue 5.3 clone source.

tims@zeus.UUCP (Tim Stoehr) (12/20/86)

I was informed on the phone today of a pointer bug, and another potential
bug, in my rogue source.


In monster.c, in the routine aggravate(), there is the following while loop:

	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;
	}

Make sure that the the line "monster = monster->next_monster" is placed
as in the above.  If I'd been smart enough to use -1 instead of 0
for nil pointers, I would have found this long ago.

In random.c in the routine get_rand(), there is something like:

	if (x > y) {
		t = y;
		y = x;
		x = t;
	}

In the distribution, it was slightly different, it should read as above.
This code may never be executed, but it should be fixed nevertheless.


The person who pointed out these to me also believed there was an
unnecessary break statement at line 185 in throw.c:

	while ((i < 9) && dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER)) {
		rand_around(i++, &row, &col);
		if ((row > (DROWS-2)) || (row < MIN_ROW) ||
			(col > (DCOLS-1)) || (col < 0) || (!dungeon[row][col]) ||
			(dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER))) {
			continue;
		}
		found = 1;
		break;
	}

To the best of my knowledge, the break statement is functional and correct.
Don't remove it.