[comp.sources.d] bug in rogue

simon@its63b.UUCP (03/06/87)

In the recent posting of rogue, there is a bug in "message.c" which causes
it to coredump if you take off your armour.
The fix is simple (so I'll just describe it 'nstead of sending a context
diff): 
In print_stats(), the armour-stuff is:

	if (stat_mask & STAT_ARMOR) {
		if (label) {
			mvaddstr(row, 48, "Arm: ");
		}
		if (rogue.armor->damage_enchantment > MAX_ARMOR) {
			rogue.armor->damage_enchantment = MAX_ARMOR;
		}
		sprintf(buf, "%d", get_armor_class(rogue.armor));
		mvaddstr(row, 53, buf);
		pad(buf, 2);
	}

while it should be:

	if (stat_mask & STAT_ARMOR) {
		if (label) {
			mvaddstr(row, 48, "Arm: ");
		}
		if (rogue.armor && rogue.armor->damage_enchantment > MAX_ARMOR){
			rogue.armor->damage_enchantment = MAX_ARMOR;
		}
		sprintf(buf, "%d", get_armor_class(rogue.armor));
		mvaddstr(row, 53, buf);
		pad(buf, 2);
	}


I guess this should really be in comp.sources.bugs or comp.sources.games,
but I can't post to them!

-- 
----------------------------------
| Simon Brown 		         | UUCP:  seismo!mcvax!ukc!{its63b,cstvax}!simon
| Department of Computer Science | JANET: simon@uk.ac.ed.{its63b,cstvax}
| University of Edinburgh,       | ARPA:  simon%{its63b,cstvax}.ed.ac.uk\
| Scotland, UK.			 |				@cs.ucl.ac.uk
----------------------------------	 "Life's like that, you know"