Mercurial > ~darius > hgwebdir.cgi > paradise_client
view interface.c @ 3:5a977ccbc7a9 default tip
Empty changelog
author | darius |
---|---|
date | Sat, 06 Dec 1997 05:41:29 +0000 |
parents | |
children |
line wrap: on
line source
/* $Id: interface.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */ /* * interface.c * * 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 "copyright.h" #include <stdio.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> #ifndef sgi #include <sys/timeb.h> #endif /* sgi */ #include <signal.h> #include "Wlib.h" #include "defs.h" #include "struct.h" #include "data.h" #include "packets.h" #include "proto.h" void set_speed(speed) int speed; { /* don't repeat useless commands [BDyess] */ if (me->p_desspeed != speed || me->p_speed != speed) sendSpeedReq(speed); me->p_desspeed = speed; } void set_course(dir) unsigned int dir; { /* don't repeat commands [BDyess] */ if (me->p_desdir != dir || me->p_dir != dir) sendDirReq(dir); me->p_desdir = dir; } void shield_up() { if (!(me->p_flags & PFSHIELD)) { sendShieldReq(1); } } void shield_down() { if (me->p_flags & PFSHIELD) { sendShieldReq(0); } } void shield_tog() { if (me->p_flags & PFSHIELD) { sendShieldReq(0); } else { sendShieldReq(1); } } void bomb_planet() { if (!(me->p_flags & PFBOMB)) { sendBombReq(1); } } void beam_up() { if (!(me->p_flags & PFBEAMUP)) { sendBeamReq(1); /* 1 means up... */ } } void beam_down() { if (!(me->p_flags & PFBEAMDOWN)) { sendBeamReq(2); /* 2 means down... */ } } void cloak() { if (me->p_flags & PFCLOAK) { sendCloakReq(0); } else { sendCloakReq(1); } } int mtime() { #if 0 struct timeb tm; ftime(&tm); /* mask off 16 high bits and add in milliseconds */ return (tm.time & 0x0000ffff) * 1000 + tm.millitm; #else struct timeval tv; gettimeofday(&tv, (struct timezone *) 0); return (tv.tv_sec & 0x0ffff) * 1000 + tv.tv_usec / 1000; #endif }