zones.c,v
./abermud/RCS/zones.c,v · 2.7 KB
From the archive abermud-89.tar.gz
Download the archive « Back to the archive contents
head 1.2;
access ;
symbols ;
locks ; strict;
comment @ * @;
1.2
date 89.07.03.08.18.32; author rsalz; state Exp;
branches ;
next 1.1;
1.1
date 89.03.13.09.38.04; author rsalz; state Exp;
branches ;
next ;
desc
@@
1.2
log
@Incorporate many fixes by Jussi <eloranta@@tukki.jyu.fi>,
and some minor tweaks by Rich.
@
text
@/*
* Zone based name generator
*/
#include "kernel.h"
#ifdef RCSID
static char RCS[] =
"$Header: zones.c,v 1.1 89/03/13 09:38:04 rsalz Exp $";
#endif /* RCSID */
findzone(x, str)
char *str;
int x;
{
int a, b;
int c;
x = -x;
if (x <= 0) {
strcpy(str, "TCHAN");
return 0;
}
for (a = 0, b = 0; a < x; b++) {
strcpy(str, zoname[b].z_name);
c = a;
a = zoname[b].z_loc;
}
return x - c;
}
exits()
{
int a;
int b;
char st[64];
int v;
if (isdark()) {
bprintf("It is dark.....\n");
return;
}
bprintf("Obvious exits are\n");
for (a = 0, b = 0; a < 6; a++) {
if (getexit(ploc(mynum), a) >= 0)
continue;
if (plev(mynum) < 10)
bprintf("%s : %s\n", dirns[a],
sdesc(getexit(ploc(mynum), a)));
else {
v = findzone(getexit(ploc(mynum), a), st);
bprintf("%s : %-45s : %s%d\n",
dirns[a], sdesc(getexit(ploc(mynum), a)), st, v);
}
b = 1;
}
if (b == 0)
bprintf("None....\n");
}
roomnum(str, offstr)
char *str;
char *offstr;
{
int a, b, c;
int d;
char w[64];
for (b = 0, a = 0; a < numzon; b = zoname[++a].z_loc) {
strcpy(w, zoname[a].z_name);
if (EQ(lowercase(w), str)) {
c = zoname[a - 1].z_loc;
if (EMPTY(offstr))
d = 1;
else
sscanf(offstr, "%ld", &d);
sprintf(wd_there, "%s", str);
sprintf(wd_th2, "%s", offstr);
lowercase(wd_there);
lowercase(wd_th2);
if (d <= 0)
break;
return -(c + d);
}
}
return 0;
}
showname(loc)
int loc;
{
char a[64];
int b;
b = findzone(loc, a);
bprintf("%s%d", a, b);
if (plev(mynum) > 9999)
bprintf("[ %d ]", loc);
sprintf(wd_there, "%s", a);
sprintf(wd_th2, "%d", b);
lowercase(wd_there);
lowercase(wd_th2);
bprintf("\n");
}
loccom()
{
int a;
if (plev(mynum) < 10) {
bprintf("Oh go away, thats for wizards\n");
return;
}
bprintf("\nKnown Location Nodes Are\n\n");
a = 0;
do {
bprintf("%-20s", zoname[a].z_name);
if (a % 4 == 3)
bprintf("\n");
} while (zoname[a++].z_loc != 99999);
bprintf("\n");
}
@
1.1
log
@Initial revision
@
text
@d7 1
a7 1
"$Header$";
d72 1
a72 1
for (b = 0, a = 0; b < 99990; b = zoname[++a].z_loc) {
d75 1
a75 2
c = zoname[a].z_loc;
sscanf(offstr, "%ld", &d);
d78 2
d84 3
a86 5
if (d == 0)
return 0;
if (d + b > c)
return 0;
return -(d + b);
@