home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!elroy.jpl.nasa.gov!ames!koriel!lll-winken.llnl.gov!fnnews.fnal.gov!fnnews!SNYDER
- From: SNYDER@d0sb10.fnal.gov
- Newsgroups: vmsnet.sources.games
- Subject: Mazewar for VMS (2/5) (repost)
- Date: 14 Jul 1993 06:02:45 GMT
- Organization: SUNY Stony Brook High Energy Physics
- Lines: 2903
- Message-ID: <SNYDER.93Jul14000245@d0sb10.fnal.gov>
- NNTP-Posting-Host: d0sb10.fnal.gov
- Xref: uunet vmsnet.sources.games:753
-
- -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
- X`20*`20be`20either`20a`20character`20string`20name,`20or`20an`20address`20in
- V`20the`20form`20a.b.c.d`20where
- X`20*`20the`20pieces`20are`20octal,`20decimal,`20or`20hex`20numbers.`20`20Retur
- Vns`20a`20pointer`20to`20a
- X`20*`20sockaddr_in`20struct`20(note`20this`20structure`20is`20statically`20all
- Vocated`20and`20must
- X`20*`20be`20copied),`20or`20NULL`20if`20the`20name`20is`20unknown.
- X`20*/
- X
- XSockaddr`20*
- XresolveHost(name)
- Xregister`20char`20*name;
- X`7B
- X`09register`20struct`20hostent`20*fhost;
- X`09struct`20in_addr`20fadd;
- X`09static`20Sockaddr`20sa;
- X
- X`09if`20((fhost`20=`20gethostbyname(name))`20!=`20NULL)`20`7B
- X`09`09sa.sin_family`20=`20fhost->h_addrtype;
- X`09`09sa.sin_port`20=`200;
- X`09`09bcopy(fhost->h_addr,`20`26sa.sin_addr,`20fhost->h_length);
- X`09`7D`20else`20`7B
- X`09`09fadd.s_addr`20=`20inet_addr(name);
- X`09`09if`20(fadd.s_addr`20!=`20-1)`20`7B
- X`09`09`09sa.sin_family`20=`20AF_INET;`09/*`20grot`20*/
- X`09`09`09sa.sin_port`20=`200;
- X`09`09`09sa.sin_addr.s_addr`20=`20fadd.s_addr;
- X`09`09`7D`20else
- X`09`09`09return(NULL);
- X`09`7D
- X`09return(`26sa);
- X`7D
- $ call unpack [.MAZEWAR]INIT.C;11 473945742 ""
- $!
- $ create 'f'
- X.TH`20MAZEFIND`206
- X.SH`20NAME
- Xmazefind`20`5C-`20discover`20current`20MazeWar`20games
- X.SH`20SYNTAX
- X.B`20/usr/games/mazefind
- X.SH`20DESCRIPTION
- X.I`20Mazefind
- Xbroadcasts`20a`20query`20on`20the`20net`20to`20discover`20what`20MazeWar`20gam
- Ves`20are`20being
- Xplayed,`20and`20prints`20out`20useful`20information`20about`20them.
- XIt's`20useful`20for`20discovering`20what`20games`20might`20be`20interesting
- V`20to`20connect`20to
- Xon`20a`20distant`20network.
- X.SH`20"SEE`20ALSO"
- Xmazewar(6)
- $ call unpack [.MAZEWAR]MAZEFIND.6;1 136260481 ""
- $!
- $ create 'f'
- X/*`20$Header:`20mazefind.c,v`201.5`2088/09/07`2011:23:42`20kent`20Exp`20$`20*/
- V
- X
- X/*`20
- X`20*`20mazefind.c`20-`20find`20ongoing`20mazewar`20games
- X`20*`20
- X`20*`20Author:`09Christopher`20A.`20Kent
- X`20*`20`09`09Western`20Research`20Laboratory
- X`20*`20`09`09Digital`20Equipment`20Corporation
- X`20*`20Date:`09Thu`20Dec`20`204`201986
- X`20*/
- X
- X/***********************************************************
- XCopyright`201986`20by`20Digital`20Equipment`20Corporation,`20Maynard,`20Massac
- Vhusetts,
- X
- X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20All
- V`20Rights`20Reserved
- X
- XPermission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20software
- V`20and`20its`20
- Xdocumentation`20for`20any`20purpose`20and`20without`20fee`20is`20hereby`20gran
- Vted,`20
- Xprovided`20that`20the`20above`20copyright`20notice`20appear`20in`20all`20copie
- Vs`20and`20that
- Xboth`20that`20copyright`20notice`20and`20this`20permission`20notice`20appear
- V`20in`20
- Xsupporting`20documentation,`20and`20that`20the`20names`20of`20Digital`20not
- V`20be
- Xused`20in`20advertising`20or`20publicity`20pertaining`20to`20disstribution`20o
- Vf`20the
- Xsoftware`20without`20specific,`20written`20prior`20permission.`20`20
- X
- XDIGITAL`20DISCLAIMS`20ALL`20WARRANTIES`20WITH`20REGARD`20TO`20THIS`20SOFTWARE,
- V`20INCLUDING
- XALL`20IMPLIED`20WARRANTIES`20OF`20MERCHANTABILITY`20AND`20FITNESS,`20IN`20NO
- V`20EVENT`20SHALL
- XDIGITAL`20BE`20LIABLE`20FOR`20ANY`20SPECIAL,`20INDIRECT`20OR`20CONSEQUENTIAL
- V`20DAMAGES`20OR
- XANY`20DAMAGES`20WHATSOEVER`20RESULTING`20FROM`20LOSS`20OF`20USE,`20DATA`20OR
- V`20PROFITS,
- XWHETHER`20IN`20AN`20ACTION`20OF`20CONTRACT,`20NEGLIGENCE`20OR`20OTHER`20TORTIO
- VUS`20ACTION,
- XARISING`20OUT`20OF`20OR`20IN`20CONNECTION`20WITH`20THE`20USE`20OR`20PERFORMANC
- VE`20OF`20THIS
- XSOFTWARE.
- X
- X******************************************************************/
- X
- X/*
- X`20*`20vms`20port`207/93`20`20scott`20snyder`20<snyder@fnald0.fnal.gov>
- X`20*`20$Log:`09mazefind.c,v`20$
- X`20*`20Revision`201.5`20`2088/09/07`20`2011:23:42`20`20kent
- X`20*`20
- X`20*`20
- X`20*`20Revision`201.4`20`2088/08/25`20`2009:57:53`20`20kent
- X`20*`20
- X`20*`20
- X`20*`20Revision`201.3`20`2088/06/15`20`2016:36:20`20`20kent
- X`20*`20
- X`20*`20
- X`20*`20Revision`201.2`20`2087/03/31`20`2014:42:26`20`20kent
- X`20*`20Portability`20considerations,`20especially`20byteswapping`20to/from`20t
- Vhe`20net.
- X`20*`20
- X`20*`20Revision`201.1`20`2086/12/04`20`2017:19:31`20`20kent
- X`20*`20Initial`20revision
- X`20*`20
- X`20*/
- X
- Xstatic`20char`20rcs_ident`5B`5D`20=`20"$Header:`20mazefind.c,v`201.5`2088/09/0
- V7`2011:23:42`20kent`20Exp`20$";
- X
- X#include`20<sys/types.h>
- X#include`20<sys/socket.h>
- X#include`20<sys/time.h>
- X
- X#include`20<netinet/in.h>
- X
- X#include`20<errno.h>
- X#include`20<netdb.h>
- X#include`20<stdio.h>
- X#ifdef`20VMS
- X#include`20<string.h>
- X#else
- X#include`20<strings.h>
- X#endif
- X
- X#include`20"mazewar.h"
- X
- Xstruct`20answer`20`7B
- X`09Sockaddr`09source;
- X`09int`09`09srclen;
- X`09RatPacket`09packet;
- X`7D;
- X
- XBoolean`09FoundOne`20=`20FALSE;
- X
- X/*`20
- X`20*`20Broadcast`20to`20check`20out`20all`20the`20games`20on`20the`20net.`20Th
- Vis`20is`20basically
- X`20*`20findDuke()`20from`20init.c.
- X`20*/
- X
- Xmain()
- X`7B
- X`09register`20int`09i;
- X`09int`09`09cnt`20=`200;
- X`09Sockaddr`09rmtAddr;
- X`09struct`09timeval`09timeout;
- X`09RatPacket`09*b`20=`20(RatPacket`20*)`20malloc(sizeof(RatPacket));
- X`09struct`20answer`09answer;
- X`09int`09`09fd;
- X`09fd_set`20`20`20`20`20`20`20`20`20`20fds;
- X`09int`09`09ret,`20cc;
- X`09int`09`09mazePort;
- X`09struct`20servent`09*mazeService;
- X`09char`09`09buf`5B128`5D;
- X`09Boolean`09`09duke(),`20freeSlot();
- X`09u_long`09`09inet_makeaddr();
- X`09Sockaddr`09*resolveHost();
- X
- X`09fd`20=`20socket(AF_INET,`20SOCK_DGRAM,`200);
- X`09if`20(fd`20<`200)
- X`09`09MFError("can't`20get`20socket");
- X#ifdef`09SO_BROADCAST
- X#ifdef`09BSD_43
- X`09`7B
- X`09int`09one`20=`201;
- X
- X`09if`20(setsockopt(fd,`20SOL_SOCKET,`20SO_BROADCAST,`20`26one,`20sizeof`20one
- V)`20<`200)
- X`09`09MFError("can't`20get`20broadcast`20permission");
- X`09`7D
- X#else`09BSD_43
- X`09if`20(setsockopt(fd,`20SOL_SOCKET,`20SO_BROADCAST,`20NULL,`200)`20<`200)
- X`09`09MFError("can't`20get`20broadcast`20permission");
- X#endif`09BSD_43
- X#endif`09SO_BROADCAST
- X
- X`09mazeService`20=`20getservbyname(MAZESERVICE,`20"udp");
- X`09if`20(mazeService`20!=`20(struct`20servent`20*)`20NULL)
- X`09`09mazePort`20=`20mazeService->s_port;
- X`09else
- X`09`09mazePort`20=`20htons(MAZEPORT);
- X
- X`09gethostname(buf,`20sizeof(buf));
- X`09bcopy((char`20*)resolveHost(buf),`20(char`20*)`20`26rmtAddr,`20sizeof(rmtAd
- Vdr));
- X`09rmtAddr.sin_addr.s_addr`20=`20inet_makeaddr(inet_netof(rmtAddr.sin_addr),
- X`09`09`09`09`09BROAD_ADDR);`09/*`20from`20Makefile`20*/
- X`09rmtAddr.sin_port`20=`20mazePort;
- X
- X`09setupSurvey(b);
- X`09ConvertOutgoing(b);
- X`09if`20(sendto(fd,`20(char`20*)`20b,`20sizeof(*b),`200,`20`26rmtAddr,`20sizeo
- Vf(rmtAddr))`20<`200)
- X`09`09MFError("survey");
- X
- X`09while`20(1)`20`7B
- X`09`20`20`20`20`20`20`20`20FD_ZERO`20(`26fds);
- X`09`09FD_SET`20(fd,`20`26fds);
- X`09`09timeout.tv_sec`20=`205;
- X`09`09timeout.tv_usec`20=`200;
- X`09`09ret`20=`20select(FD_SETSIZE,`20`26fds,`20NULL,`20NULL,`20`26timeout);
- X`09`09if`20(ret`20<`200)
- X`09`09`09MFError("select");
- X`09`09if`20(ret`20==`200)
- X`09`09`09break;
- X`09`09answer.srclen`20=`20sizeof(Sockaddr);
- X`09`09cc`20=`20recvfrom(fd,`20`26answer.packet,`20sizeof(RatPacket),
- X`09`09`090,`20`26answer.source,`20`26answer.srclen);
- X`09`09if`20(cc`20<`200)
- X`09`09`09MFError("recv");
- X`09`09ConvertIncoming(`26answer.packet);
- X`09`09if`20(answer.packet.type`20!=`20RAT_STATUS)
- X`09`09`09continue;
- X`09`09if`20(!duke(`26answer))`20`7B
- X`09`09`09RatStatus`09rs;
- X
- X`09`09`09rs`20=`20(RatStatus)`20`26answer.packet.body;
- X`09`09`09setupSurvey(b);
- X`09`09`09ConvertOutgoing(b);
- X`09`09`09if`20(rs->rats`5Brs->dukeRat`5D.addr.sin_port`20==`20mazePort)
- X`09`09`09`09continue;`09/*`20will`20answer`20himself`20*/
- X`09`09`09`09
- X`09`09`09if`20(sendto(fd,`20b,`20sizeof(*b),`200,
- X`09`09`09`09`20`20`20`26rs->rats`5Brs->dukeRat`5D.addr,
- X`09`09`09`09`20`20`20sizeof(rs->rats`5Brs->dukeRat`5D.addr))`20<`200)
- X`09`09`09`09MFError("resend");
- X`09`09`09continue;
- X`09`09`7D`20else
- X`09`09`09printAnswer(`26answer);
- X`09`7D
- X`09if`20(FoundOne`20==`20FALSE)
- X`09`09printf("No`20one's`20playing`20now`5Cn");
- X`09exit(0);
- X`7D
- X
- XMFError(s)
- Xchar`20*s;
- X`7B
- X`09fprintf(stderr,`20"mazefind:`20%s`5Cn",`20s);
- X`09perror("mazefind");
- X`09exit(-1);
- X`7D
- X
- X/*`20
- X`20*`20Fill`20in`20the`20RAT_SURVEY`20packet.
- X`20*/
- X
- XsetupSurvey(b)
- XRatPacket`20*b;
- X`7B
- X`09RatNew`09ratSurvey;
- X
- X`09b->type`20=`20RAT_SURVEY;
- X`09ratSurvey`20=`20(RatNew)`20`26b->body;
- X`09ratSurvey->pass`20=`20RAT_PASSWORD;
- X`7D
- X
- X/*`20
- X`20*`20Check`20if`20this`20guy's`20the`20duke`20of`20his`20game.
- X`20*/
- X
- XBoolean
- Xduke(a)
- Xstruct`20answer`09*a;
- X`7B
- X`09RatStatus`09test;
- X
- X`09test`20=`20(RatStatus)`20`26a->packet.body;
- X`09return`20!bcmp((char`20*)`20`26test->rats`5Btest->dukeRat`5D.addr.sin_addr,
- V
- X`09`09`09(char`20*)`20`26a->source.sin_addr,`20sizeof(struct`20in_addr));
- X`7D
- X
- X/*`20
- X`20*`20Decode`20an`20answer`20packet.
- X`20*/
- X
- XprintAnswer(a)
- Xstruct`20answer`09*a;
- X`7B
- X`09RatStatus`09status;
- X`09RatId`09`09ratId;
- X`09RatInfo`09`09rat;
- X`09struct`20hostent`09*host;
- X
- X`09status`20=`20(RatStatus)`20`26a->packet.body;
- X`09
- X`09if`20(FoundOne`20==`20FALSE)`20`7B
- X`09`09FoundOne`20=`20TRUE;
- X`09`09printf("Current`20game(s):`5Cn");
- X`09`09printf("`5Ct%-20s`5Ct%s`5Ct`5Cthost`5Cn",`20"Name",`20"score");
- X`09`7D`20else
- X`09`09printf("`5Cn");
- X`09for(ratId`20=`200;`20ratId`20<`20MAXRATS;`20ratId++)`20`7B
- X`09`09rat`20=`20(RatInfo)`20`26status->rats`5BratId`5D;
- X`09`09if`20(rat->playing`20==`20FALSE)
- X`09`09`09continue;
- X
- X`09`09if`20(ratId`20==`20status->dukeRat)
- X`09`09`09printf("duke");
- X`09`09printf("`5Ct");
- X
- X`09`09printf("%-20s`5Ct%d`5Ct`5Ct",`20rat->name,`20rat->score);
- X
- X`09`09host`20=`20gethostbyaddr(`26rat->addr.sin_addr,
- X`09`09`09`09sizeof(struct`20in_addr),`20AF_INET);
- X`09`09if`20(host`20!=`20NULL)
- X`09`09`09printf("%s`5Cn",`20host->h_name);
- X`09`09else
- X`09`09`09printf("%s`5Cn",`20inet_ntoa(rat->addr.sin_addr));
- X`09`7D
- X`7D
- X
- X/*
- X`20*`20Resolve`20the`20specified`20host`20name`20into`20an`20internet`20addres
- Vs.`20`20The`20"name"`20may
- X`20*`20be`20either`20a`20character`20string`20name,`20or`20an`20address`20in
- V`20the`20form`20a.b.c.d`20where
- X`20*`20the`20pieces`20are`20octal,`20decimal,`20or`20hex`20numbers.`20`20Retur
- Vns`20a`20pointer`20to`20a
- X`20*`20sockaddr_in`20struct`20(note`20this`20structure`20is`20statically`20all
- Vocated`20and`20must
- X`20*`20be`20copied),`20or`20NULL`20if`20the`20name`20is`20unknown.
- X`20*/
- X
- XSockaddr`20*
- XresolveHost(name)
- Xregister`20char`20*name;
- X`7B
- X`09register`20struct`20hostent`20*fhost;
- X`09struct`20in_addr`20fadd;
- X`09static`20Sockaddr`20sa;
- X
- X`09if`20((fhost`20=`20gethostbyname(name))`20!=`20NULL)`20`7B
- X`09`09sa.sin_family`20=`20fhost->h_addrtype;
- X`09`09sa.sin_port`20=`200;
- X`09`09bcopy(fhost->h_addr,`20`26sa.sin_addr,`20fhost->h_length);
- X`09`7D`20else`20`7B
- X`09`09fadd.s_addr`20=`20inet_addr(name);
- X`09`09if`20(fadd.s_addr`20!=`20-1)`20`7B
- X`09`09`09sa.sin_family`20=`20AF_INET;`09/*`20grot`20*/
- X`09`09`09sa.sin_port`20=`200;
- X`09`09`09sa.sin_addr.s_addr`20=`20fadd.s_addr;
- X`09`09`7D`20else
- X`09`09`09return(NULL);
- X`09`7D
- X`09return(`26sa);
- X`7D
- X
- X/*`20
- X`20*`20Convert`20the`20contents`20of`20a`20packet`20to`20network`20order`20bef
- Vore`20sending.
- X`20*/
- X
- XConvertOutgoing(p)
- XRatPacket`20*p;
- X`7B
- X`09char`09`09buf`5B64`5D;
- X`09RatId`09`09ratId;
- X`09RatLocation`09ratLoc;
- X`09RatKill`09`09ratKill;
- X`09RatDead`09`09ratDead;
- X`09RatStatus`09ratStatus;
- X`09RatNew`09`09ratNew;
- X`09RatGone`09`09ratGone;
- X`09RatQuery`09ratQuery;
- X`09RatAlive`09ratAlive;
- X`09RatMove`09`09ratMove;
- X
- X`09switch(p->type)`20`7B
- X`09case`20RAT_LOCATION:
- X`09`09ratLoc`20=`20(RatLocation)`20`26p->body;
- X`09`09ratLoc->ratId`20=`20htonl(ratLoc->ratId);
- X`09`09ratLoc->xLoc`20=`20`20htons(ratLoc->xLoc);
- X`09`09ratLoc->yLoc`20=`20`20htons(ratLoc->yLoc);
- X`09`09ratLoc->dir`20=`20`20`20htons(ratLoc->dir);
- X`09`09ratLoc->score`20=`20htonl(ratLoc->score);
- X`09`09break;
- X
- X`09case`20RAT_KILL:
- X`09`09ratKill`20=`20(RatKill)`20`26p->body;
- X`09`09ratKill->ratId`20=`20htonl(ratKill->ratId);
- X`09`09ratKill->xLoc`20`20=`20htons(ratKill->xLoc);
- X`09`09ratKill->yLoc`20`20=`20htons(ratKill->yLoc);
- X`09`09ratKill->dir`20`20`20=`20htons(ratKill->dir);
- X`09`09break;
- X
- X`09case`20RAT_DEAD:
- X`09`09ratDead`20=`20(RatDead)`20`26p->body;
- X`09`09ratDead->ratId`20=`20htonl(ratDead->ratId);
- X`09`09ratDead->killedBy`20=`20htonl(ratDead->killedBy);
- X`09`09break;
- X
- X`09case`20RAT_STATUS:
- X`09`09ratStatus`20=`20(RatStatus)`20`26p->body;
- X`09`09ratStatus->dukeRat`20=`20htonl(ratStatus->dukeRat);
- X`09`09for`20(ratId`20=`200;`20ratId`20<`20MAXRATS;`20ratId++)`20`7B
- X`09`09`09RatInfo`09ratInfo;
- X
- X`09`09`09ratInfo`20=`20`26ratStatus->rats`5BratId`5D;
- X`09`09`09ratInfo->playing`20=`20htons(ratInfo->playing);
- X`09`09`09ratInfo->xLoc`20=`20htons(ratInfo->xLoc);
- X`09`09`09ratInfo->yLoc`20=`20htons(ratInfo->yLoc);
- X`09`09`09ratInfo->dir`20=`20htons(ratInfo->dir);
- X`09`09`09ratInfo->score`20=`20htonl(ratInfo->score);
- X`09`09`09ratInfo->addr.sin_family`20=
- X`09`09`09`09ntohs(ratInfo->addr.sin_family);
- X`09`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09`7D
- X`09`09break;
- X
- X`09case`20RAT_NEW:
- X`09`09ratNew`20=`20(RatNew)`20`26p->body;
- X`09`09ratNew->pass`20=`20htons(ratNew->pass);
- X`09`09ratNew->xLoc`20=`20htons(ratNew->xLoc);
- X`09`09ratNew->yLoc`20=`20htons(ratNew->yLoc);
- X`09`09ratNew->dir`20`20=`20htons(ratNew->dir);
- X`09`09ratNew->addr.sin_family`20=
- X`09`09`09htons(ratNew->addr.sin_family);
- X`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09break;
- X
- X`09case`20RAT_GOING:
- X`09`09ratGone`20=`20(RatGone)`20`26p->body;
- X`09`09ratGone->ratId`20=`20htonl(ratGone->ratId);
- X`09`09break;
- X
- X`09case`20RAT_QUERY:
- X`09`09ratQuery`20=`20(RatQuery)`20`26p->body;
- X`09`09ratQuery->ratId`20=`20htonl(ratQuery->ratId);
- X`09`09break;
- X
- X`09case`20RAT_ALIVE:
- X`09`09ratAlive`20=`20(RatAlive)`20`26p->body;
- X`09`09ratAlive->ratId`20=`20htonl(ratAlive->ratId);
- X`09`09break;
- X
- X`09case`20RAT_SURVEY:
- X`09`09ratNew`20=`20(RatNew)`20`26p->body;
- X`09`09ratNew->pass`20=`20htons(ratNew->pass);
- X`09`09ratNew->xLoc`20=`20htons(ratNew->xLoc);
- X`09`09ratNew->yLoc`20=`20htons(ratNew->yLoc);
- X`09`09ratNew->dir`20`20=`20htons(ratNew->dir);
- X`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09break;
- X
- X`09case`20RAT_MOVE:
- X`09`09ratMove`20=`20(RatMove)`20`26p->body;
- X`09`09ratMove->ratId`20=`20htonl(ratMove->ratId);
- X`09`09break;
- X
- X`09default:
- X`09`09sprintf(buf,`20"ConvertOutgoing`20bad`20type`20%d`20(%d)",
- X`09`09`09p->type,`20htons(p->type));
- X`09`09MFError(buf);
- X`09`7D
- X`09p->type`20=`20htonl(p->type);
- X`7D
- X
- X/*`20
- X`20*`20Convert`20the`20contents`20of`20a`20packet`20to`20host`20order`20after
- V`20ConvertIncoming.
- X`20*/
- X
- XConvertIncoming(p)
- XRatPacket`20*p;
- X`7B
- X`09char`09`09buf`5B64`5D;
- X`09RatId`09`09ratId;
- X`09RatLocation`09ratLoc;
- X`09RatKill`09`09ratKill;
- X`09RatDead`09`09ratDead;
- X`09RatStatus`09ratStatus;
- X`09RatNew`09`09ratNew;
- X`09RatGone`09`09ratGone;
- X`09RatQuery`09ratQuery;
- X`09RatAlive`09ratAlive;
- X`09RatMove`09`09ratMove;
- X
- X`09p->type`20=`20ntohl(p->type);
- X`09switch(p->type)`20`7B
- X`09case`20RAT_LOCATION:
- X`09`09ratLoc`20=`20(RatLocation)`20`26p->body;
- X`09`09ratLoc->ratId`20=`20ntohl(ratLoc->ratId);
- X`09`09ratLoc->xLoc`20=`20`20ntohs(ratLoc->xLoc);
- X`09`09ratLoc->yLoc`20=`20`20ntohs(ratLoc->yLoc);
- X`09`09ratLoc->dir`20=`20`20`20ntohs(ratLoc->dir);
- X`09`09ratLoc->score`20=`20ntohl(ratLoc->score);
- X`09`09break;
- X
- X`09case`20RAT_KILL:
- X`09`09ratKill`20=`20(RatKill)`20`26p->body;
- X`09`09ratKill->ratId`20=`20ntohl(ratKill->ratId);
- X`09`09ratKill->xLoc`20`20=`20ntohs(ratKill->xLoc);
- X`09`09ratKill->yLoc`20`20=`20ntohs(ratKill->yLoc);
- X`09`09ratKill->dir`20`20`20=`20ntohs(ratKill->dir);
- X`09`09break;
- X
- X`09case`20RAT_DEAD:
- X`09`09ratDead`20=`20(RatDead)`20`26p->body;
- X`09`09ratDead->ratId`20=`20ntohl(ratDead->ratId);
- X`09`09ratDead->killedBy`20=`20ntohl(ratDead->killedBy);
- X`09`09break;
- X
- X`09case`20RAT_STATUS:
- X`09`09ratStatus`20=`20(RatStatus)`20`26p->body;
- X`09`09ratStatus->dukeRat`20=`20ntohl(ratStatus->dukeRat);
- X`09`09for`20(ratId`20=`200;`20ratId`20<`20MAXRATS;`20ratId++)`20`7B
- X`09`09`09RatInfo`09ratInfo;
- X
- X`09`09`09ratInfo`20=`20`26ratStatus->rats`5BratId`5D;
- X`09`09`09ratInfo->playing`20=`20ntohs(ratInfo->playing);
- X`09`09`09ratInfo->xLoc`20=`20ntohs(ratInfo->xLoc);
- X`09`09`09ratInfo->yLoc`20=`20ntohs(ratInfo->yLoc);
- X`09`09`09ratInfo->dir`20=`20ntohs(ratInfo->dir);
- X`09`09`09ratInfo->score`20=`20ntohl(ratInfo->score);
- X`09`09`09ratInfo->addr.sin_family`20=
- X`09`09`09`09ntohs(ratInfo->addr.sin_family);
- X`09`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09`7D
- X`09`09break;
- X
- X`09case`20RAT_NEW:
- X`09`09ratNew`20=`20(RatNew)`20`26p->body;
- X`09`09ratNew->pass`20=`20ntohs(ratNew->pass);
- X`09`09ratNew->xLoc`20=`20ntohs(ratNew->xLoc);
- X`09`09ratNew->yLoc`20=`20ntohs(ratNew->yLoc);
- X`09`09ratNew->dir`20`20=`20ntohs(ratNew->dir);
- X`09`09ratNew->addr.sin_family`20=
- X`09`09`09ntohs(ratNew->addr.sin_family);
- X`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09break;
- X
- X`09case`20RAT_GOING:
- X`09`09ratGone`20=`20(RatGone)`20`26p->body;
- X`09`09ratGone->ratId`20=`20ntohl(ratGone->ratId);
- X`09`09break;
- X
- X`09case`20RAT_QUERY:
- X`09`09ratQuery`20=`20(RatQuery)`20`26p->body;
- X`09`09ratQuery->ratId`20=`20ntohl(ratQuery->ratId);
- X`09`09break;
- X
- X`09case`20RAT_ALIVE:
- X`09`09ratAlive`20=`20(RatAlive)`20`26p->body;
- X`09`09ratAlive->ratId`20=`20ntohl(ratAlive->ratId);
- X`09`09break;
- X
- X`09case`20RAT_SURVEY:
- X`09`09ratNew`20=`20(RatNew)`20`26p->body;
- X`09`09ratNew->pass`20=`20ntohs(ratNew->pass);
- X`09`09ratNew->xLoc`20=`20ntohs(ratNew->xLoc);
- X`09`09ratNew->yLoc`20=`20ntohs(ratNew->yLoc);
- X`09`09ratNew->dir`20`20=`20ntohs(ratNew->dir);
- X`09`09/*`20don't`20touch`20address`20or`20name`20*/
- X`09`09break;
- X
- X`09case`20RAT_MOVE:
- X`09`09ratMove`20=`20(RatMove)`20`26p->body;
- X`09`09ratMove->ratId`20=`20ntohl(ratMove->ratId);
- X`09`09break;
- X
- X`09default:
- X`09`09sprintf(buf,`20"ConvertIncoming`20bad`20type`20%d`20(%d)",
- X`09`09`09p->type,`20ntohs(p->type));
- X`09`09MFError(buf);
- X`09`7D
- X`7D
- X
- $ call unpack [.MAZEWAR]MAZEFIND.C;5 1359695108 ""
- $!
- $ create 'f'
- X
- X
- X
- XMAZEFIND(6)`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
- V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20MAZEFIND(6)
- X
- X
- XN`08NA`08AM`08ME`08E
- X`20`20`20`20`20mazefind`20-`20discover`20current`20MazeWar`20games
- X
- XS`08SY`08YN`08NT`08TA`08AX`08X
- X`20`20`20`20`20/`08/u`08us`08sr`08r/`08/g`08ga`08am`08me`08es`08s/`08/m`08ma
- V`08az`08ze`08ef`08fi`08in`08nd`08d
- X
- XD`08DE`08ES`08SC`08CR`08RI`08IP`08PT`08TI`08IO`08ON`08N
- X`20`20`20`20`20_`08M_`08a_`08z_`08e_`08f_`08i_`08n_`08d`20`20broadcasts`20`20a
- V`20`20query`20`20on`20`20the`20net`20to`20discover`20what
- X`20`20`20`20`20MazeWar`20games`20are`20being`20played,`20and`20prints`20out
- V`20useful`20infor-
- X`20`20`20`20`20mation`20`20about`20`20them.`20`20It's`20useful`20for`20discove
- Vring`20what`20games
- X`20`20`20`20`20might`20be`20interesting`20to`20connect`20to`20on`20a`20distant
- V`20network.
- X
- XS`08SE`08EE`08E`20A`08AL`08LS`08SO`08O
- X`20`20`20`20`20mazewar(6)
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
- V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
- V`20`20`20`20`20`20`20`20`20`20`20`20`20`201
- X
- X
- $ call unpack [.MAZEWAR]MAZEFIND.DOC;1 1478691461 ""
- $!
- $ create 'f'
- X-+-+-+-+-+-+-+-+`20START`20OF`20PART`202`20-+-+-+-+-+-+-+-+
- XX
- XX`6020`6020`6020`60200x00e3,`60200x9fff,`60200xffff,`60200xff00,`60200x01ef,
- V`60200xcfff,`60200xffff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x00e3,`60200x9fff,`60200xffff,`60200xff00,`60200x00e3,
- V`60200x9fff,`60200xffff
- XV,`60200xff00,
- XX`6020`6020`6020`60200x3c1f,`60200xfffc,`60200x3fff,`60200xfffc,`60200x0fff,
- V`60200xf00f,`60200xfff0
- XV,`60200x03c0,
- XX
- XX`6020`6020`6020`60200x01ef,`60200xcfff,`60200xffff,`60200xff80,`60200x01df,
- V`60200xffff,`60200xffff
- XV,`60200xfc80,
- XX`6020`6020`6020`60200x01ef,`60200xcfff,`60200xffff,`60200xff80,`60200x01e7,
- V`60200xcfff,`60200xffff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x383f,`60200xfffc,`60200x3fff,`60200xfffc,`60200x07ff,
- V`60200xe007,`60200xffe0
- XV,`60200x0df0,
- XX
- XX`6020`6020`6020`60200x013f,`60200xffff,`60200xffff,`60200xff80,`60200x03ff,
- V`60200xffff,`60200xffff
- XV,`60200xc0c0,
- XX`6020`6020`6020`60200x01df,`60200xffff,`60200xffff,`60200xff80,`60200x01df,
- V`60200xffff,`60200xffff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x187f,`60200xfff8,`60200x1fff,`60200xfff8,`60200x03ff,
- V`60200xc003,`60200xffc0
- XV,`60200x13f8,
- XX
- XX`6020`6020`6020`60200x0303,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xffff,`60200xfffe
- XV,`60200x0040,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xffe0,`60200x07ff
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x10ff,`60200xfff8,`60200x1fff,`60200xfff8,`60200x0b7e,
- V`60200x680b,`60200x7e68
- XV,`60200x2ffc,
- XX
- XX`6020`6020`6020`60200x0200,`60200x7fff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xffff,`60200xfff8
- XV,`60200x0040,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xff00,`60200x00ff
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x19ff,`60200xfff8,`60200x1fff,`60200xfff8,`60200x15f9,
- V`60200xd415,`60200xf9d4
- XV,`60200x3ff4,
- XX
- XX`6020`6020`6020`60200x0200,`60200x1fff,`60200xffff,`60200xffc0,`60200x07ff,
- V`60200xffff,`60200xffe0
- XV,`60200x0060,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xf800,`60200x001f
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x0fff,`60200xfff0,`60200x0fff,`60200xfff0,`60200x0aae,
- V`60200xa80a,`60200xaea8
- XV,`60200x7fe2,
- XX
- XX`6020`6020`6020`60200x0600,`60200x07ff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xffc0
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xc000,`60200x0003
- XV,`60200xffe0,
- XX`6020`6020`6020`60200x0fff,`60200xfff0,`60200x0fff,`60200xfff0,`60200x0155,
- V`60200x4001,`60200x5540
- XV,`60200x7fc6,
- XX
- XX`6020`6020`6020`60200x0700,`60200xcfff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xff0a
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200x0007,`60200xe000
- XV,`60200xffe0,
- XX`6020`6020`6020`60200x07ff,`60200xff60,`60200x07ff,`60200xff60,`60200x0000,
- V`60200x0000,`60200x0000
- XV,`60200x7fc6,
- XX
- XX`6020`6020`6020`60200x0700,`60200x30ff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xfe0c
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07fc,
- V`60200x000d,`60200xb800
- XV,`60200x3fe0,
- XX`6020`6020`6020`60200x03ff,`60200xfcc0,`60200x03ff,`60200xfcc0,`60200x0000,
- V`60200x0000,`60200x0000
- XV,`60200x7fe2,
- XX
- XX`6020`6020`6020`60200x0700,`60200x407f,`60200xffff,`60200xffe0,`60200x0fff,
- V`60200xffff,`60200xfc38
- XV,`60200x01f0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07f0,
- V`60200x0005,`60200xbc00
- XV,`60200x0fe0,
- XX`6020`6020`6020`60200x07ff,`60200xff68,`60200x07ff,`60200xff68,`60200x003c,
- V`60200x0000,`60200x3c00
- XV,`60200x3ff4,
- XX
- XX`6020`6020`6020`60200x0f81,`60200x003f,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xf875
- XV,`60200x81b0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0fc0,
- V`60200x0003,`60200x7602
- XV,`60200x03f0,
- XX`6020`6020`6020`60200x15ff,`60200xf9d4,`60200x15ff,`60200xf9d4,`60200x009f,
- V`60200x0000,`60200x9f00
- XV,`60200x3ffc,
- XX
- XX`6020`6020`6020`60200x0d80,`60200x021f,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xf382
- XV,`60200x41f0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0fc1,
- V`60200x0043,`60200xce00
- XV,`60200x8df0,
- XX`6020`6020`6020`60200x2adf,`60200xe3aa,`60200x2adf,`60200xe3aa,`60200x037f,
- V`60200xc003,`60200x7fc0
- XV,`60200x1ff8,
- XX
- XX`6020`6020`6020`60200x0f80,`60200x01cf,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xee00
- XV,`60200x0170,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0f2a,
- V`60200x00c3,`60200xef00
- XV,`60200x70f0,
- XX`6020`6020`6020`60200x157c,`60200x3f54,`60200x157c,`60200x3f54,`60200x04ff,
- V`60200xe004,`60200xffe0
- XV,`60200x1bdc,
- XX
- XX`6020`6020`6020`60200x0e80,`60200x6677,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xfc00
- XV,`60200x0170,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0e6d,
- V`60200x0091,`60200xf900
- XV,`60200x8070,
- XX`6020`6020`6020`60200x0aaf,`60200xfaa8,`60200x0aaf,`60200xfaa8,`60200x0bff,
- V`60200xf00b,`60200xfff0
- XV,`60200x2e3a,
- XX
- XX`6020`6020`6020`60200x0e80,`60200x183f,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xc000
- XV,`60200x0170,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0c10,
- V`60200x00f8,`60200xff00
- XV,`60200x03b0,
- XX`6020`6020`6020`60200x0155,`60200x5540,`60200x0155,`60200x5540,`60200x0fff,
- V`60200xd00f,`60200x81f0
- XV,`60200x17f4,
- XX
- XX`6020`6020`6020`60200x0e80,`60200x0003,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xe000
- XV,`60200x01f0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0c0c,
- V`60200x00ff,`60200xf700
- XV,`60200x25f0,
- XX`6020`6020`6020`60200x0000,`60200x0000,`60200x0000,`60200x0000,`60200x1fff,
- V`60200x881e,`60200x0078
- XV,`60200x0000,
- XX
- XX`6020`6020`6020`60200x0f80,`60200x0007,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xf000
- XV,`60200x01f0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0e02,
- V`60200x0097,`60200xf900
- XV,`60200x1c70,
- XX`6020`6020`6020`60200x0000,`60200x0000,`60200x0000,`60200x0000,`60200x1fff,
- V`60200x0818,`60200x1818
- XV,`60200x03c0,
- XX
- XX`6020`6020`6020`60200x0f80,`60200x000f,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xf800
- XV,`60200x01f0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0f01,
- V`60200x00fb,`60200xe700
- XV,`60200x00f0,
- XX`6020`6020`6020`60200x0007,`60200xe000,`60200x0007,`60200xe000,`60200x3ffe,
- V`60200x0c30,`60200x1c0c
- XV,`60200x0df0,
- XX
- XX`6020`6020`6020`60200x0f80,`60200x601f,`60200xffff,`60200xfff0,`60200x0fff,
- V`60200xffff,`60200xfc00
- XV,`60200x01b0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0f80,
- V`60200x0075,`60200xde00
- XV,`60200x51f0,
- XX`6020`6020`6020`60200x003f,`60200xfc00,`60200x003f,`60200xfc00,`60200x3ffc,
- V`60200x1c20,`60200x4e04
- XV,`60200x13f8,
- XX
- XX`6020`6020`6020`60200x0d80,`60200x91ff,`60200xffff,`60200xfff0,`60200x07ff,
- V`60200xffff,`60200xfe00
- XV,`60200x01e0,
- XX`6020`6020`6020`60200x0fff,`60200xffff,`60200xffff,`60200xfff0,`60200x0fc0,
- V`60200x006f,`60200x1604
- XV,`60200x8bf0,
- XX`6020`6020`6020`60200x00f3,`60200xff00,`60200x00f3,`60200xff00,`60200x3ffc,
- V`60200x1c20,`60200x6e04
- XV,`60200x2ffc,
- XX
- XX`6020`6020`6020`60200x0780,`60200x0f7f,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xff00
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07f0,
- V`60200x0039,`60200x7c03
- XV,`60200x07e0,
- XX`6020`6020`6020`60200x01c7,`60200xff80,`60200x01c7,`60200xff80,`60200x3ffe,
- V`60200x0c30,`60200x7e0c
- XV,`60200x3ffc,
- XX
- XX`6020`6020`6020`60200x0700,`60200x00ff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xffc0
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07fc,
- V`60200x001d,`60200xb810
- XV,`60200x1fe0,
- XX`6020`6020`6020`60200x031f,`60200xffc0,`60200x031f,`60200xffc0,`60200x1fff,
- V`60200x0818,`60200x3c18
- XV,`60200x7ffe,
- XX
- XX`6020`6020`6020`60200x0710,`60200x03ff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xffff,`60200xffe0
- XV,`60200x00e0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200x0007,`60200xe208
- XV,`60200x7fe0,
- XX`6020`6020`6020`60200x067f,`60200xffe0,`60200x067f,`60200xffe0,`60200x1fff,
- V`60200x881e,`60200x1878
- XV,`60200x7ffe,
- XX
- XX`6020`6020`6020`60200x0708,`60200x07ff,`60200xffff,`60200xffe0,`60200x03ff,
- V`60200xffff,`60200xfff8
- XV,`60200x00c0,
- XX`6020`6020`6020`60200x07ff,`60200xffff,`60200xffff,`60200xffe0,`60200x07ff,
- V`60200xc000,`60200x0191
- XV,`60200xffe0,
- XX`6020`6020`6020`60200x0cff,`60200xfff0,`60200x0cff,`60200xfff0,`60200x0fff,
- V`60200xf00f,`60200x81f0
- XV,`60200x7ffe,
- XX
- XX`6020`6020`6020`60200x0228,`60200x1fff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xffff,`60200xfffe
- XV,`60200x01c0,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xf800,`60200x0077
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x0bff,`60200xfff0,`60200x0bff,`60200xfff0,`60200x0fff,
- V`60200xf00f,`60200xfff0
- XV,`60200x7ffe,
- XX
- XX`6020`6020`6020`60200x0214,`60200x7fff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xffff,`60200xffff
- XV,`60200xc1c0,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xff00,`60200x001f
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x1fff,`60200xff98,`60200x1ff0,`60200x0ff8,`60200x07ff,
- V`60200xe007,`60200xffe0
- XV,`60200x3ffc,
- XX
- XX`6020`6020`6020`60200x0203,`60200xffff,`60200xffff,`60200xffc0,`60200x01ff,
- V`60200xffff,`60200xffff
- XV,`60200xf980,
- XX`6020`6020`6020`60200x03ff,`60200xffff,`60200xffff,`60200xffc0,`60200x03ff,
- V`60200xff00,`60200x00ff
- XV,`60200xffc0,
- XX`6020`6020`6020`60200x1fff,`60200xff08,`60200x1f80,`60200x01f8,`60200x03ff,
- V`60200xc003,`60200xffc0
- XV,`60200x3ffc,
- XX
- XX`6020`6020`6020`60200x011f,`60200xffff,`60200xffff,`60200xff80,`60200x01ff,
- V`60200xffff,`60200xffff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x01ff,`60200xffff,`60200xffff,`60200xff80,`60200x01ff,
- V`60200xffe0,`60200x07ff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x1fff,`60200xfe18,`60200x1e03,`60200xc078,`60200x0b7e,
- V`60200x680b,`60200x7e68
- XV,`60200x1ff8,
- XX
- XX`6020`6020`6020`60200x01ff,`60200xffff,`60200xffff,`60200xff80,`60200x00ff,
- V`60200xffff,`60200xffff
- XV,`60200xdf00,
- XX`6020`6020`6020`60200x01ff,`60200xffff,`60200xffff,`60200xff80,`60200x01ff,
- V`60200xffff,`60200xffff
- XV,`60200xff80,
- XX`6020`6020`6020`60200x3fff,`60200xfc1c,`60200x3801,`60200xe01c,`60200x15f9,
- V`60200xd415,`60200xf9d4
- XV,`60200x1bd4,
- XX
- XX`6020`6020`6020`60200x00fb,`60200xffff,`60200xffff,`60200xff00,`60200x00ff,
- V`60200xffff,`60200xffff
- XV,`60200xff00,
- XX`6020`6020`6020`60200x00ff,`60200xffff,`60200xffff,`60200xdf00,`60200x00ff,
- V`60200xffff,`60200xffff
- XV,`60200xdf00,
- XX`6020`6020`6020`60200x3fff,`60200xf83c,`60200x3009,`60200xf00c,`60200x0aae,
- V`60200xa80a,`60200xaea8
- XV,`60200x2e2a,
- XX
- XX`6020`6020`6020`60200x00ff,`60200xffff,`60200xffff,`60200xff00,`60200x007f,
- V`60200xffff,`60200xffff
- XV,`60200xbe00,
- XX`6020`6020`6020`60200x00ff,`60200xffff,`60200xffff,`60200xff00,`60200x00ff,
- V`60200xffff,`60200xffff
- XV,`60200xff00,
- XX`6020`6020`6020`60200x3fff,`60200xf03c,`60200x200c,`60200xf004,`60200x0155,
- V`60200x4001,`60200x5540
- XV,`60200x17d4,
- XX
- XX`6020`6020`6020`60200x007f,`60200xffff,`60200xffff,`60200xbe00,`60200x003f,
- V`60200xffff,`60200xffff
- XV,`60200x7c00,
- XX`6020`6020`6020`60200x007f,`60200xffff,`60200xffff,`60200xbe00,`60200x007f,
- V`60200xffff,`60200xffff
- XV,`60200xbe00,
- XX`6020`6020`6020`60200x3fff,`60200xf03c,`60200x200f,`60200xf004,`60200x3e1f,
- V`60200x0f87,`60200xc000
- XV,`60200x0000,
- XX
- XX`6020`6020`6020`60200x003f,`60200xffff,`60200xffff,`60200x7c00,`60200x001f,
- V`60200xffff,`60200xfff8
- XV,`60200xf800,
- XX`6020`6020`6020`60200x003f,`60200xffff,`60200xffff,`60200x7c00,`60200x003f,
- V`60200xffff,`60200xffff
- XV,`60200x7c00,
- XX`6020`6020`6020`60200x3fff,`60200xf83c,`60200x300f,`60200xf00c,`60200x7f3f,
- V`60200x9fcf,`60200xe000
- XV,`60200x03c0,
- XX
- XX`6020`6020`6020`60200x001f,`60200xffff,`60200xfff8,`60200xf800,`60200x000f,
- V`60200xffff,`60200xffe1
- XV,`60200xf000,
- XX`6020`6020`6020`60200x001f,`60200xffff,`60200xfff8,`60200xf800,`60200x001f,
- V`60200xffff,`60200xfff8
- XV,`60200xf800,
- XX`6020`6020`6020`60200x3fff,`60200xfc1c,`60200x3807,`60200xe01c,`60200xffff,
- V`60200xfffe,`60200xf000
- XV,`60200x0df0,
- XX
- XX`6020`6020`6020`60200x000f,`60200xffff,`60200xffe1,`60200xf000,`60200x0003,
- V`60200xffff,`60200xff07
- XV,`60200xa000,
- XX`6020`6020`6020`60200x000f,`60200xffff,`60200xffe1,`60200xf000,`60200x000f,
- V`60200xffff,`60200xffe1
- XV,`60200xf000,
- XX`6020`6020`6020`60200x1fff,`60200xfe18,`60200x1e03,`60200xc078,`60200x3fff,
- V`60200x3ff8,`60200x3000
- XV,`60200x13f8,
- XX
- XX`6020`6020`6020`60200x0003,`60200xffff,`60200xff07,`60200xa000,`60200x0007,
- V`60200xffff,`60200xf00e
- XV,`60200x4000,
- XX`6020`6020`6020`60200x0003,`60200xffff,`60200xff07,`60200xa000,`60200x0003,
- V`60200xffff,`60200xff07
- XV,`60200xa000,
- XX`6020`6020`6020`60200x1fff,`60200xff08,`60200x1f80,`60200x01f8,`60200x8ffc,
- V`60200x7ff1,`60200x1ad2
- XV,`60200x2ffc,
- XX
- XX`6020`6020`6020`60200x0007,`60200xffff,`60200xf00e,`60200x4000,`60200x00ab,
- V`60200xffff,`60200xfc7d
- XV,`60200xff00,
- XX`6020`6020`6020`60200x0007,`60200xffff,`60200xf00e,`60200x4000,`60200x0007,
- V`60200xffff,`60200xf00e
- XV,`60200x4000,
- XX`6020`6020`6020`60200x1fff,`60200xff98,`60200x1ff0,`60200x0ff8,`60200x3fff,
- V`60200x3ff8,`60200x3000
- XV,`60200x381c,
- XX
- XX`6020`6020`6020`60200x00ab,`60200xffff,`60200xfc7d,`60200xff00,`60200x0155,
- V`60200xffff,`60200xffe3
- XV,`60200xd540,
- XX`6020`6020`6020`60200x00ab,`60200xffff,`60200xfc7d,`60200xff00,`60200x00ab,
- V`60200xffff,`60200xfc7d
- XV,`60200xff00,
- XX`6020`6020`6020`60200x0fff,`60200xfff0,`60200x0fff,`60200xfff0,`60200xffff,
- V`60200xfffe,`60200xf000
- XV,`60200x6186,
- XX
- XX`6020`6020`6020`60200x0155,`60200xffff,`60200xffe3,`60200xd540,`60200x02aa,
- V`60200xff7f,`60200xffcf
- XV,`60200xaaa0,
- XX`6020`6020`6020`60200x0155,`60200xffff,`60200xffe3,`60200xd540,`60200x0155,
- V`60200xffff,`60200xffe3
- XV,`60200xd540,
- XX`6020`6020`6020`60200x0fff,`60200xfff0,`60200x0fff,`60200xfff0,`60200x7f3f,
- V`60200x9fcf,`60200xe000
- XV,`60200x42c2,
- XX
- XX`6020`6020`6020`60200x02aa,`60200xff7f,`60200xffcf,`60200xaaa0,`60200x0555,
- V`60200x5f3f,`60200xfc7f
- XV,`60200x5550,
- XX`6020`6020`6020`60200x02aa,`60200xff7f,`60200xffcf,`60200xaaa0,`60200x02aa,
- V`60200xff7f,`60200xffcf
- XV,`60200xaaa0,
- XX`6020`6020`6020`60200x07ff,`60200xff60,`60200x07ff,`60200xff60,`60200x3e1f,
- V`60200x0f87,`60200xc000
- XV,`60200x43c2,
- XX
- XX`6020`6020`6020`60200x0555,`60200x5f3f,`60200xfc7f,`60200x5550,`60200x0aaa,
- V`60200xaff3,`60200xcffe
- XV,`60200xaaa0,
- XX`6020`6020`6020`60200x0555,`60200x5f3f,`60200xfc7f,`60200x5550,`60200x0555,
- V`60200x5f3f,`60200xfc7f
- XV,`60200x5550,
- XX`6020`6020`6020`60200x03ff,`60200xfcc0,`60200x03ff,`60200xfcc0,`60200x30c3,
- V`60200x0c49,`60200x2000
- XV,`60200x6186,
- XX
- XX`6020`6020`6020`60200x0aaa,`60200xaff3,`60200xcffe,`60200xaaa0,`60200x0555,
- V`60200x57f8,`60200x1ff5
- XV,`60200x5540,
- XX`6020`6020`6020`60200x0aaa,`60200xaff3,`60200xcffe,`60200xaaa0,`60200x0aaa,
- V`60200xaff3,`60200xcffe
- XV,`60200xaaa0,
- XX`6020`6020`6020`60200x07ff,`60200xff68,`60200x07ff,`60200xff68,`60200x79e7,
- V`60200x9e33,`60200xd000
- XV,`60200x381c,
- XX
- XX`6020`6020`6020`60200x0555,`60200x57f8,`60200x1ff5,`60200x5540,`60200x02aa,
- V`60200xaaff,`60200xffaa
- XV,`60200xaa80,
- XX`6020`6020`6020`60200x0555,`60200x57f8,`60200x1ff5,`60200x5540,`60200x0555,
- V`60200x57f8,`60200x1ff5
- XV,`60200x5540,
- XX`6020`6020`6020`60200x15ff,`60200xf9d4,`60200x15ff,`60200xf9d4,`60200x3fcf,
- V`60200xf349,`60200x2000
- XV,`60200x3ffc,
- XX
- XX`6020`6020`6020`60200x02aa,`60200xaaff,`60200xffaa,`60200xaa80,`60200x0055,
- V`60200x555f,`60200xf555
- XV,`60200x5500,
- XX`6020`6020`6020`60200x02aa,`60200xaaff,`60200xffaa,`60200xaa80,`60200x02aa,
- V`60200xaaff,`60200xffaa
- XV,`60200xaa80,
- XX`6020`6020`6020`60200x2adf,`60200xe3aa,`60200x2adf,`60200xe3aa,`60200x3fcf,
- V`60200xf366,`60200x6600
- XV,`60200x1ff8,
- XX
- XX`6020`6020`6020`60200x0055,`60200x555f,`60200xf555,`60200x5500,`60200x000a,
- V`60200xaaaa,`60200xaaaa
- XV,`60200xa000,
- XX`6020`6020`6020`60200x0055,`60200x555f,`60200xf555,`60200x5500,`60200x0055,
- V`60200x555f,`60200xf555
- XV,`60200x5500,
- XX`6020`6020`6020`60200x157c,`60200x3f54,`60200x157c,`60200x3f54,`60200x79e7,
- V`60200x9e3c,`60200xf900
- XV,`60200x13d4,
- XX
- XX`6020`6020`6020`60200x000a,`60200xaaaa,`60200xaaaa,`60200xa000,`60200x0000,
- V`60200x0555,`60200x5550
- XV,`60200x0000,
- XX`6020`6020`6020`60200x000a,`60200xaaaa,`60200xaaaa,`60200xa000,`60200x000a,
- V`60200xaaaa,`60200xaaaa
- XV,`60200xa000,
- XX`6020`6020`6020`60200x0aaf,`60200xfaa8,`60200x0aaf,`60200xfaa8,`60200x30c3,
- V`60200x0c3c,`60200xf900
- XV,`60200x2a2a,
- XX
- XX`6020`6020`6020`60200x0000,`60200x0555,`60200x5550,`60200x0000,`60200x0000,
- V`60200x0000,`60200x0000
- XV,`60200x0000,
- XX`6020`6020`6020`60200x0000,`60200x0555,`60200x5550,`60200x0000,`60200x0000,
- V`60200x0555,`60200x5550
- XV,`60200x0000,
- XX`6020`6020`6020`60200x0155,`60200x5540,`60200x0155,`60200x5540,`60200x0000,
- V`60200x0066,`60200x6600
- XV,`60200x1554
- XX`607D;
- XX
- XXstatic`6020RelativeTokens`6009relativeTokens`6020=`6020`607B
- XX`6009`607B`6020REAR,`6009FRONT,`6020RIGHT,`6020LEFT`6020`607D,`6009/*`6020me
- V`6020north,`6020him`6020`605Bn
- XV,`6020s,`6020e,`6020w`605D`6020*/
- XX`6009`607B`6020FRONT,`6020REAR,`6020LEFT,`6020RIGHT`6020`607D,`6009/*`6020me
- V`6020south,`6020him`6020`605Bn
- XV,`6020s,`6020e,`6020w`605D`6020*/
- XX`6009`607B`6020LEFT,`6020RIGHT,`6020REAR,`6020FRONT`6020`607D,`6009/*`6020me
- V`6020east`6020...`6020*/
- XX`6009`607B`6020RIGHT,`6020LEFT,`6020FRONT,`6020REAR`6020`607D`6009/*`6020me
- V`6020west`6020...`6020*/
- XX`607D;
- XX
- XX/*`6020
- XX`6020*`6020Initialize`6020the`6020display`6020manager.
- XX`6020*/
- XX
- XXInitDisplay(argc,`6020argv)
- XXchar`6020**argv;
- XX`607B
- XX`6009register`6020int`6009i;
- XX`6009register`6020RatState`6009*rsp;
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020MAXRATS;`6020i++)`6020`607B
- XX`6009`6009rsp`6020=`6020`6026clearArray`605Bi`605D;
- XX`6009`6009rsp->playing`6020=`6020FALSE;
- XX`6009`6009rsp->x`6020=`60201;
- XX`6009`6009rsp->y`6020=`60201;
- XX`6009`6009rsp->dir`6020=`6020NORTH;
- XX`6009`607D
- XX
- XX`6009InitWindow(argc,`6020argv);
- XX`607D
- XX
- XX/*
- XX`6020*`6020all`6020in`6020the`6020name`6020of`6020portability...`6020actually
- V`6020put`6020the`6020di
- XVsplay`6020on
- XX`6020*`6020the`6020screen.`6020Some`6020window`6020systems`6020need`6020to
- V`6020do`6020initializati
- XVon`6020before
- XX`6020*`6020the`6020net`6020is`6020started,`6020but`6020don't`6020want`6020to
- V`6020display`6020until
- XV`6020after.
- XX`6020*/
- XX
- XXStartDisplay()
- XX`607B
- XX`6009StartWindow(ratBits,`6020ratBits_width,`6020ratBits_height);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Manage`6020the`6020top`6020portion`6020of`6020the`6020screen,`6020
- Vthe`6020perspective
- XV`6020view`6020of`6020the
- XX`6020*`6020maze,`6020with`6020the`6020eyeballs.`6020What`6020is`6020seen`6020
- Vis`6020controlled`6020b
- XVy`6020the`6020position
- XX`6020*`6020in`6020the`6020maze`6020and`6020what`6020players`6020are`6020visib
- Vle.`6020This`6020latter
- XV`6020is`6020recorded
- XX`6020*`6020in`6020the`6020R2d2`6020array`6020(the`6020significance`6020of`602
- V0the`6020name`6020is
- XV`6020lost`6020to
- XX`6020*`6020history),`6020which`6020is`6020recomputed`6020every`6020time`6020s
- Vomeone`6020moves.
- XX`6020*
- XX`6020*`6020The`6020perspective`6020view`6020is`6020calculated`6020on`6020the
- V`6020fly`6020from`6020th
- XVe`6020viewTable`6020array.
- XX`6020*`6020viewTable`6020contains`6020a`6020set`6020of`602012`6020line`6020se
- Vgments`6020for`602030
- XV`6020views.`6020The`6020longest
- XX`6020*`6020corridor`6020is`602030`6020spaces,`6020and`6020for`6020each`6020ce
- Vll`6020in`6020the`6020maz
- XVe,`6020there`6020are`602012
- XX`6020*`6020distinct`6020lines`6020(wall`6020edges)`6020that`6020could`6020be
- V`6020visible`6020(neve
- XVr`6020all`6020at`6020once).
- XX`6020*
- XX`6020*`6020Each`6020time,`6020march`6020down`6020the`6020hall`6020in`6020the
- V`6020direction`6020faced
- XV`6020and`6020figure
- XX`6020*`6020out`6020which`6020lines`6020to`6020actually`6020draw.`6020Then`602
- V0look`6020in`6020R2d2
- XV`6020and`6020draw`6020in`6020opponents.
- XX`6020*/
- XX
- XX#define`6009NDIR`6009NDIRECTION
- XXstatic`6020Boolean`6009prevEdge3,`6020prevEdge7;`6009/*`6020plotter`6020smart
- Vs`6020*/
- XXstatic`6020Boolean`6009edge1,`6020edge2,`6020edge3,`6020edge4,`6020edge5,`602
- V0edge6,`6020edge7
- XV;
- XXstatic`6020XYpair`6009edge3Lines`605B2`605D,`6020edge7Lines`605B2`605D;
- XXstatic`6020XY`6009l1Delta`605BNDIR`605D`6020=`6020`607B`6020`607B0,`6020-1
- V`607D,`6020`607B0,`60201`607D,`6020
- XV`607B1,`60200`607D,`6020`607B-1,`60200`607D`6020`607D;
- XXstatic`6020XY`6009l2Delta`605BNDIR`605D`6020=`6020`607B`6020`607B1,`6020-1
- V`607D,`6020`607B-1,`60201`607D,
- XV`6020`607B1,`60201`607D,`6020`607B-1,`6020-1`607D`6020`607D;
- XXstatic`6020XY`6009c2Delta`605BNDIR`605D`6020=`6020`607B`6020`607B1,`60200`607
- VD,`6020`607B-1,`60200`607D,`6020
- XV`607B0,`60201`607D,`6020`607B0,`6020-1`607D`6020`607D;
- XXstatic`6020XY`6009r1Delta`605BNDIR`605D`6020=`6020`607B`6020`607B0,`60201`607
- VD,`6020`607B0,`6020-1`607D,`6020
- XV`607B-1,`60200`607D,`6020`607B1,`60200`607D`6020`607D;
- XXstatic`6020XY`6009r2Delta`605BNDIR`605D`6020=`6020`607B`6020`607B1,`60201`607
- VD,`6020`607B-1,`6020-1`607D,
- XV`6020`607B-1,`60201`607D,`6020`607B1,`6020-1`607D`6020`607D;
- XX#undef`6009NDIR
- XX
- XXShowView(x,`6020y,`6020dir)
- XXint`6009`6009x,`6020y;
- XXDirection`6009dir;
- XX`607B
- XX`6009register`6020XYpair`6009`6009*tp`6020=`6020viewTable;
- XX`6009register`6020int`6009`6009tx`6020=`6020x;
- XX`6009register`6020int`6009`6009ty`6020=`6020y;
- XX`6009RatId`6009`6009`6009ratId;
- XX`6009RatLook`6009`6009`6009ratLook;
- XX`6009Boolean`6009`6009`6009oldVisible;
- XX`6009XYpair`6009`6009`6009*hidden(),`6020*plotLine();
- XX
- XX`6009ClearView();
- XX`6009prevEdge3`6020=`6020prevEdge7`6020=`6020FALSE;
- XX`6009while`6020(!M.maze`605Btx`605D.y`605Bty`605D)`6020`607B
- XX`6009`6009tp`6020=`6020hidden(tx,`6020ty,`6020dir,`6020tp);`6009/*`6020draw
- V`6020a`6020cell`6020*/
- XX`6009`6009switch`6020(dir)`6020`607B
- XX`6009`6009case`6020NORTH:`6009tx++;`6020break;
- XX`6009`6009case`6020SOUTH:`6009tx--;`6020break;
- XX`6009`6009case`6020EAST:`6009ty++;`6020break;
- XX`6009`6009case`6020WEST:`6009ty--;`6020break;
- XX`6009`6009`607D
- XX`6009`607D
- XX`6009if`6020(prevEdge3)
- XX`6009`6009(void)`6020plotLine(edge3Lines,`6020TRUE);
- XX`6009if`6020(prevEdge7)
- XX`6009`6009(void)`6020plotLine(edge7Lines,`6020TRUE);
- XX
- XX`6009/*`6020show`6020the`6020tokens`6020*/
- XX
- XX`6009for`6020(ratId`6020=`60200;`6020ratId`6020<`6020MAXRATS;`6020ratId++)
- V`6020`607B
- XX`6009`6009if`6020(ratId`6020==`6020M.myRatId)
- XX`6009`6009`6009continue;
- XX`6009`6009ratLook`6020=`6020`6026R2d2`605BratId`605D;
- XX`6009`6009oldVisible`6020=`6020ratLook->visible;
- XX`6009`6009TokenVisible(ratId);
- XX`6009`6009if`6020(ratLook->visible`6020==`6020TRUE)
- XX`6009`6009`6009XORToken(ratId);
- XX`6009`6009if`6020(ratLook->visible`6020!=`6020oldVisible)
- XX`6009`6009`6009UpdateScoreCard(ratId);
- XX`6009`607D
- XX`607D
- XX
- XXXYpair`6009*
- XXplotLine(p,`6020two)
- XXXYpair`6009*p;
- XXBoolean`6009two;
- XX`607B
- XX`6009while`6020(1)`6020`607B
- XX`6009`6009DrawViewLine(p->p1.x,`6020p->p1.y,`6020p->p2.x,`6020p->p2.y);
- XX`6009`6009p++;
- XX`6009`6009if`6020(!two)
- XX`6009`6009`6009return`6020p;
- XX`6009`6009two`6020=`6020FALSE;
- XX`6009`607D
- XX`607D
- XX
- XXXYpair`6020*
- XXhidden(x,`6020y,`6020dir,`6020p)
- XXint`6009`6009x,`6020y;
- XXDirection`6009dir;
- XXXYpair`6009`6009*p;
- XX`607B
- XX`6009int`6009l1x,`6020l1y,`6020l2x,`6020l2y;
- XX`6009int`6009r1x,`6020r1y,`6020r2x,`6020r2y;
- XX`6009int`6009c2x,`6020c2y;
- XX
- XX`6009/*`6020first`6020calculate`6020the`6020coordinates`6020of`6020the`6020ne
- Vighboring`6020cubes
- XV`6020*/
- XX
- XX`6009l1x`6020=`6020x`6020+`6020l1Delta`605Bdir`605D.xcor;`6009/*`6020find`602
- V0left`6020cube`6020*/
- XX`6009l1y`6020=`6020y`6020+`6020l1Delta`605Bdir`605D.ycor;
- XX`6009l2x`6020=`6020x`6020+`6020l2Delta`605Bdir`605D.xcor;`6009/*`6020find`602
- V0left`6020forward`6020cub
- XVe`6020*/
- XX`6009l2y`6020=`6020y`6020+`6020l2Delta`605Bdir`605D.ycor;
- XX`6009r1x`6020=`6020x`6020+`6020r1Delta`605Bdir`605D.xcor;`6009/*`6020find`602
- V0right`6020cube`6020*/
- XX`6009r1y`6020=`6020y`6020+`6020r1Delta`605Bdir`605D.ycor;
- XX`6009r2x`6020=`6020x`6020+`6020r2Delta`605Bdir`605D.xcor;`6009/*`6020find`602
- V0right`6020forward`6020cu
- XVbe`6020*/
- XX`6009r2y`6020=`6020y`6020+`6020r2Delta`605Bdir`605D.ycor;
- XX`6009c2x`6020=`6020x`6020+`6020c2Delta`605Bdir`605D.xcor;`6009/*`6020find`602
- V0forward`6020cube`6020*/
- XX`6009c2y`6020=`6020y`6020+`6020c2Delta`605Bdir`605D.ycor;
- XX
- XX`6009/*`6020next`6020calculate`6020which`6020of`6020the`60207`6020possible
- V`6020cube`6020edges`6020ar
- XVe`6020visible`6020*/
- XX
- XX`6009edge2`6020=`6020M.maze`605Bc2x`605D.y`605Bc2y`605D;`6009/*`6020c2`6020*/
- V
- XX`6009edge3`6020=`6020M.maze`605Bl1x`605D.y`605Bl1y`605D;`6009/*`6020l1`6020*/
- V
- XX`6009edge4`6020=`6020!edge3;`6009`6009`6009/*`6020!l1`6020*/
- XX
- XX`6009edge7`6020=`6020M.maze`605Br1x`605D.y`605Br1y`605D;`6009/*`6020r1`6020*/
- V
- XX`6009edge6`6020=`6020!edge7;`6009`6009`6009/*`6020!r1`6020*/
- XX
- XX`6009edge1`6020=`6020edge3`6020`6026`6026`6020(edge2`6020`607C`607C`6020!M.ma
- Vze`605Bl2x`605D.y`605Bl2y`605D)
- XV
- XX`6009`6009`607C`607C`6020((!edge2)`6020`6026`6026`6020edge4);
- XX`6009edge5`6020=`6020edge7`6020`6026`6026`6020(edge2`6020`607C`607C`6020!M.ma
- Vze`605Br2x`605D.y`605Br2y`605D)
- XV
- XX`6009`6009`607C`607C`6020((!edge2)`6020`6026`6026`6020edge6);
- XX
- XX`6009/*`6020
- XX`6009`6020*`6020Should`6020be`6020matching`6020the`6020following:
- XX`6009`6020*`6009x1`6020=`6020l1`6020(c2`6020+`6020!l2)`6020+`6020!c2`6020!l1
- XX`6009`6020*`6009x2`6020=`6020c2
- XX`6009`6020*`6009x3`6020=`6020l1
- XX`6009`6020*`6009x4`6020=`6020!l1
- XX`6009`6020*`6009x5`6020=`6020r1`6020(c2`6020+`6020!r2)`6020+`6020!c2`6020!r1
- XX`6009`6020*`6009x6`6020=`6020!r1
- XX`6009`6020*`6009x7`6020=`6020r1
- XX`6009`6020*/
- XX
- XX`6009if`6020(edge1)
- XX`6009`6009p`6020=`6020plotLine(p,`6020FALSE);
- XX`6009else
- XX`6009`6009p++;
- XX`6009if`6020(edge2)
- XX`6009`6009p`6020=`6020plotLine(p,`6020TRUE);
- XX`6009else
- XX`6009`6009p`6020+=`60202;
- XX`6009if`6020(edge3)`6020`607B
- XX`6009`6009if`6020(prevEdge3)`6020`607B
- XX`6009`6009`6009edge3Lines`605B0`605D.p2`6020=`6020(p++)->p2;
- XX`6009`6009`6009edge3Lines`605B1`605D.p2`6020=`6020p->p2;
- XX`6009`6009`607D`6020else`6020`607B
- XX`6009`6009`6009edge3Lines`605B0`605D`6020=`6020*p++;
- XX`6009`6009`6009edge3Lines`605B1`605D`6020=`6020*p;
- XX`6009`6009`6009prevEdge3`6020=`6020TRUE;
- XX`6009`6009`607D
- XX`6009`6009p++;
- XX`6009`607D`6020else`6020`607B
- XX`6009`6009if`6020(prevEdge3)`6020`607B
- XX`6009`6009`6009(void)`6020plotLine(edge3Lines,`6020TRUE);
- XX`6009`6009`6009prevEdge3`6020=`6020FALSE;
- XX`6009`6009`607D
- XX`6009`6009p`6020+=`60202;
- XX`6009`607D
- XX`6009if`6020(edge4)
- XX`6009`6009p`6020=`6020plotLine(p,`6020TRUE);
- XX`6009else
- XX`6009`6009p`6020+=`60202;
- XX`6009if`6020(edge5)
- XX`6009`6009p`6020=`6020plotLine(p,`6020FALSE);
- XX`6009else
- XX`6009`6009p++;
- XX`6009if`6020(edge6)
- XX`6009`6009p`6020=`6020plotLine(p,`6020TRUE);
- XX`6009else
- XX`6009`6009p`6020+=`60202;
- XX`6009if`6020(edge7)`6020`607B
- XX`6009`6009if`6020(prevEdge7)`6020`607B
- XX`6009`6009`6009edge7Lines`605B0`605D.p1`6020=`6020(p++)->p1;
- XX`6009`6009`6009edge7Lines`605B1`605D.p1`6020=`6020p->p1;
- XX`6009`6009`607D`6020else`6020`607B
- XX`6009`6009`6009edge7Lines`605B0`605D`6020=`6020*p++;
- XX`6009`6009`6009edge7Lines`605B1`605D`6020=`6020*p;
- XX`6009`6009`6009prevEdge7`6020=`6020TRUE;
- XX`6009`6009`607D
- XX`6009`6009p++;
- XX`6009`607D`6020else`6020`607B
- XX`6009`6009if`6020(prevEdge7)`6020`607B
- XX`6009`6009`6009(void)`6020plotLine(edge7Lines,`6020TRUE);
- XX`6009`6009`6009prevEdge7`6020=`6020FALSE;
- XX`6009`6009`607D
- XX`6009`6009p`6020+=`60202;
- XX`6009`607D
- XX`6009return`6020p;
- XX`607D
- XX
- XX/*
- XX`6020*`6020sets`6020R2d2`605BhisRatId`605D`6020variables
- XX`6020*`6020uses`6020M.ratcb`605BhisRatId`605D`6020as`6020input`6020for`6020hi
- Vs`6020position`6020and
- XV`6020direction
- XX`6020*/
- XX
- XXTokenVisible(hisRatId)
- XXRatId`6009hisRatId;
- XX`607B
- XX`6009RatLook`6009`6009ratLook`6020=`6020`6026R2d2`605BhisRatId`605D;
- XX`6009RatInfo`6009`6009ratInfo`6020=`6020`6026M.ratcb.rats`605BhisRatId`605D;
- XX`6009Loc`6009`6009tx,`6020ty;
- XX`6009Direction`6009td;
- XX`6009int`6009`6009ix,`6020ix12;
- XX
- XX`6009ratLook->visible`6020=`6020FALSE;
- XX`6009if`6020(!ratInfo->playing)
- XX`6009`6009return;
- XX`6009if`6020(M.peeking)`6020`607B
- XX`6009`6009tx`6020=`6020M.xPeek;
- XX`6009`6009ty`6020=`6020M.yPeek;
- XX`6009`6009td`6020=`6020M.dirPeek;
- XX`6009`607D`6020else`6020`607B
- XX`6009`6009tx`6020=`6020M.xloc;
- XX`6009`6009ty`6020=`6020M.yloc;
- XX`6009`6009td`6020=`6020M.dir;
- XX`6009`607D
- XX`6009ix`6020=`60200;
- XX`6009while`6020(!M.maze`605Btx`605D.y`605Bty`605D)`6020`607B
- XX`6009`6009switch(td)`6020`607B
- XX`6009`6009case`6020NORTH:`6009tx++;`6020break;
- XX`6009`6009case`6020SOUTH:`6009tx--;`6020break;
- XX`6009`6009case`6020EAST:`6009ty++;`6020break;
- XX`6009`6009case`6020WEST:`6009ty--;`6020break;
- XX`6009`6009`607D
- XX`6009`6009ix++;
- XX`6009`6009if`6020((tx`6020==`6020ratInfo->xLoc)`6020`6026`6026`6020(ty`6020==
- V`6020ratInfo->yLoc))
- XV`6020`607B
- XX`6009`6009`6009ratLook->visible`6020=`6020TRUE;
- XX`6009`6009`6009ix12`6020=`6020ix`6020*`602012;
- XX`6009`6009`6009ratLook->x`6020=`6020(viewTable`605Bix12+3`605D.p2.x`6020+
- XX`6009`6009`6009`6009`6020`6020`6020`6020`6020viewTable`605Bix12+10`605D.p1.x)
- V/2;
- XX`6009`6009`6009ratLook->y`6020=`6020(viewTable`605Bix12+3`605D.p1.y`6020+
- XX`6009`6009`6009`6009`6020`6020`6020`6020`6020viewTable`605Bix12+3`605D.p2.y)/
- V2;
- XX`6009`6009`6009ratLook->tokenId`6020=`6020relativeTokens`605Btd`605D.t`605Bra
- VtInfo->dir`605D;
- XX`6009`6009`6009ratLook->distance`6020=`6020ix;
- XX`6009`6009`6009break;
- XX`6009`6009`607D
- XX`6009`607D
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020draw`6020him`6020into`6020the`6020maze,`6020with`6020the`6020right
- V`6020size`6020for`6020his
- XV`6020distance`6020away
- XX`6020*`6020and`6020facing`6020the`6020right`6020way.
- XX`6020*/
- XX
- XXXORToken(hisRatId)
- XXRatId`6009hisRatId;
- XX`607B
- XX`6009int`6009size;
- XX`6009int`6009srcX,`6020srcY;
- XX
- XX`6009getRat(hisRatId,`6020`6026srcX,`6020`6026srcY,`6020`6026size);
- XX`6009DisplayRatBitmap(R2d2`605BhisRatId`605D.x`6020-`6020size/2,
- XX`6009`6009`6009R2d2`605BhisRatId`605D.y`6020`6020-`6020size/2,
- XX`6009`6009`6009size,`6020size,`6020srcX,`6020srcY);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Dig`6020the`6020appropriate`6020bitmap`6020out`6020of`6020the`6020
- Vmaster`6020bitmap,
- XV`6020which`6020has`6020all
- XX`6020*`6020possible`6020views`6020neatly`6020packed`6020into`6020place.
- XX`6020*/
- XX
- XXgetRat(hisRatId,`6020x,`6020y,`6020size)
- XXRatId`6009hisRatId;
- XXint`6009*x,`6020*y,`6020*size;
- XX`607B
- XX`6009int`6009viewT`6020=`6020LEFT;
- XX`6009int`6009view`6020=`6020R2d2`605BhisRatId`605D.tokenId;
- XX
- XX`6009switch`6020(R2d2`605BhisRatId`605D.distance)`6020`607B
- XX`6009`6009case`60201:
- XX`6009`6009`6009*size`6020=`602064;
- XX`6009`6009`6009*x`6020=`60200;
- XX`6009`6009`6009*y`6020=`60200;
- XX`6009`6009`6009for`6020(viewT`6020=`60200;`6020viewT`6020!=`6020view;`6020*x
- V`6020+=`602064)
- XX`6009`6009`6009`6009viewT++;
- XX`6009`6009`6009return;
- XX
- XX`6009`6009case`60202:
- XX`6009`6009`6009*size`6020=`602032;
- XX`6009`6009`6009for`6020(*x`6020=`60204*64;`6020*x`6020!=`602064*5;`6020*x`602
- V0+=`602032)
- XX`6009`6009`6009`6009for`6020(*y`6020=`60200;`6020*y`6020!=`602064;`6020*y`602
- V0+=`602032)
- XX`6009`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009case`60203:
- XX`6009`6009`6009*size`6020=`602024;
- XX`6009`6009`6009for`6020(*x`6020=`60205*64;`6020*x`6020!=`602064*5+48;`6020*x
- V`6020+=`602024)
- XX`6009`6009`6009`6009for`6020(*y`6020=`60200;`6020*y`6020!=`602048;`6020*y`602
- V0+=`602024)
- XX`6009`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009case`60204:
- XX`6009`6009case`60205:
- XX`6009`6009`6009*size`6020=`602016;
- XX`6009`6009`6009*x`6020=`602064*5+48;
- XX`6009`6009`6009for`6020(*y`6020=`60200;`6020*y`6020!=`602064;`6020*y`6020+=
- V`602016)
- XX`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009case`60206:
- XX`6009`6009case`60207:
- XX`6009`6009case`60208:
- XX`6009`6009`6009*size`6020=`60209;
- XX`6009`6009`6009*y`6020=`602048;
- XX`6009`6009`6009for`6020(*x`6020=`602064*5;`6020*x`6020!=`602064*5`6020+`60204
- V*9;`6020*x`6020+=`60209)
- XX`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009case`60209:
- XX`6009`6009case`602010:
- XX`6009`6009case`602011:
- XX`6009`6009case`602012:
- XX`6009`6009`6009*size`6020=`60206;
- XX`6009`6009`6009*y`6020=`602048+9;
- XX`6009`6009`6009for`6020(*x`6020=`602064*5;`6020*x`6020!=`602064*5`6020+`60204
- V*6;`6020*x`6020+=`60206)
- XX`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009case`602013:
- XX`6009`6009case`602014:
- XX`6009`6009case`602015:
- XX`6009`6009case`602016:
- XX`6009`6009case`602017:
- XX`6009`6009case`602018:
- XX`6009`6009`6009*size`6020=`60204;
- XX`6009`6009`6009*y`6020=`602048+9+3;
- XX`6009`6009`6009for`6020(*x`6020=`602064*5`6020+`60204*6;`6020*x`6020!=`602064
- V*5`6020+4*6`6020+`60204*4;
- XV`6020*x`6020+=`60204)
- XX`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009viewT++;
- XX
- XX`6009`6009default:
- XX`6009`6009`6009*size`6020=`60203;
- XX`6009`6009`6009*y`6020=`602048+9;
- XX`6009`6009`6009for`6020(*x`6020=`602064*5`6020+`60204*6;`6020*x`6020!=`602064
- V*5`6020+`60204*6`6020+`60204*3;
- XV`6020*x`6020+=`60203)
- XX`6009`6009`6009`6009if`6020(viewT`6020==`6020view)
- XX`6009`6009`6009`6009`6009return;
- XX`6009`6009`6009`6009else
- XX`6009`6009`6009`6009`6009viewT++;
- XX`6009`607D
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020The`6020maze`6020display.`6020This`6020is`6020controlled`6020by
- V`6020the`6020clearArray
- XV`6020(another
- XX`6020*`6020historically`6020significant`6020name,`6020I'm`6020afraid).`6020Ea
- Vch`6020player`6020h
- XVas`6020his
- XX`6020*`6020loaction`6020and`6020playing`6020information`6020stored`6020here
- V`6020as`6020well`6020as
- XV`6020in`6020M.ratcb.
- XX`6020*`6020This`6020is`6020to`6020tell`6020who`6020was`6020playing`6020before
- V`6020the`6020last`6020upd
- XVate/status/location
- XX`6020*`6020packet`6020came`6020in,`6020so`6020we`6020can`6020do`6020the`6020r
- Vight`6020thing`6020for
- XV`6020adding/deleting`6020players.
- XX`6020*
- XX`6020*`6020There`6020are`6020various`6020hooks`6020for`6020setting`6020the
- V`6020contents`6020of`6020c
- XVlearArray
- XX`6020*`6020from`6020the`6020outside,`6020like`6020SetMyRatId().
- XX`6020*/
- XX
- XXSetMyRatId(ratId)
- XXRatId`6009ratId;
- XX`607B
- XX`6009clearArray`605BratId`605D.playing`6020=`6020TRUE;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Someone`6020joined`6020us;`6020add`6020him`6020to`6020the`6020disp
- Vlay.
- XX`6020*/
- XX
- XXAddNewPlayer(ratId,`6020xloc,`6020yloc,`6020dir)
- XXRatId`6009ratId;
- XXDirection`6020dir;
- XX`607B
- XX`6009clearArray`605BratId`605D.playing`6020=`6020TRUE;
- XX`6009clearArray`605BratId`605D.x`6020=`6020xloc;
- XX`6009clearArray`605BratId`605D.y`6020=`6020yloc;
- XX`6009clearArray`605BratId`605D.dir`6020=`6020dir;
- XX`6009DisplayOthersPosition(ratId,`6020xloc,`6020yloc,`6020dir);
- XX`6009NotifyPlayer();
- XX`607D
- XX
- XX/*
- XX`6020*`6020Someone`6020left.
- XX`6020*/
- XXExitPlayer(ratId)
- XXRatId`6009ratId;
- XX`607B
- XX`6009clearPosition(ratId,`6020clearArray`605BratId`605D.x,`6020clearArray`605
- VBratId`605D.y);
- XV
- XX`6009clearArray`605BratId`605D.playing`6020=`6020FALSE;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Tell`6020the`6020display`6020controller`6020I`6020moved.
- XX`6020*/
- XX
- XXShowPosition(xloc,`6020yloc,`6020invincible,`6020tdir)
- XXint`6009`6009xloc,`6020yloc;
- XXBoolean`6009`6009invincible;
- XXDirection`6009tdir;
- XX`607B
- XX`6009clearPosition(M.myRatId,`6020clearArray`605BM.myRatId`605D.x,
- XX`6009`6009clearArray`605BM.myRatId`605D.y);
- XX`6009showMe(xloc,`6020yloc,`6020invincible,`6020tdir);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Show`6020where`6020everybody`6020is`6020(only`6020for`6020wizards)
- V.
- XX`6020*/
- XX
- XXShowAllPositions()
- XX`607B
- XX`6009RatId`6009ratId;
- XX
- XX`6009for`6020(ratId`6020=`60200;`6020ratId`6020<`6020MAXRATS;`6020ratId++)
- V`6020`607B
- XX`6009`6009if`6020(ratId`6020==`6020M.myRatId)
- XX`6009`6009`6009continue;
- XX`6009`6009if`6020(clearArray`605BratId`605D.playing`6020`6026`6026`6020!M.rat
- Vcb.rats`605BratId`605D.
- XVplaying)
- XX`6009`6009`6009ExitPlayer(ratId);
- XX`6009`6009else`6020if`6020(!clearArray`605BratId`605D.playing`6020`6026`6026
- XX`6009`6009`6009`6020M.ratcb.rats`605BratId`605D.playing)
- XX`6009`6009`6009AddNewPlayer(ratId,`6020M.ratcb.rats`605BratId`605D.xLoc,
- XX`6009`6009`6009`6009`6009`6020`6020`6020`6020M.ratcb.rats`605BratId`605D.yLoc
- V,
- XX`6009`6009`6009`6009`6009`6020`6020`6020`6020M.ratcb.rats`605BratId`605D.dir)
- V;
- XX`6009`6009else`6020if`6020(clearArray`605BratId`605D.playing)
- XX`6009`6009`6009DisplayOthersPosition(ratId,`6020M.ratcb.rats`605BratId`605D.x
- VLoc,
- XX`6009`6009`6009`6009`6009`6009`6020`6020`6020`6020`6020M.ratcb.rats`605BratId
- V`605D.yLoc,
- XX`6009`6009`6009`6009`6009`6009`6020`6020`6020`6020`6020M.ratcb.rats`605BratId
- V`605D.dir);
- XX`6009`607D
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Someone`6020else`6020moved;`6020update`6020his`6020info`6020and
- V`6020display`6020the`6020n
- XVew`6020position.
- XX`6020*`6020Again,`6020only`6020for`6020wizards`6020who`6020are`6020exercising
- V`6020their`6020powers
- XV.
- XX`6020*/
- XX
- XXDisplayOthersPosition(ratId,`6020xloc,`6020yloc,`6020dir)
- XXRatId`6009ratId;
- XXDirection`6020dir;
- XX`607B
- XX`6009if`6020(!clearArray`605BratId`605D.playing`6020`6026`6026`6020M.ratcb.ra
- Vts`605BratId`605D.pla
- XVying)`6020`607B
- XX`6009`6009AddNewPlayer(ratId,`6020xloc,`6020yloc,`6020dir);`6009/*`6020calls
- V`6020me`6020back`6020*
- XV/
- XX`6009`6009return;
- XX`6009`607D
- XX`6009`6009
- XX`6009clearPosition(ratId,`6020clearArray`605BratId`605D.x,`6020clearArray`605
- VBratId`605D.y);
- XV
- XX`6009if`6020(clearArray`605BratId`605D.playing`6020`6026`6026`6020M.omniscien
- Vt)
- XX`6009`6009showOther(ratId,`6020xloc,`6020yloc,`6020dir);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Do`6020the`6020actual`6020work`6020of`6020showing`6020me,`6020with
- V`6020the`6020right`6020so
- XVrt`6020of`6020arrow`6020(in
- XX`6020*`6020case`6020I'm`6020playing`6020wizard).
- XX`6020*/
- XX
- XXshowMe(xloc,`6020yloc,`6020invincible,`6020dir)
- XXint`6009`6009xloc,`6020yloc;
- XXBoolean`6009`6009invincible;
- XXDirection`6009dir;
- XX`607B
- XX`6009register`6020BitCell`6009*bp;
- XX`6009register`6020RatState`6009*rsp;
- XX
- XX`6009if`6020(invincible)
- XX`6009`6009bp`6020=`6020invincibleArrows;
- XX`6009else
- XX`6009`6009bp`6020=`6020normalArrows;
- XX
- XX`6009HackMazeBitmap(xloc,`6020yloc,`6020`6026bp`605Bdir`605D);
- XX
- XX`6009rsp`6020=`6020`6026clearArray`605BM.myRatId`605D;
- XX`6009rsp->playing`6020=`6020TRUE;
- XX`6009rsp->x`6020=`6020xloc;
- XX`6009rsp->y`6020=`6020yloc;
- XX`6009rsp->dir`6020=`6020dir;
- XX`6009M.invincible`6020=`6020invincible;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Bang`6020the`6020bits`6020to`6020show`6020the`6020other`6020guy.
- XX`6020*/
- XX
- XXshowOther(ratId,`6020xloc,`6020yloc,`6020dir)
- XXDirection`6020dir;
- XX`607B
- XX`6009register`6020int`6009`6009i;
- XX`6009register`6020RatState`6009*rsp;
- XX`6009BitCell`6009`6009`6009bits;
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`602016;`6020i++)
- XX`6009`6009bits.bits`605Bi`605D`6020=`6020otherArrows`605Bdir`605D.bits`605Bi
- V`605D`6020`607C
- XX`6009`6009`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020
- V`6020`6020numbers`605BratId`605D.bits`605Bi
- XV`605D;`6020
- XX
- XX`6009HackMazeBitmap(xloc,`6020yloc,`6020`6026bits);
- XX
- XX`6009rsp`6020=`6020`6026clearArray`605BratId`605D;
- XX`6009rsp->playing`6020=`6020TRUE;
- XX`6009rsp->x`6020=`6020xloc;
- XX`6009rsp->y`6020=`6020yloc;
- XX`6009rsp->dir`6020=`6020dir;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020When`6020someone`6020moves`6020off`6020a`6020position,`6020clear
- V`6020it`6020out.`6020If
- XV`6020there's`6020someone
- XX`6020*`6020"under"`6020him,`6020display`6020the`6020second`6020guy.`6020
- XX`6020*/
- XX
- XXclearPosition(ratId,`6020xClear,`6020yClear)
- XXRatId`6009ratId;
- XX`607B
- XX`6009register`6020RatState`6009*rsp;
- XX`6009register`6020int`6009`6009i;
- XX`6009
- XX`6009clearSquare(xClear,`6020yClear);
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020MAXRATS;`6020i++)`6020`607B
- XX`6009`6009rsp`6020=`6020`6026clearArray`605Bi`605D;
- XX`6009`6009if`6020((i`6020==`6020ratId)`6020`607C`607C`6020!(rsp->playing))
- XX`6009`6009`6009continue;
- XX`6009`6009if`6020((rsp->x`6020==`6020xClear)`6020`6026`6026`6020(rsp->y`6020=
- V=`6020yClear))
- XX`6009`6009`6009if`6020(i`6020==`6020M.myRatId)
- XX`6009`6009`6009`6009showMe(rsp->x,`6020rsp->y,`6020M.invincible,`6020rsp->dir
- V);
- XX`6009`6009`6009else
- XX`6009`6009`6009`6009if`6020(M.omniscient)
- XX`6009`6009`6009`6009`6009showOther(i,`6020rsp->x,`6020rsp->y,`6020rsp->dir);
- XX`6009`607D
- XX`607D
- XX
- XXstatic`6020BitCell`6020EMPTY`6020=`6020`607B0,`60200,`60200,`60200,`60200,
- V`60200,`60200,`60200,`60200,
- XV`60200,`60200,`60200,`60200,`60200,`60200,`60200`607D;
- XX
- XX/*`6020clear`6020out`6020a`6020square`6020of`6020the`6020maze`6020*/
- XXclearSquare(xClear,`6020yClear)
- XX`607B
- XX`6009HackMazeBitmap(xClear,`6020yClear,`6020`6026EMPTY);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Handle`6020the`6020score`6020card`6020area.`6020Most`6020of`6020th
- Ve`6020work`6020is`6020don
- XVe`6020in`6020window`6020system
- XX`6020*`6020dependent`6020routines.
- XX`6020*/
- XX
- XXNewScoreCard()
- XX`607B
- XX`6009register`6020RatId`6009ratId;
- XX
- XX`6009for(`6020ratId`6020=`60200;`6020ratId`6020<`6020MAXRATS;`6020ratId++)
- XX`6009`6009UpdateScoreCard(ratId);
- XX`6009if`6020(M.omniscient)
- XX`6009`6009ShowAllPositions();
- XX`607D
- XX
- XXUpdateScoreCard(ratId)
- XXRatId`6009ratId;
- XX`607B
- XX`6009ClearScoreLine(ratId);
- XX`6009if`6020(M.ratcb.rats`605BratId`605D.playing)
- XX`6009`6009WriteScoreString(ratId);
- XX`6009if`6020(R2d2`605BratId`605D.visible`6020==`6020TRUE)
- XX`6009`6009InvertScoreLine(ratId);
- XX`607D
- XX
- XX/*
- XX`6020*`6020Some`6020window`6020systems`6020(notably`6020X10)`6020choose`6020t
- Vo`6020represent`6020b
- XVitmaps`6020in
- XX`6020*`6020little-endian`6020order.`6020That`6020is,`6020the`6020least`6020si
- Vgnificant`6020bit
- XV`6020in`6020the`6020word`6020is
- XX`6020*`6020the`6020leftmost`6020bit`6020on`6020the`6020screen.`6020This`6020m
- Veans`6020that`6020bitma
- XVps`6020look
- XX`6020*`6020"backwards"`6020on`6020the`6020screen`6020from`6020the`6020way`602
- V0they`6020look`6020in
- XV`6020source`6020code.`6020So,`6020we
- XX`6020*`6020flip`6020them`6020all`6020here,`6020once,`6020at`6020initializatio
- Vn`6020time,`6020so
- XV`6020they`6020can`6020be`6020edited
- XX`6020*`6020"by`6020hand".
- XX`6020*
- XX`6020*`6020It`6020is`6020up`6020to`6020the`6020window`6020system`6020initiali
- Vzation`6020code`6020to
- XV`6020call`6020this,`6020if
- XX`6020*`6020deemed`6020necessary.
- XX`6020*
- XX`6020*`6020Hack`6020hack.
- XX`6020*/
- XX
- XXFlipBitmaps()
- XX`607B
- XX`6009register`6020i;
- XX
- XX`6009bitFlip(normalArrows);
- XX`6009bitFlip(invincibleArrows);
- XX`6009bitFlip(otherArrows);
- XX`6009bitFlip(numbers);`6009`6009/*`6020only`6020gets`6020the`6020first`60204
- V`6020*/
- XX`6009bitFlip(`6026numbers`605B4`605D);`6009`6009/*`6020get`6020the`6020rest
- V`6020*/
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020ratBits_width`6020*`6020ratBits_
- Vheight`6020/`602016;
- XV`6020i`6020+=`602064)
- XX`6009`6009bitFlip((BitCell`6020*)`6020`6026ratBits`605Bi`605D);
- XX`607D
- XX
- XX/*
- XX`6020*`6020quick`6020bit`6020flipper`6020--`6020divide`6020and`6020conquer
- V`6020due`6020to`6020Jeff
- XV`6020Mogul.
- XX`6020*`6020unrolled`6020to`6020do`60204`602016`6020bit`6020words,`6020but`602
- V0generally`6020extensib
- XVle.
- XX`6020*/
- XX
- XXbitFlip(bits)
- XXregister`6020BitCell`6020*bits;
- XX`607B
- XX`6009register`6020int`6009num,`6020top,`6020bot,`6020i,`6020j;
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`60204;`6020i++)`6020`607B
- XX`6009`6009for`6020(j`6020=`60200;`6020j`6020<`602016;`6020j++)`6020`607B
- XX`6009`6009`6009num`6020=`6020bits->bits`605Bj`605D`6020`6026`60200xffff;
- XX`6009`6009`6009top`6020=`6020num`6020`6026`60200xff00;
- XX`6009`6009`6009bot`6020=`6020num`6020`6026`60200x00ff;
- XX`6009`6009`6009top`6020>>=`60208;
- XX`6009`6009`6009bot`6020<<=`60208;
- XX`6009`6009`6009num`6020=`6020top`607Cbot;
- XX
- XX`6009`6009`6009top`6020=`6020num`6020`6026`60200xf0f0;
- XX`6009`6009`6009bot`6020=`6020num`6020`6026`60200x0f0f;
- XX`6009`6009`6009top`6020>>=`60204;
- XX`6009`6009`6009bot`6020<<=`60204;
- XX`6009`6009`6009num`6020=`6020top`607Cbot;
- XX
- XX`6009`6009`6009top`6020=`6020num`6020`6026`60200xcccc;
- XX`6009`6009`6009bot`6020=`6020num`6020`6026`60200x3333;
- XX`6009`6009`6009top`6020>>=`60202;
- XX`6009`6009`6009bot`6020<<=`60202;
- XX`6009`6009`6009num`6020=`6020top`607Cbot;
- XX
- XX`6009`6009`6009top`6020=`6020num`6020`6026`60200xaaaa;
- XX`6009`6009`6009bot`6020=`6020num`6020`6026`60200x5555;
- XX`6009`6009`6009top`6020>>=`60201;
- XX`6009`6009`6009bot`6020<<=`60201;
- XX`6009`6009`6009bits->bits`605Bj`605D`6020=`6020top`607Cbot;
- XX`6009`6009`607D
- XX`6009`6009bits++;
- XX`6009`607D
- XX`607D
- XX
- XX
- XX/*
- XX`6020*`6020Then`6020there`6020are`6020the`6020systems`6020that`6020are`6020pe
- Vrfectly`6020happy`6020w
- XVith`6020MSBFirst`6020data,`6020but
- XX`6020*`6020byte`6020swap`6020the`6020shorts`6020that`6020are`6020used.`6020
- V`6020We`6020fix`6020that
- XV`6020here.
- XX`6020*
- XX`6020*`6020The`6020htons()`6020routine`6020is`6020a`6020defined`6020to`6020be
- V`6020a`6020no-op`6020on
- XV`6020machines`6020that`6020don't`6020have
- XX`6020*`6020this`6020problem.
- XX`6020*
- XX`6020*/
- XX
- XXSwapBitmaps()
- XX`607B
- XX`6009register`6020i;
- XX
- XX`6009byteSwap(normalArrows);
- XX`6009byteSwap(invincibleArrows);
- XX`6009byteSwap(otherArrows);
- XX`6009byteSwap(numbers);`6009/*`6020only`6020gets`6020first`60204`6020*/
- XX`6009byteSwap(`6026numbers`605B4`605D);`6009/*`6020get`6020the`6020rest`6020*
- V/
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020ratBits_width`6020*`6020ratBits_
- Vheight`6020/`602016;
- XV`6020i`6020+=`602064)
- XX`6009`6009byteSwap((BitCell`6020*)`6020`6026ratBits`605Bi`605D);
- XX`607D
- XX
- XX/*
- XX`6020*`6020Byte`6020swap`60204`602016x16`6020bitmaps.
- XX`6020*/
- XX
- XXbyteSwap(bits)
- XXregister`6020BitCell`6020*bits;
- XX`607B
- XX`6009register`6020int`6020i,`6020j;
- XX`6009
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`60204;`6020i++,`6020bits++)
- XX`6009`6009for`6020(j`6020=`60200;`6020j`6020<`602016;`6020j++)
- XX`6009`6009`6009bits->bits`605Bj`605D`6020=`6020htons(bits->bits`605Bj`605D
- V`6020`6026`60200xffff);
- XX`607D
- X$`20call`20unpack`20DISPLAY.C;1`201029848417`20""
- X$!
- X$`20create`20'f'
- XX/*`6020$Header:`6020init.c,v`60201.13`602088/09/07`602014:37:21`6020kent`6020
- VExp`6020$`6020*/
- XX
- XX/*`6020
- XX`6020*`6020init.c`6020-`6020Initialization`6020code`6020for`6020mazewar
- XX`6020*`6020
- XX`6020*`6020Author:`6009Christopher`6020A.`6020Kent
- XX`6020*`6020`6009`6009Western`6020Research`6020Laboratory
- XX`6020*`6009`6020`6009Digital`6020Equipment`6020Corporation
- XX`6020*`6020Date:`6009Thu`6020Oct`6020`60202`60201986
- XX`6020*/
- XX
- XX/***********************************************************
- XXCopyright`60201986`6020by`6020Digital`6020Equipment`6020Corporation,`6020Mayn
- Vard,`6020Massac
- XVhusetts,
- XX
- XX`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020
- V`6020`6020`6020`6020`6020`6020`6020`6020`6020All
- XV`6020Rights`6020Reserved
- XX
- XXPermission`6020to`6020use,`6020copy,`6020modify,`6020and`6020distribute`6020t
- Vhis`6020software
- XV`6020and`6020its`6020
- XXdocumentation`6020for`6020any`6020purpose`6020and`6020without`6020fee`6020is
- V`6020hereby`6020gran
- XVted,`6020
- XXprovided`6020that`6020the`6020above`6020copyright`6020notice`6020appear`6020i
- Vn`6020all`6020copie
- XVs`6020and`6020that
- XXboth`6020that`6020copyright`6020notice`6020and`6020this`6020permission`6020no
- Vtice`6020appear
- XV`6020in`6020
- XXsupporting`6020documentation,`6020and`6020that`6020the`6020names`6020of`6020D
- Vigital`6020not
- XV`6020be
- XXused`6020in`6020advertising`6020or`6020publicity`6020pertaining`6020to`6020di
- Vsstribution`6020o
- XVf`6020the
- XXsoftware`6020without`6020specific,`6020written`6020prior`6020permission.`6020
- V`6020
- XX
- XXDIGITAL`6020DISCLAIMS`6020ALL`6020WARRANTIES`6020WITH`6020REGARD`6020TO`6020T
- VHIS`6020SOFTWARE,
- XV`6020INCLUDING
- XXALL`6020IMPLIED`6020WARRANTIES`6020OF`6020MERCHANTABILITY`6020AND`6020FITNESS
- V,`6020IN`6020NO
- XV`6020EVENT`6020SHALL
- XXDIGITAL`6020BE`6020LIABLE`6020FOR`6020ANY`6020SPECIAL,`6020INDIRECT`6020OR
- V`6020CONSEQUENTIAL
- XV`6020DAMAGES`6020OR
- XXANY`6020DAMAGES`6020WHATSOEVER`6020RESULTING`6020FROM`6020LOSS`6020OF`6020USE
- V,`6020DATA`6020OR
- XV`6020PROFITS,
- XXWHETHER`6020IN`6020AN`6020ACTION`6020OF`6020CONTRACT,`6020NEGLIGENCE`6020OR
- V`6020OTHER`6020TORTIO
- XVUS`6020ACTION,
- XXARISING`6020OUT`6020OF`6020OR`6020IN`6020CONNECTION`6020WITH`6020THE`6020USE
- V`6020OR`6020PERFORMANC
- XVE`6020OF`6020THIS
- XXSOFTWARE.
- XX
- XX******************************************************************/
- XX
- XX/*
- XX`6020*`6020$Log:`6009init.c,v`6020$
- XX`6020*`6020Revision`60201.13`6020`602088/09/07`6020`602014:37:21`6020`6020ken
- Vt
- XX`6020*`6020Portability`6020changes`6020for`6020broadcasts.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.12`6020`602088/08/25`6020`602009:57:53`6020`6020ken
- Vt
- XX`6020*`6020Copyright`6020and`6020changed`6020to`6020allow`6020the`6020broadca
- Vst`6020address`6020to
- XV`6020be`6020set`6020in`6020Makefile.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.11`6020`602088/06/15`6020`602016:36:31`6020`6020ken
- Vt
- XX`6020*`6020Updated`6020to`6020use`6020proper`6020broadcast`6020address.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.10`6020`602087/07/28`6020`602013:51:16`6020`6020ken
- Vt
- XX`6020*`6020Fixed`6020a`6020problem`6020in`6020netInit();`6020didn't`6020handl
- Ve`6020the`6020case
- XV`6020when`6020gethostname()
- XX`6020*`6020returned`6020something`6020that`6020couldn't`6020be`6020found`6020
- Vin`6020the`6020host
- XV`6020table.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.9`6020`602087/03/31`6020`602014:42:14`6020`6020kent
- V
- XX`6020*`6020Portability`6020considerations,`6020especially`6020byteswapping
- V`6020to/from`6020t
- XVhe`6020net.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.8`6020`602086/12/04`6020`602017:48:05`6020`6020kent
- V
- XX`6020*`6020findDuke's`6020return`6020value`6020pointed`6020to`6020something
- V`6020on`6020the`6020sta
- XVck!
- XX`6020*`6020
- XX`6020*`6020Revision`60201.7`6020`602086/12/04`6020`602011:16:54`6020`6020kent
- V
- XX`6020*`6020Handle`6020name`6020case`6020when`6020there's`6020no`6020comma`602
- V0in`6020the`6020gecos
- XV`6020field.
- XX`6020*`6020
- X+-+-+-+-+-+-+-+-`20`20END`20`20OF`20PART`202`20+-+-+-+-+-+-+-+-
- $ call unpack [.MAZEWAR]MAZEWAR.2;1 1820318911 ""
- $!
- $ create 'f'
- X-+-+-+-+-+-+-+-+`20START`20OF`20PART`203`20-+-+-+-+-+-+-+-+
- XX`6020*`6020Revision`60201.6`6020`602086/12/04`6020`602011:14:23`6020`6020kent
- V
- XX`6020*`6020Clean`6020up`6020join,`6020so`6020you`6020can`6020specify`6020any
- V`6020host`6020in`6020a`6020g
- XVame,`6020not`6020just`6020the`6020duke.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.5`6020`602086/12/03`6020`602013:31:25`6020`6020kent
- V
- XX`6020*`6020
- XX`6020*`6020
- XX`6020*`6020Revision`60201.4`6020`602086/12/03`6020`602010:00:45`6020`6020kent
- V
- XX`6020*`6020Changes`6020to`6020allow`6020multiple`6020players`6020per`6020mach
- Vine.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.3`6020`602086/12/01`6020`602023:44:25`6020`6020kent
- V
- XX`6020*`6020Housecleaning`6020and`6020documentation`6020pass.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.2`6020`602086/12/01`6020`602014:48:17`6020`6020kent
- V
- XX`6020*`6020Changes`6020for`6020a`6020realistic`6020implementation`6020of`6020
- Vshooting.
- XX`6020*`6020
- XX`6020*`6020Revision`60201.1`6020`602086/11/26`6020`602016:57:42`6020`6020kent
- V
- XX`6020*`6020Initial`6020revision
- XX`6020*`6020
- XX`6020*/
- XX
- XX#ifndef`6009lint
- XXstatic`6020char`6020rcs_ident`605B`605D`6020=`6020"$Header:`6020init.c,v`6020
- V1.13`602088/09/07
- XV`602014:37:21`6020kent`6020Exp`6020$";
- XX#endif
- XX
- XX#include`6020<sys/types.h>
- XX#include`6020<sys/socket.h>
- XX#include`6020<sys/time.h>
- XX
- XX#include`6020<netinet/in.h>
- XX
- XX#include`6020<errno.h>
- XX#include`6020<netdb.h>
- XX#include`6020<stdio.h>
- XX#ifdef`6020VMS
- XX#else
- XX#include`6020<pwd.h>
- XX#include`6020<string.h>
- XX#endif
- XX
- XX#include`6020"mazewar.h"
- XX
- XXint`6009RV`605BVECTORSIZE`605D`6020=`6020`607B
- XX`60090031575,`60200055455,`60200147160,`60200176745,`60200173126,`60200117426
- V,`60200033612,
- XV`60200136020,
- XX`60090054013,`60200167672,`60200070252,`60200033100,`60200015700,`60200113523
- V,`60200170465,
- XV`60200024344,
- XX`60090175535,`60200137325,`60200126211,`60200010207,`60200173547,`60200016071
- V,`60200056622,
- XV`60200014433,
- XX`60090113225,`60200047553,`60200103024,`60200110174,`60200000124,`60200173304
- V,`60200076700,
- XV`60200104042,
- XX`60090135030,`60200126234,`60200175154,`60200140123,`60200167542,`60200000405
- V,`60200035464,
- XV`60200166537,
- XX`60090050260,`60200167655,`60200123715,`60200176164,`60200172206,`60200140365
- V,`60200074606,
- XV`60200075656,
- XX`60090176163,`60200030017,`60200022102,`60200040051,`60200154620,`60200017144
- V,`60200073372
- XX`607D;
- XX
- XXstatic`6020MazeType`6020mazeBits`6020=`6020`607B
- XX`6009`607B`60201,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1`607D,`6009/*`60200`6020*/
- XX`6009`607B`60201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1`607D,
- XX`6009`607B`60201,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1`607D,
- XX`6009`607B`60201,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1`607D,
- XX
- XX`6009`607B`60201,0,1,0,1,0,0,0,1,0,1,1,1,1,0,1`607D,`6009/*`60201`6020*/
- XX`6009`607B`60201,0,1,1,1,0,1,0,1,0,1,0,0,0,0,1`607D,
- XX`6009`607B`60201,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1`607D,
- XX`6009`607B`60201,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1`607D,
- XX
- XX`6009`607B`60201,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1`607D,`6009/*`60202`6020*/
- XX`6009`607B`60201,0,1,1,1,1,1,0,1,0,1,0,0,0,0,1`607D,
- XX`6009`607B`60201,0,0,0,0,0,1,0,0,0,1,0,1,1,1,1`607D,
- XX`6009`607B`60201,0,1,1,1,0,1,0,1,0,1,0,0,0,0,1`607D,
- XX
- XX`6009`607B`60201,0,0,0,0,0,1,0,1,0,1,1,1,1,0,1`607D,`6009/*`60203`6020*/
- XX`6009`607B`60201,0,1,1,1,1,1,0,1,0,1,1,0,1,0,1`607D,
- XX`6009`607B`60201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1`607D,
- XX`6009`607B`60201,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1`607D,
- XX
- XX`6009`607B`60201,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1`607D,`6009/*`60204`6020*/
- XX`6009`607B`60201,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1`607D,
- XX`6009`607B`60201,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1`607D,
- XX`6009`607B`60201,0,1,1,1,0,1,0,1,0,1,1,0,0,0,1`607D,
- XX
- XX`6009`607B`60201,0,0,0,0,0,0,0,1,0,1,0,0,1,0,1`607D,`6009/*`60205`6020*/
- XX`6009`607B`60201,0,1,1,1,1,1,1,1,0,1,0,1,1,0,1`607D,
- XX`6009`607B`60201,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1`607D,
- XX`6009`607B`60201,0,1,0,1,0,1,0,1,0,1,1,0,0,0,1`607D,
- XX
- XX`6009`607B`60201,0,1,0,1,0,1,0,1,0,0,0,0,1,0,1`607D,`6009/*`60206`6020*/
- XX`6009`607B`60201,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1`607D,
- XX`6009`607B`60201,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1`607D,
- XX`6009`607B`60201,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1`607D,
- XX
- XX`6009`607B`60201,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1`607D,`6009/*`60207`6020*/
- XX`6009`607B`60201,0,1,0,1,0,1,0,1,0,1,1,1,1,0,1`607D,
- XX`6009`607B`60201,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1`607D,
- XX`6009`607B`60201,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1`607D
- XX`607D;
- XX
- XXstatic`6020char`6009*ratName`6020=`6020NULL;
- XXstatic`6020char`6009*dukeName`6020=`6020NULL;
- XXstatic`6020Sockaddr`6009dukeAddr;
- XX
- XXSockaddr`6009*resolveHost();
- XX
- XXextern`6020int`6009errno;
- XX
- XXMazeInit(argc,`6020argv)
- XXchar`6009**argv;
- XX`607B
- XX`6009register`6020RatId`6009ratId;
- XX
- XX`6009for`6020(ratId`6020=`60200;`6020ratId`6020<`6020MAXRATS;`6020ratId++)
- V`6020`607B
- XX`6009`6009bzero((char`6020*)`6020M.ratcb.rats`605BratId`605D.name,`6020NAMESI
- VZE);
- XX`6009`6009M.ratcb.rats`605BratId`605D.playing`6020=`6020FALSE;
- XX`6009`6009R2d2`605BratId`605D.visible`6020=`6020FALSE;
- XX`6009`607D
- XX`6009M.invincible`6020=`6020FALSE;
- XX`6009M.omniscient`6020=`6020FALSE;
- XX`6009RatKillQ`6020=`6020(RatKillQ_t)`6020NULL;
- XX
- XX`6009getMaze();
- XX
- XX`6009setRandom();
- XX`6009InitRandom();
- XX
- XX`6009InitDisplay(argc,`6020argv);
- XX`6009getNames();
- XX`6009NewPosition();
- XX
- XX`6009/*
- XX`6009`6020*`6020We`6020don't`6020do`6020ShowPosition()`6020or`6020ShowView()
- V`6020here,`6020but`6020l
- XVet`6020the`6020update
- XX`6009`6020*`6020routine`6020in`6020the`6020window`6020handler`6020do`6020it
- V`6020for`6020the`6020first
- XV`6020time`6020when
- XX`6009`6020*`6020the`6020window`6020is`6020exposed.
- XX`6009`6020*/
- XX
- XX`6009netInit();
- XX`6009StartDisplay();
- XX`6009RatCursor();
- XX`607D
- XX
- XX/*`6020get`6020the`6020maze`6020into`6020memory`6020*/
- XXgetMaze()
- XX`607B
- XX`6009int`6020i,`6020j;
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020MAZEXMAX;`6020i++)
- XX`6009`6009for`6020(j`6020=`60200;`6020j`6020<`6020MAZEYMAX;`6020j++)
- XX`6009`6009`6009if`6020(mazeBits`605Bi`605D.y`605BMAZEYMAX-1`6020-`6020j`605D
- V`6020==`60201)
- XX`6009`6009`6009`6009M.maze`605Bi`605D.y`605Bj`605D`6020=`6020TRUE;
- XX`6009`6009`6009else
- XX`6009`6009`6009`6009M.maze`605Bi`605D.y`605Bj`605D`6020=`6020FALSE;
- XX`607D
- XX
- XX/*`6020initialize`6020the`6020random`6020vector`6020*/
- XXsetRandom()
- XX`607B
- XX`6009register`6009i;
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020VECTORSIZE;`6020i++)
- XX`6009`6009M.randomVector`605Bi`605D`6020=`6020RV`605Bi`605D;
- XX`607D
- XX
- XX/*`6020get`6020player`6020and`6020duke`6020host`6020names`6020*/
- XXgetNames()
- XX`607B
- XX`6009char`6009`6009buf`605B128`605D,`6020*cp;
- XX`6009char`6009`6009*comma;
- XX`6009Sockaddr`6009*duke;
- XX`6009char`6009`6009*getenv();
- XX`6009struct`6020passwd`6009*getpwuid();
- XX
- XX`6009buf`605B0`605D`6020=`6020'`605C0';
- XX`6009printf("Welcome`6020to`6020Alto`6020MazeWar!`605Cn`605Cn");
- XX`6009printf("Your`6020Name:`6020");
- XX`6009gets(buf);
- XX`6009if`6020(buf`605B0`605D`6020==`6020'`605C0')`6020`607B
- XX`6009`6009if`6020((cp`6020=`6020getenv("USERNAME"))`6020!=`6020NULL)
- XX`6009`6009`6009strcpy(buf,`6020cp);
- XX`6009`6009else`6020if`6020((cp`6020=`6020getenv("USER"))`6020!=`6020NULL)
- XX`6009`6009`6009strcpy(buf,`6020cp);
- XX`6009`6009else`6020`607B
- XX#ifdef`6020VMS
- XX`6009`6009`6020`6020`6020`6020`6020`6020`6020`6020strcpy`6020(buf,`6020"Whozi
- Vt?");
- XX#else
- XX`6009`6009`6009strcpy(buf,`6020(getpwuid(getuid()))->pw_gecos);
- XX`6009`6009`6009comma`6020=`6020index(buf,`6020',');
- XX`6009`6009`6009if`6020(comma`6020!=`6020NULL)
- XX`6009`6009`6009`6009*comma`6020=`6020'`605C0';
- XX#endif
- XX`6009`6009`607D
- XX`6009`607D
- XX`6009ratName`6020=`6020malloc((unsigned)`6020(strlen(buf)`6020+`60201));
- XX`6009if`6020(ratName`6020==`6020NULL)
- XX`6009`6009MWError("no`6020mem`6020for`6020ratName");
- XX`6009strcpy(ratName,`6020buf);
- XX`6009for`6020(duke`6020=`6020NULL;`6020duke`6020==`6020NULL;`6020)`6020`607B
- XX#ifndef`6009NO_BROADCAST
- XX`6009`6009printf("Duke`6020Host`6020(CR`6020for`6020any`6020game):`6020");
- XX#else
- XX`6009`6009printf("Duke`6020Host:`6020");
- XX#endif`6009NO_BROADCAST
- XX`6009`6009gets(buf);
- XX`6009`6009if`6020(strlen(buf)`6020==`60200)
- XX`6009`6009`6009break;
- XX`6009`6009dukeName`6020=`6020malloc((unsigned)`6020(strlen(buf)`6020+`60201))
- V;
- XX`6009`6009if`6020(dukeName`6020==`6020NULL)
- XX`6009`6009`6009MWError("no`6020mem`6020for`6020dukeName");
- XX`6009`6009strcpy(dukeName,`6020buf);
- XX
- XX`6009`6009/*`6020check`6020for`6020valid`6020duke`6020name`6020*/
- XX`6009`6009duke`6020=`6020resolveHost(dukeName);
- XX`6009`6009if`6020(duke`6020==`6020(Sockaddr`6020*)`6020NULL)`6020`607B
- XX`6009`6009`6009printf("Don't`6020know`6020host`6020%s`605Cn",`6020dukeName);
- XX`6009`6009`6009free(dukeName);
- XX`6009`6009`6009dukeName`6020=`6020NULL;
- XX`6009`6009`607D
- XX`6009`607D
- XX`6009if`6020((dukeName`6020!=`6020NULL)`6020`6026`6026
- XX`6009`6020`6020`6020`6020(strlen(dukeName)`6020!=`60200))
- XX`6009`6009bcopy((char`6020*)`6020duke,`6020(char`6020*)`6020`6026dukeAddr,
- V`6020sizeof(Sockaddr))
- XV;
- XX`607D
- XX
- XXnetInit()
- XX`607B
- XX`6009register`6020RatId`6009ratId;
- XX`6009Boolean`6009`6009joinGame();
- XX`6009struct`6020servent`6009*mazeService;
- XX`6009u_short`6009`6009port;
- XX`6009Sockaddr`6009nullAddr;
- XX`6009Sockaddr`6009*thisHost;
- XX`6009char`6009`6009buf`605B128`605D;
- XX
- XX`6009mazeService`6020=`6020getservbyname(MAZESERVICE,`6020"udp");
- XX`6009if`6020(mazeService`6020!=`6020(struct`6020servent`6020*)`6020NULL)
- XX`6009`6009M.mazePort`6020=`6020mazeService->s_port;
- XX`6009else
- XX`6009`6009M.mazePort`6020=`6020htons(MAZEPORT);
- XX
- XX`6009gethostname(buf,`6020sizeof(buf));
- XX`6009if`6020((thisHost`6020=`6020resolveHost(buf))`6020==`6020(Sockaddr`6020*
- V)`6020NULL)
- XX`6009`6009MWError("who`6020am`6020I?");
- XX`6009bcopy((caddr_t)`6020thisHost,`6020(caddr_t)`6020`6026M.myAddr,`6020sizeo
- Vf(Sockaddr));
- XV
- XX`6009nullAddr`6020=`6020M.myAddr;
- XX`6009bzero((char`6020*)`6026nullAddr.sin_addr,`6020sizeof(nullAddr.sin_addr))
- V;
- XX
- XX`6009/*`6020
- XX`6009`6020*`6020Figure`6020out`6020which`6020port`6020I`6020can`6020use.`6020
- VStart`6020at`6020MAZEPORT
- XV`6020and`6020go
- XX`6009`6020*`6020up`6020till`6020there's`6020a`6020free`6020one.`6020We`6020us
- Ve`6020nullAddr`6020so`6020t
- XVhat`6020we
- XX`6009`6020*`6020can`6020receive`6020any`6020incoming`6020packet,`6020in`6020c
- Vase`6020there's`6020som
- XVe
- XX`6009`6020*`6020multi-homed`6020nonsense.`6020However,`6020not`6020binding
- V`6020may`6020cause`6020t
- XVroubles
- XX`6009`6020*`6020if`6020a`6020specified`6020duke`6020is`6020on`6020a`6020net
- V`6020that`6020causes`6020the
- XV`6020source`6020of`6020the
- XX`6009`6020*`6020packets`6020to`6020be`6020something`6020other`6020than`6020wh
- Vat`6020M.myAddr`6020is.
- XV..
- XX`6009`6020*`6020There`6020also`6020seems`6020to`6020be`6020a`6020problem`6020
- Vwith`6020broadcasts`6020n
- XVot`6020being
- XX`6009`6020*`6020accepted`6020on`6020sockets`6020that`6020have`6020an`6020addr
- Vess`6020bound`6020to
- XV`6020them.
- XX`6009`6020*/
- XX
- XX`6009M.theSocket`6020=`6020socket(AF_INET,`6020SOCK_DGRAM,`60200);
- XX`6009if`6020(M.theSocket`6020<`60200)
- XX`6009`6009MWError("can't`6020get`6020socket");
- XX
- XX`6009for`6020(port`6020=`6020ntohs(M.mazePort);`6020;`6020port++)`6020`607B
- XX`6009`6009nullAddr.sin_port`6020=`6020htons(port);
- XX`6009`6009if`6020(bind(M.theSocket,`6020`6026nullAddr,`6020sizeof(nullAddr))
- V`6020<`60200)
- XX#ifdef`6020VMS
- XX`6009`6009`6009if`6020(socket_errno`6020!=`6020EADDRINUSE)
- XX#else
- XX`6009`6009`6009if`6020(errno`6020!=`6020EADDRINUSE)
- XX#endif
- XX`6009`6009`6009`6009MWError("netInit`6020binding");
- XX`6009`6009`6009else
- XX`6009`6009`6009`6009continue;
- XX`6009`6009else
- XX`6009`6009`6009break;
- XX`6009`607D
- XX`6009M.myAddr.sin_port`6020=`6020nullAddr.sin_port;
- XX
- XX`6009/*
- XX`6009`6020*`6020Now`6020we`6020can`6020try`6020to`6020find`6020a`6020game`602
- V0to`6020join;`6020if`6020none
- XV,`6020start`6020one.
- XX`6009`6020*/
- XX
- XX`6009if`6020(!joinGame())
- XX`6009`6009startGame();
- XX`6009printf("`605Cn");
- XX
- XX`6009for`6020(ratId`6020=`60200;`6020ratId`6020<`6020MAXRATS;`6020ratId++)
- XX`6009`6009TokenVisible(ratId);`6009/*`6020oh`6020oh`6020say`6020can`6020we
- V`6020see?`6020*/
- XX
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Find`6020a`6020game.`6020If`6020the`6020user`6020specified`6020a
- V`6020"duke"`6020host,`6020c
- XVontact`6020that
- XX`6020*`6020duke.`6020Otherwise`6020broadcast`6020to`6020find`6020a`6020duke.
- V`6020Finally`6020join
- XV`6020that`6020game.
- XX`6020*/
- XX
- XXBoolean
- XXjoinGame()
- XX`607B
- XX`6009Sockaddr`6009*duke,`6020*findDuke();
- XX`6009Boolean`6009`6009join();
- XX
- XX`6009if`6020((dukeName`6020==`6020NULL)`6020`607C`607C
- XX`6009`6020`6020`6020`6020(strlen(dukeName)`6020==`60200))`6020`607B
- XX`6009`6009duke`6020=`6020findDuke();
- XX`6009`6009if`6020(duke`6020!=`6020NULL)
- XX`6009`6009`6009bcopy((char`6020*)`6020duke,`6020(char`6020*)`6020`6026dukeAdd
- Vr,
- XX`6009`6009`6009`6009sizeof(Sockaddr));
- XX`6009`6009else
- XX`6009`6009`6009return`6020FALSE;
- XX`6009`607D`6020else
- XX`6009`6009dukeAddr.sin_port`6020=`6020M.mazePort;
- XX`6009return`6020join(dukeAddr);
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020No`6020game`6020to`6020join;`6020set`6020ourselves`6020up`6020as
- V`6020duke`6020and`6020wait
- XV`6020for`6020others`6020to`6020join.
- XX`6020*/
- XX
- XXstartGame()
- XX`607B
- XX`6009RatId`6009i;
- XX`6009RatInfo`6009`6009rsp;
- XX
- XX`6009printf("starting`6020a`6020new`6020game");
- XX`6009M.myRatId`6020=`60200;
- XX`6009M.score`6020=`60200;
- XX`6009SetMyRatId(0);
- XX`6009M.ratcb.dukeRat`6020=`6020M.myRatId;
- XX`6009M.ratcb.rats`605BM.myRatId`605D.addr`6020=`6020M.myAddr;
- XX`6009rsp`6020=`6020`6026M.ratcb.rats`605BM.myRatId`605D;
- XX`6009rsp->playing`6020=`6020TRUE;
- XX`6009rsp->xLoc`6020=`6020M.xloc;
- XX`6009rsp->yLoc`6020=`6020M.yloc;
- XX`6009rsp->dir`6020=`6020M.dir;
- XX`6009rsp->score`6020=`6020M.score;
- XX`6009rsp->addr`6020=`6020M.myAddr;
- XX`6009strncpy(rsp->name,`6020ratName,`6020NAMESIZE);
- XX`6009for`6020(i`6020=`60201;`6020i`6020<`6020MAXRATS;`6020i++)
- XX`6009`6009M.ratcb.rats`605Bi`605D.playing`6020=`6020FALSE;
- XX`6009M.duke`6020=`6020TRUE;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Join`6020an`6020existing`6020game.`6020Send`6020a`6020RAT_NEW`6020
- Vpacket`6020and`6020wait
- XV`6020for`6020a
- XX`6020*`6020RAT_STATUS`6020packet`6020to`6020come`6020back`6020with`6020the
- V`6020other`6020players.
- XV`6020
- XX`6020*/
- XX
- XXBoolean
- XXjoin(addr)
- XXSockaddr`6020addr;
- XX`607B
- XX`6009RatPacket`6009b,`6020r;
- XX`6009RatNew`6009`6009ratNew;
- XX`6009RatId`6009`6009id;
- XX`6009RatStatus`6009status;
- XX`6009int`6009`6009i,`6020ret;
- XX`6009fd_set`6009`6009fds;
- XX`6009struct`6020timeval`6009timeout;
- XX`6009Boolean`6009`6009retVal`6020=`6020FALSE;
- XX`6009
- XX`6009b.type`6020=`6020RAT_NEW;
- XX`6009ratNew`6020=`6020(RatNew)`6020`6026b.body;
- XX`6009ratNew->pass`6020=`6020RAT_PASSWORD;
- XX`6009ratNew->xLoc`6020=`6020M.xloc;
- XX`6009ratNew->yLoc`6020=`6020M.yloc;
- XX`6009ratNew->dir`6020=`6020M.dir;
- XX`6009ratNew->addr`6020=`6020M.myAddr;
- XX`6009strncpy(ratNew->name,`6020ratName,`6020NAMESIZE);
- XX`6009free(ratName);
- XX`6009ConvertOutgoing(`6026b);
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`60205;`6020i++)`6020`607B
- XX`6009`6009int`6020fromlen;
- XX`6009`6009struct`6020sockaddr`6020from;
- XX
- XX`6009`6009if`6020(sendto(M.theSocket,`6020(char`6020*)`6020`6026b,`6020sizeof
- V(b),`60200,`6020`6026ad
- XVdr,
- XX`6009`6009`6009`6020`6020`6020sizeof(addr))`6020<`60200)
- XX`6009`6009`6009MWError("join`6020sendto");
- XX`6009`6009FD_ZERO`6020(`6026fds);
- XX`6009`6009FD_SET`6020(M.theSocket,`6020`6026fds);
- XX`6009`6009timeout.tv_sec`6020=`60205;
- XX`6009`6009timeout.tv_usec`6020=`60200;
- XX`6009`6009ret`6020=`6020select(FD_SETSIZE,`6020`6026fds,`6020NULL,`6020NULL,
- V`6020`6026timeout);
- XX`6009`6009if`6020(ret`6020<`60200)
- XX`6009`6009`6009MWError("join`6020select");
- XX`6009`6009if`6020(ret`6020==`60200)
- XX`6009`6009`6009continue;
- XX`6009`6009if`6020(recvfrom(M.theSocket,`6020(char`6020*)`6020`6026r,`6020size
- Vof(r),
- XX`6009`6009`6009`60090,`6020`6026from,`6020`6026fromlen)`6020<`60200)
- XX`6009`6009`6009MWError("join`6020status`6020receive");
- XX`6009`6009ConvertIncoming(`6026r);
- XX`6009`6009if`6020(r.type`6020!=`6020RAT_STATUS)
- XX`6009`6009`6009continue;
- XX
- XX`6009`6009/*`6020see`6020if`6020I`6020got`6020into`6020the`6020game`6020*/
- XX`6009`6009status`6020=`6020`6026r.body;
- XX`6009`6009for`6020(id`6020=`60200;`6020id`6020<`6020MAXRATS;`6020id++)
- XX`6009`6009`6009if`6020(status->rats`605Bid`605D.playing`6020`6026`6026
- XX`6009`6009`6009`6020`6020`6020`6020!bcmp(`6026status->rats`605Bid`605D.addr,
- V`6020`6026M.myAddr,
- XX`6009`6009`6009`6009`6020`6020sizeof(M.myAddr)))`6020`607B
- XX`6009`6009`6009`6009M.myRatId`6020=`6020id;
- XX`6009`6009`6009`6009break;
- XX`6009`6009`6009`607D
- XX
- XX`6009`6009/*`6020
- XX`6009`6009`6020*`6020Didn't`6020find`6020me;`6020this`6020guy`6020must`6020no
- Vt`6020really`6020be`6020the
- XV
- XX`6009`6009`6020*`6020duke.`6020Contact`6020the`6020duke`6020of`6020the`6020ga
- Vme`6020and`6020get`6020adde
- XVd.
- XX`6009`6009`6020*/
- XX
- XX`6009`6009if`6020(id`6020==`6020MAXRATS)`6020`607B
- XX`6009`6009`6009addr`6020=`6020status->rats`605Bstatus->dukeRat`605D.addr;
- XX`6009`6009`6009continue;
- XX`6009`6009`607D
- XX`6009`6009
- XX`6009`6009bcopy((char`6020*)`6020status,`6020(char`6020*)`6020`6026M.ratcb,
- V`6020sizeof(RatCb));
- XX`6009`6009retVal`6020=`6020TRUE;
- XX`6009`6009break;
- XX`6009`607D
- XX`6009return`6020retVal;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Find`6020a`6020"duke"`6020host.`6020Broadcast`6020a`6020RAT_SURVEY
- V`6020packet`6020to
- XV`6020MAZEPORT.
- XX`6020*
- XX`6020*`6020The`6020broadcast`6020is`6020done`6020just`6020on`6020the`6020netw
- Vork`6020that`6020is`6020a
- XVssociated
- XX`6020*`6020with`6020the`6020name`6020returned`6020by`6020gethostname();`6020f
- Vor`6020most`6020works
- XVtations
- XX`6020*`6020this`6020is`6020accurate,`6020but`6020multi-homed`6020hosts`6020ma
- Vy`6020miss`6020some
- XV`6020games.`6020Oh
- XX`6020*`6020well.
- XX`6020*
- XX`6020*`6020After`6020the`6020broadcast,`6020collect`6020responses.`6020This
- V`6020goes`6020on`6020un
- XVtil`6020no`6020packets
- XX`6020*`6020have`6020been`6020received`6020for`60205`6020seconds`6020or`6020th
- Ve`6020max`6020number
- XV`6020have`6020been`6020seen
- XX`6020*
- XX`6020*`6020All`6020players`6020are`6020supposed`6020to`6020respond.`6020If
- V`6020a`6020packet`6020come
- XVs`6020from`6020a`6020non-duke,
- XX`6020*`6020the`6020information`6020is`6020inspected`6020to`6020send`6020a`602
- V0RAT_SURVEY`6020direc
- XVtly`6020to`6020him.
- XX`6020*`6020Otherwise,`6020the`6020answer`6020is`6020saved.`6020When`6020all
- V`6020the`6020answers
- XV`6020are`6020in,`6020the
- XX`6020*`6020first`6020game`6020with`6020an`6020empty`6020slot`6020is`6020chose
- Vn.
- XX`6020*
- XX`6020*`6020If`6020all`6020players`6020were`6020listening`6020on`6020MAZEPORT,
- V`6020we`6020could`6020p
- XVrobably`6020do
- XX`6020*`6020without`6020the`6020resending`6020nonsense.`6020Since`6020the`6020
- Vduke`6020might`6020no
- XVt`6020be`6020on
- XX`6020*`6020MAZEPORT,`6020this`6020is`6020necessary.`6020It`6020also`6020adds
- V`6020a`6020certain`6020r
- XVobustness,`6020in
- XX`6020*`6020case`6020the`6020duke`6020drops`6020the`6020packet`6020or`6020some
- Vsuch.`6020Care`6020is
- XV`6020taken`6020elsewhere
- XX`6020*`6020(ratLeft()`6020and`6020ratDoctor())to`6020make`6020sure`6020there
- V`6020are`6020always
- XV`6020players
- XX`6020*`6020listening`6020on`6020MAZEPORT.
- XX`6020*/
- XX
- XXstruct`6020answer`6020`607B
- XX`6009Sockaddr`6009source;
- XX`6009int`6009`6009srclen;
- XX`6009RatPacket`6009packet;
- XX`607D;
- XX
- XXSockaddr`6020*
- XXfindDuke()
- XX`607B
- XX#ifndef`6009NO_BROADCAST
- XX`6009register`6020int`6009i;
- XX`6009int`6009`6009cnt`6020=`60200;
- XX`6009int`6009`6009maxAnswers`6020=`602010;
- XX`6009static`6020Sockaddr`6009rmtAddr;
- XX`6009struct`6009timeval`6009timeout;
- XX`6009RatPacket`6009*b`6020=`6020(RatPacket`6020*)`6020malloc(sizeof(RatPacket
- V));
- XX`6009struct`6020answer`6009*answers;
- XX`6009int`6009`6009fd`6020=`6020M.theSocket;
- XX`6009fd_set`6020`6020`6020`6020`6020`6020`6020`6020`6020`6020fds;
- XX`6009int`6009`6009ret,`6020cc;
- XX`6009Boolean`6009`6009duke(),`6020freeSlot();
- XX`6009u_long`6009`6009inet_makeaddr();
- XX
- XX`6009printf("Checking`6020out`6020available`6020games...");`6020fflush(stdout
- V);
- XX
- XX#ifdef`6009SO_BROADCAST
- XX#ifdef`6009BSD_43
- XX`6009`607B
- XX`6009int`6009one`6020=`60201;
- XX
- XX`6009if`6020(setsockopt(M.theSocket,`6020SOL_SOCKET,`6020SO_BROADCAST,`6020
- XX`6009`6009`6009`6009`6026one,`6020sizeof`6020one)`6020<`60200)
- XX`6009`6009MWError("can't`6020get`6020broadcast`6020permission");
- XX`6009`607D
- XX#else`6009BSD_43
- XX`6009if`6020(setsockopt(M.theSocket,`6020SOL_SOCKET,`6020SO_BROADCAST,`6020NU
- VLL,`60200)
- XV`6020<`60200)
- XX`6009`6009MWError("can't`6020get`6020broadcast`6020permission");
- XX#endif`6009BSD_43
- XX#endif`6009SO_BROADCAST
- XX
- XX`6009rmtAddr`6020=`6020M.myAddr;
- XX`6009rmtAddr.sin_addr.s_addr`6020=`6020inet_makeaddr(inet_netof(M.myAddr.sin_
- Vaddr),
- XX`6009`6009`6009`6009`6009BROAD_ADDR);`6009/*`6020from`6020Makefile`6020*/
- XX`6009rmtAddr.sin_port`6020=`6020M.mazePort;
- XX
- XX`6009answers`6020=`6020(struct`6020answer`6020*)
- XX`6009`6009malloc((unsigned)`6020(maxAnswers`6020*`6020sizeof(*answers)));
- XX
- XX`6009setupSurvey(b);
- XX`6009ConvertOutgoing(b);
- XX`6009if`6020(sendto(fd,`6020(char`6020*)`6020b,`6020sizeof(*b),`60200,`6020
- V`6026rmtAddr,`6020sizeo
- XVf(rmtAddr))`6020<`60200)
- XX`6009`6009fprintf(stderr,`6020"findDuke`6020survey`6020can't`6020broadcast
- V`605Cn");
- XX
- XX`6009while`6020(1)`6020`607B
- XX`6020`6020`6009`6020`6020`6020`6020`6020`6020`6020`6020FD_ZERO`6020(`6026fds)
- V;
- XX`6009`6009FD_SET`6020(fd,`6020`6026fds);
- XX`6009`6009timeout.tv_sec`6020=`60205;
- XX`6009`6009timeout.tv_usec`6020=`60200;
- XX`6009`6009ret`6020=`6020select(FD_SETSIZE,`6020`6026fds,`6020NULL,`6020NULL,
- V`6020`6026timeout);
- XX`6009`6009if`6020(ret`6020<`60200)
- XX`6009`6009`6009MWError("findDuke`6020select");
- XX`6009`6009if`6020(ret`6020==`60200)
- XX`6009`6009`6009break;
- XX`6009`6009answers`605Bcnt`605D.srclen`6020=`6020sizeof(Sockaddr);
- XX`6009`6009if`6020(recvfrom(fd,`6020`6026answers`605Bcnt`605D.packet,`6020size
- Vof(RatPacket),
- XV`60200,
- XX`6009`6009`6009`6020`6020`6020`6020`6020`6026answers`605Bcnt`605D.source,`602
- V0`6026answers`605Bcnt`605D.srcl
- XVen)`6020<`60200)
- XX`6009`6009`6009MWError("findDuke`6020recv");
- XX`6009`6009ConvertIncoming(`6026answers`605Bcnt`605D.packet);
- XX`6009`6009if`6020(answers`605Bcnt`605D.packet.type`6020!=`6020RAT_STATUS)
- XX`6009`6009`6009continue;
- XX`6009`6009if`6020(!duke(`6026answers`605Bcnt`605D))`6020`607B
- XX`6009`6009`6009RatStatus`6009rs;
- XX
- XX`6009`6009`6009rs`6020=`6020(RatStatus)`6020`6026answers`605Bcnt`605D.packet.
- Vbody;
- XX`6009`6009`6009setupSurvey(b);
- XX`6009`6009`6009ConvertOutgoing(b);
- XX`6009`6009`6009if`6020(sendto(fd,`6020b,`6020sizeof(*b),`60200,
- XX`6009`6009`6009`6009`6020`6020`6020`6026rs->rats`605Brs->dukeRat`605D.addr,
- XX`6009`6009`6009`6009`6020`6020`6020sizeof(rs->rats`605Brs->dukeRat`605D.addr)
- V)`6020<`60200)
- XX`6009`6009`6009`6009fprintf(stderr,`6020
- XX`6009`6009`6009`6009`6009"findDuke`6020resend`6020can't`6020broadcast");
- XX`6009`6009`6009continue;
- XX`6009`6009`607D
- XX`6009`6009if`6020(freeSlot(`6026answers`605Bcnt`605D))
- XX`6009`6009`6009if`6020(++cnt`6020==`6020maxAnswers)
- XX`6009`6009`6009`6009break;
- XX`6009`607D
- XX
- XX`6009for`6020(i`6020=`60200;`6020i`6020<`6020cnt;`6020i++)
- XX`6009`6009if`6020(duke(`6026answers`605Bi`605D))`6020`607B
- XX`6009`6009`6009rmtAddr`6020=`6020answers`605Bi`605D.source;
- XX`6009`6009`6009break;
- XX`6009`6009`607D
- XX`6009free((char`6020*)`6020answers);
- XX`6009free((char`6020*)`6020b);
- XX`6009if`6020(i`6020==`6020cnt)
- XX`6009`6009return`6020(Sockaddr`6020*)`6020NULL;
- XX`6009else
- XX`6009`6009return`6020`6026rmtAddr;
- XX#else`6009NO_BROADCAST
- XX`6009return`6020(Sockaddr`6020*)`6020NULL;
- XX#endif`6009NO_BROADCAST
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020See`6020if`6020the`6020game`6020contains`6020any`6020empty`6020slo
- Vts`6020for`6020players.
- XV
- XX`6020*/
- XX
- XXBoolean
- XXfreeSlot(a)
- XXstruct`6020answer`6009*a;
- XX`607B
- XX`6009RatStatus`6009test;
- XX`6009RatId`6009`6009id;
- XX
- XX`6009test`6020=`6020(RatStatus)`6020`6026a->packet.body;
- XX`6009for`6020(id`6020=`60200;`6020id`6020<`6020MAXRATS;`6020id++)
- XX`6009`6009if`6020(!test->rats`605Bid`605D.playing)
- XX`6009`6009`6009return`6020TRUE;
- XX`6009return`6020FALSE;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Fill`6020in`6020the`6020RAT_SURVEY`6020packet.
- XX`6020*/
- XX
- XXsetupSurvey(b)
- XXRatPacket`6020*b;
- XX`607B
- XX`6009RatNew`6009ratSurvey;
- XX
- XX`6009b->type`6020=`6020RAT_SURVEY;
- XX`6009ratSurvey`6020=`6020(RatNew)`6020`6026b->body;
- XX`6009ratSurvey->pass`6020=`6020RAT_PASSWORD;
- XX`607D
- XX
- XX/*`6020
- XX`6020*`6020Check`6020if`6020this`6020guy's`6020the`6020duke`6020of`6020his
- V`6020game.
- XX`6020*/
- XX
- XXBoolean
- XXduke(a)
- XXstruct`6020answer`6009*a;
- XX`607B
- XX`6009RatStatus`6009test;
- XX
- XX`6009test`6020=`6020(RatStatus)`6020`6026a->packet.body;
- XX`6009return`6020!bcmp((char`6020*)`6020`6026test->rats`605Btest->dukeRat`605D
- V.addr.sin_addr,
- XV
- XX`6009`6009`6009(char`6020*)`6020`6026a->source.sin_addr,`6020sizeof(struct
- V`6020in_addr));
- XX`607D
- XX
- XX/*
- XX`6020*`6020Resolve`6020the`6020specified`6020host`6020name`6020into`6020an
- V`6020internet`6020addres
- XVs.`6020`6020The`6020"name"`6020may
- XX`6020*`6020be`6020either`6020a`6020character`6020string`6020name,`6020or`6020
- Van`6020address`6020in
- XV`6020the`6020form`6020a.b.c.d`6020where
- XX`6020*`6020the`6020pieces`6020are`6020octal,`6020decimal,`6020or`6020hex`6020
- Vnumbers.`6020`6020Retur
- XVns`6020a`6020pointer`6020to`6020a
- XX`6020*`6020sockaddr_in`6020struct`6020(note`6020this`6020structure`6020is`602
- V0statically`6020all
- XVocated`6020and`6020must
- XX`6020*`6020be`6020copied),`6020or`6020NULL`6020if`6020the`6020name`6020is`602
- V0unknown.
- XX`6020*/
- XX
- XXSockaddr`6020*
- XXresolveHost(name)
- XXregister`6020char`6020*name;
- XX`607B
- XX`6009register`6020struct`6020hostent`6020*fhost;
- XX`6009struct`6020in_addr`6020fadd;
- XX`6009static`6020Sockaddr`6020sa;
- XX
- XX`6009if`6020((fhost`6020=`6020gethostbyname(name))`6020!=`6020NULL)`6020`607B
- V
- XX`6009`6009sa.sin_family`6020=`6020fhost->h_addrtype;
- XX`6009`6009sa.sin_port`6020=`60200;
- XX`6009`6009bcopy(fhost->h_addr,`6020`6026sa.sin_addr,`6020fhost->h_length);
- XX`6009`607D`6020else`6020`607B
- XX`6009`6009fadd.s_addr`6020=`6020inet_addr(name);
- XX`6009`6009if`6020(fadd.s_addr`6020!=`6020-1)`6020`607B
- XX`6009`6009`6009sa.sin_family`6020=`6020AF_INET;`6009/*`6020grot`6020*/
- XX`6009`6009`6009sa.sin_port`6020=`60200;
- XX`6009`6009`6009sa.sin_addr.s_addr`6020=`6020fadd.s_addr;
- XX`6009`6009`607D`6020else
- XX`6009`6009`6009return(NULL);
- XX`6009`607D
- XX`6009return(`6026sa);
- XX`607D
- X$`20call`20unpack`20INIT.C;9`201914317551`20""
- X$!
- X$`20create`20'f'
- XX.TH`6020MAZEFIND`60206
- XX.SH`6020NAME
- XXmazefind`6020`605C-`6020discover`6020current`6020MazeWar`6020games
- XX.SH`6020SYNTAX
- XX.B`6020/usr/games/mazefind
- XX.SH`6020DESCRIPTION
- XX.I`6020Mazefind
- XXbroadcasts`6020a`6020query`6020on`6020the`6020net`6020to`6020discover`6020wha
- +-+-+-+-+-+-+-+- END OF PART 2 +-+-+-+-+-+-+-+-
-