[comp.sources.games.bugs] Spacewar bugfix.

lasse@daab.UUCP (Lars Hammarstrand) (06/23/88)

I found out that our "sw" dumped because of a buss error caused by updmov.c
line 218 (must be somthing with the INT(..) cast). After the first update of
the screen, nothing will happen if this process dies becasue "sw" is the progam
that updates the screen and read all the commands.


	"updmov.c" line 218:

	-- OLD --

		if (pchng && INT(ftmp) != INT(ppstn[i]))
		    biton(pchng,BIT_PN1+i);


	-- OUR FIX --

		{
			long tmpa, tmpb;
			double dtmp;

			dtmp = *(ppstn+i);

			tmpa = INT(ftmp);
			tmpb = INT(dtmp);

		if (pchng && tmpa != tmpb)
		    biton(pchng,BIT_PN1+i);

		}

--
I used a kind of remote debugging when i found this problem, you could also
do the same if you have, let's say "sdb", just by moving "sw" to "SW" and then
replace "sw" with a shell script with just one line, and redirect the input-
output to another terminal, like this:

	sdb SW < /dev/another_tty > /dev/another_tty 2>&1

Don't forget the execute flag on the file, as i did the first 99.. times. :-)

Beware:
spacewar uses a lot of signals and when sdb stops on a signal, don't forget
to continue with a 'C', so the signal also is past to the program ("sw" in
this case).

	Good luck!

	Lars Hammarstrand.