DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T l

⟦c5c84f8a8⟧ TextFile

    Length: 7326 (0x1c9e)
    Types: TextFile
    Names: »locdir.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Abermud/locdir.c« 

TextFile

/*
**  The other stuff in here handles time , and also game
**  timelocks.  Note that this means there is an additional file within
**  the game system when compared with version 18.
*/
#include "kernel.h"
#include <fcntl.h>
#ifdef	RCSID
static char RCS[] =
	"$Header: locdir.c,v 1.1 89/03/13 09:36:37 rsalz Exp $";
#endif	/* RCSID */


static char folnam[16];
static int trace_carrf;
static int i_folcode = -1;
static int trace_class = -1;
static int trace_item = -1;
static int trace_loc;

#ifndef LOWMEM

timecom()
{
    FILE *a;
    time_t x;

    time(&x);
    bprintf("Current Time : %s", ctime(&x));
    closeworld();
    /* have to be careful with snoop and world reset or can deadlock */
    if (snoopd != -1)
	bprintf(" %c", 8);
    if ((a = openlock(RESET_N, "r")) == NULL)
	return;
    fscanf(a, "%d", &x);
    closelock(a);
    bprintf("Last Reset   : %s", ctime(&x));
}


showitem()
{
    int x;

    if (plev(mynum) < 10) {
	bprintf("I don't know that verb\n");
	return;
    }
    if (EMPTY(item1)) {
	bprintf("Show which item ?\n");
	return;
    }
    if ((x = fobn(item1)) == -1) {
	bprintf("Whats that ?\n");
	return;
    }
    bprintf("Item : %s\n", oname(x));
    bprintf("State : %d    Max State : %d    Base Value : %d    Flannel : %d\n",
    state(x), omaxstate(x), obaseval(x), oflannel(x));
    bprintf("Damage: %d    InfoData  : %d    Size       : %d\nProperties :\n",
		obyte(x, 0), obyte(x, 1), osize(x));
    pdobit(x, 0, "Destroyed");
    pdobit(x, 1, "Linked");
    pdobit(x, 2, "Openable");
    pdobit(x, 3, "Lockable");
    pdobit(x, 4, "Pushable");
    pdobit(x, 5, "Pushtoggle");
    pdobit(x, 6, "Food");
    pdobit(x, 7, "<Spare>");
    pdobit(x, 8, "Wearable");
    pdobit(x, 9, "Lightable");
    pdobit(x, 10, "Extinguish");
    pdobit(x, 13, "Lit");
    pdobit(x, 11, "Key");
    pdobit(x, 12, "Getflips");
    pdobit(x, 14, "Container");
    pdobit(x, 15, "Weapon");
    bprintf("\nDescriptions:\n%s\n%s\n%s\n%s\n",
	    olongt(x, 0), olongt(x, 1), olongt(x, 2), olongt(x, 3));
}

pdobit(o, x, st)
    int o;
    int x;
    char *st;
{
    static int ct = 0;

    if (x == 0)
	ct = 0;
    if (otstbit(o, x)) {
	ct += strlen(st) + 1;
	if (ct > 79) {
	    bprintf("\n");
	}
	bprintf("%s ", st);
    }
}

warcom()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[0] = 0;
    broad("The air of peace and friendship lifts.\n");
}

peacecom()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[0] = 1;
    broad("Peace and tranquility descends upon the world.\n");
}

awizlock()
{
    if (plev(mynum) < 10000) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[1] = 127;
    bprintf("The Game is now ARCHWIZARD locked.\n");
}

wizlock()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[1] = 10;
    bprintf("The Game is now WIZARD locked.\n");
}

godlock()
{
    if (!op(pname(mynum))) {
	bprintf("I don't know that verb.\n");
	return;
    }
    if (unlink(GODFILE) == 0)
	bprintf("The Game is now GOD locked.\n");
    else
	bprintf("The Game is already GOD locked.\n");
}

awizunlock()
{
    if (plev(mynum) < 10000) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[1] = 0;
    bprintf("The Game is now unlocked.\n");
}

wizunlock()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    shimge[1] = 0;
    bprintf("The Game is now unlocked.\n");

}
#endif	/* LOWMEM */


godunlock()
{
    int f_pr;

    if (!op(pname(mynum))) {
	bprintf("I don't know that verb.\n");
	return;
    }
    if ((f_pr = open(GODFILE, O_CREAT | O_EXCL, 0600)) > 0) {
	bprintf("The game is GOD unlocked.\n");
	close(f_pr);
    }
    else
	bprintf("The game is already unlocked.\n");
}

awizcom()
{
    char x[128], y[140];

    if (plev(mynum) < 10000) {
	bprintf("Yeah sure... \n");
	return;
    }
    getreinput(x);
    sprintf(y, "\001c%s\001# %s\n", pname(mynum), x);
    sendsys(pname(mynum), pname(mynum), -10125, 0, y);
    rd_qd = 1;
}

followcom()
{
    if (i_follow == 1) {
	bprintf("Stopped following \001P%s\001.\n", folnam);
	i_follow = 0;
	strcpy(folnam, "");
    }
    if (in_fight) {
	bprintf("You are too busy fighting!\n");
	return;
    }
    if (EMPTY(item1)) {
	bprintf("Who ?\n");
	return;
    }
    if ((i_folcode = pl1) == -1) {
	bprintf("Who ?\n");
	return;
    }
    if (ploc(i_folcode) != ploc(mynum)) {
	bprintf("They are not here.\n");
	return;
    }
    if (mynum == i_folcode) {
	bprintf("You run round in circles!\n");
	return;
    }
    strcpy(folnam, pname(i_folcode));
    i_follow = 1;
    bprintf("Ok\n");
}

losecom()
{
    if (i_follow == 0) {
	bprintf("You aren't following anyone\n");
	return;
    }
    i_follow = 0;
    strcpy(folnam, "");
    i_folcode = -1;
    bprintf("Ok\n");
}

on_follow()
{
    int ct;

    on_trace();
    if (!i_follow)
	return;
    if (in_fight || fpbn(folnam) != i_folcode) {
	bprintf("You can no longer follow \001P%s\001.\n", folnam);
	i_follow = 0;
	return;
    }
    /* Now to find the guy */
    if (ploc(mynum) == ploc(i_folcode))
	return;
    if (ploc(i_folcode) >= -999 && ploc(i_folcode) <= -900)
	return;
    /* Dont follow to sea! */
    for (ct = 0; ct < 6; ct++) {
	if (getexit(ploc(mynum), ct) == ploc(i_folcode)
	 || (doorthru(getexit(ploc(mynum), ct)) == ploc(i_folcode)
	  && plev(mynum) > 10)) {
	    dodirn(ct + 2);
	    return;
	}
    }
    bprintf("You can no longer follow \001P%s\001.\n", folnam);
    strcpy(folnam, "");
    i_folcode = -1;
    i_follow = 0;
}

doorthru(x)
    int x;
{
    if (x < 1000 || x > 9999)
	return x;
    if (state(x - 1000))
	return 0;
    return oloc((x - 1000) ^ 1);
}

tracecom()
{
    int i;

    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    if (trace_item != -1) {
	bprintf("Stopped tracing %s\n",
	    trace_class == 1 ? oname(trace_item) : pname(trace_item));
	trace_item = -1;
	if (brkword() == -1)
	    return;
    }
    else if (EMPTY(item1)) {
	bprintf("What ?\n");
	return;
    }
    if ((i = pl1) != -1) {
	trace_class = 2;
	trace_item = i;
	trace_loc = 0;
	trace_carrf = 0;
	bprintf("Ok.\n");
	return;
    }
    if ((i = ob1) != -1) {
	trace_class = 1;
	trace_item = i;
	trace_loc = 0;
	trace_carrf = 0;
	bprintf("Ok.\n");
	return;
    }
    bprintf("Whats that ?\n");
}

on_trace()
{
    if (trace_item == -1)
	return;
    if (trace_class == 1) {
	if (trace_loc != oloc(trace_item)
	 || trace_carrf != ocarrf(trace_item)) {
	    bprintf(">>%s now at ", oname(trace_item));
	    trace_carrf = ocarrf(trace_item);
	    trace_loc = oloc(trace_item);
	    desrm(trace_loc, trace_carrf);
	}
	return;
    }
    if (EMPTY(pname(trace_item))) {
	bprintf(">>Can no longer trace...\n");
	trace_item = -1;
	return;
    }
    if (ploc(trace_item) != trace_loc) {
	bprintf(">>\001p%s\001 now at ", pname(trace_item));
	trace_loc = ploc(trace_item);
	desrm(trace_loc, 0);
    }
}


mobilecom()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    bprintf("Mobiles");
    if (shimge[3])
	bprintf("   [Currently STOPped]");
    bprintf("\n\n");
    whop2(1, 16, 64);
}

peoplecom()
{
    if (plev(mynum) < 10) {
	bprintf("I don't know that verb.\n");
	return;
    }
    bprintf("People\n\n");
    whop2(1, 0, 15);
}