Article View: net.games.hack
Article #605Re: Hack modifications
From: William Pugh
Date: Thu, 16 May 1985 17:58
Date: Thu, 16 May 1985 17:58
46 lines
2149 bytes
2149 bytes
-----
Here are the changes to keep you from attacking your dog.
It totally prevents you from attacking your dog, and if you attempt
to attack any peaceful creature, it verifies that you really want to attack.
You could just leave out the first part of these changes and the program would
simply verify that you wanted to attack your dog before allowing you to do it.
Note that if you are blind or confused, you do not get this protection.
I think the fflush will serve to flush any type-ahead, but I'm not
sure...
Bill Pugh
Cornell University
hack.fight.c, changes inserted at line 4:
#include "hack.h"
>#include <stdio.h>
hack.fight.c, changes inserted at line 259:
if(mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep &&
!mtmp->mconf && mtmp->mcansee && !rn2(7) &&
(m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */
mtmp->mx != u.ux+u.dx || mtmp->my != u.uy+u.dy))
return(FALSE);
> /* changes by wwp 5/16/85 */
> if (!Blind && Confusion == 0 && mdat->mlet == 'd' && mtmp->mtame) {
> mtmp->mflee = 1;
> mtmp->mfleetim = rnd(6);
> pline("You stop to avoid hitting your dog");
> return(TRUE);
> }
> if (!Blind && Confusion == 0 && (mtmp->mpeaceful || mtmp->mtame)) {
> (void) fflush(stdin);
> pline("Really attack?");
> (void) fflush(stdout);
> if (readchar() != 'y') return(TRUE);
> }
if(mtmp->mimic){
if(!u.ustuck && !mtmp->mflee) u.ustuck = mtmp;
switch(levl[u.ux+u.dx][u.uy+u.dy].scrsym){
Technical Details
Message-ID:
<1783@cornell.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!harpo!whuxlm!whuxl!houxm!vax135!cornell!pughReferences:
<1713@cornell.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cornell.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!harpo!whuxlm!whuxl!houxm!vax135!cornell!pugh From: pugh@cornell.UUCP (William Pugh) Newsgroups: net.games.hack Subject: Re: Hack modifications Message-ID: <1783@cornell.UUCP> Date: Thu, 16-May-85 13:58:42 EDT Article-I.D.: cornell.1783 Posted: Thu May 16 13:58:42 1985 Date-Received: Sun, 19-May-85 05:26:16 EDT References: <1713@cornell.UUCP> Reply-To: pugh@gvax.UUCP (William Pugh) Distribution: net Organization: Cornell Univ. CS Dept. Lines: 47