|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T i
Length: 2825 (0xb09)
Types: TextFile
Names: »interface.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/X/Xtrek/interface.c«
static char sccsid[] = "@(#)interface.c 1.1";
/*
Copyright (c) 1986 Chris Guthrie
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation. No representations are made about the
suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
*/
/* This file will include all the interfaces between the input routines
and the daemon. They should be useful for writing robots and the
like */
#include <X11/Xlib.h>
#include <stdio.h>
#include <math.h>
#include <signal.h>
#include "defs.h"
#include "data.h"
set_speed(p, speed)
register struct player *p;
int speed;
{
p->p_desspeed = speed;
p->p_flags &= ~(PFREPAIR | PFBOMB | PFORBIT | PFBEAMUP | PFBEAMDOWN);
}
set_course(p, dir)
register struct player *p;
unsigned char dir;
{
p->p_desdir = dir;
p->p_flags &= ~(PFBOMB | PFORBIT | PFBEAMUP | PFBEAMDOWN);
}
shield_up(p)
register struct player *p;
{
p->p_flags |= PFSHIELD;
p->p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
}
shield_down(p)
register struct player *p;
{
p->p_flags &= ~PFSHIELD;
}
shield_tog(p)
register struct player *p;
{
p->p_flags ^= PFSHIELD;
p->p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
}
bomb_planet(p)
register struct player *p;
{
if (!(p->p_flags & PFORBIT)) {
warning(p, "Must be orbiting to bomb");
return;
}
p->p_flags |= PFBOMB;
p->p_flags &= ~(PFSHIELD | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
}
beam_up(p)
register struct player *p;
{
if (!(p->p_flags & PFORBIT)) {
warning(p, "Must be orbiting to beam up.");
return;
}
if (p->p_team != planets[p->p_planet].pl_owner) {
warning(p, "Those aren't our armies.");
return;
}
p->p_flags |= PFBEAMUP;
p->p_flags &= ~(PFSHIELD | PFREPAIR | PFBOMB | PFBEAMDOWN);
}
beam_down(p)
register struct player *p;
{
if (!(p->p_flags & PFORBIT)) {
warning(p, "Must be orbiting to beam down.");
return;
}
p->p_flags |= PFBEAMDOWN;
p->p_flags &= ~(PFSHIELD | PFREPAIR | PFBOMB | PFBEAMUP);
}
repair(p)
register struct player *p;
{
p->p_desspeed = 0;
p->p_flags |= PFREPAIR;
p->p_flags &= ~(PFSHIELD | PFBOMB | PFBEAMUP | PFBEAMDOWN);
}
repair_off(p)
register struct player *p;
{
p->p_flags &= ~PFREPAIR;
}
repeat_message(p)
register struct player *p;
{
if (++(p->lastm) == MAXMESSAGE) ;
p->lastm = 0;
}
cloak(p)
register struct player *p;
{
p->p_flags ^= PFCLOAK;
}
cloak_on(p)
register struct player *p;
{
p->p_flags |= PFCLOAK;
}
cloak_off(p)
register struct player *p;
{
p->p_flags &= ~PFCLOAK;
}