[comp.sources.games.bugs] play.c> and a fix

erict@flatline.UUCP (j eric townsend) (06/14/88)

Ok, this compiled, but I haven't got to the link stage, so...

In play.c around line 930 or so...:

		/* put torpedo into the universe */
		pcrft->cr_dir[0] = 1.0;
		sptort(pcrft->cr_dir,tmpvec);
		for (i=0;i<3;++i) {
	    *       ptorp->tp_pstn[i] = ADD(pcrft->cr_pstn[i],
	    *       ptorp->tp_thr[i]=MUL(tmpvec[i],50.));
		    ptorp->tp_vel[i] = ADD(pcrft->cr_vel[i],MUL(tmpvec[i],10.));
		}
		etc.etc.

The *'d lines cause a compiler error, of course.  I'm not sure what
the author wanted to do, so I replaced the two *'d lines with:

	   ptorp->tp_pstn[i]=ADD(pcrft->cr_pstn[i],MUL(tmpvec[i],50.));

I know that this ignores ptorp->tp_thr[i].  Maybe it doesn't matter? :-)

What did you do to fix this?
-- 
Skate UNIX or go home, boogie boy...
Spelling errors are directly related to how little time I have...
J. Eric Townsend ->uunet!nuchat!flatline!erict smail:511Parker#2,Hstn,Tx,77007
             ..!bellcore!tness1!/

allan@didsgn.UUCP (didsgn) (06/15/88)

In article <870@flatline.UUCP>, erict@flatline.UUCP (j eric townsend) writes:
> In play.c around line 930 or so...:
> 		for (i=0;i<3;++i) {
> 	    *       ptorp->tp_pstn[i] = ADD(pcrft->cr_pstn[i],
> 	    *       ptorp->tp_thr[i]=MUL(tmpvec[i],50.));
> 		    ptorp->tp_vel[i] = ADD(pcrft->cr_vel[i],MUL(tmpvec[i],10.));
> 		}
> 		etc.etc.
> 
> The *'d lines cause a compiler error, of course.  I'm not sure what
> the author wanted to do, so I replaced the two *'d lines with:
> 
> 	   ptorp->tp_pstn[i]=ADD(pcrft->cr_pstn[i],MUL(tmpvec[i],50.));
> 
> I know that this ignores ptorp->tp_thr[i].  Maybe it doesn't matter? :-)
> 
> What did you do to fix this?

While I still can't link (I don't have the "dbm" routines), the play.c
module does compile (I'm using Greenhills 1.8.0 Compiler on a CRDS UNOS
(SYSV) machine). Your change above removes the assignment

	ptorp->tp_thr[i]=MUL(tmpvec[i],50.)

If you change the *'d lines to the following, maybe your compiler will work.

	ptorp->tp_thr[i]=MUL(tmpvec[i],50.);
        ptorp->tp_pstn[i] = ADD(pcrft->cr_pstn[i],
        ptorp->tp_thr[i]);

-Allan G. Schrum

P.S. Does somebody have a SYSV module for the DBM stuff?

ignatz@chinet.UUCP (Dave Ihnat) (06/18/88)

Your problem is the line just following those asterisked ones; those
two macros result in an ugly assignment statement.  Break them apart,
and all should be OK.