|
|
1.1 ! root 1: # include "trek.h" ! 2: ! 3: /** ! 4: ** schedule an event ! 5: **/ ! 6: ! 7: schedule(type, delta, x, y, z) ! 8: int type; ! 9: float delta; ! 10: char x, y; ! 11: char z; ! 12: { ! 13: register EVENT *e; ! 14: register int i; ! 15: ! 16: for (i = 0; i < MAXEVENTS; i++) ! 17: { ! 18: e = &Event[i]; ! 19: if (e->evcode >= 0) ! 20: continue; ! 21: /* got a slot */ ! 22: e->evcode = type; ! 23: e->date = Status.date + delta; ! 24: e->x = x; ! 25: e->y = y; ! 26: e->evdata = z; ! 27: if (type < 64) ! 28: Etc.eventptr[type] = e; ! 29: return(e); ! 30: } ! 31: syserr("Cannot schedule event %d parm %d %d %d", type, x, y, z); ! 32: return(-1); ! 33: } ! 34: ! 35: ! 36: /** ! 37: ** reschedule an event ! 38: **/ ! 39: ! 40: reschedule(e, delta) ! 41: EVENT *e; ! 42: float delta; ! 43: { ! 44: e->date =+ delta; ! 45: return; ! 46: } ! 47: ! 48: ! 49: /** ! 50: ** unschedule an event ! 51: **/ ! 52: ! 53: unschedule(e) ! 54: EVENT *e; ! 55: { ! 56: if (e->evcode < 64) ! 57: Etc.eventptr[e->evcode] = 0; ! 58: e->date = 1e50; ! 59: e->evcode = -1; ! 60: return; ! 61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.