|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)dumpme.c 5.1 (Berkeley) 5/30/85"; ! 9: #endif not lint ! 10: ! 11: # include "trek.h" ! 12: ! 13: /* ! 14: ** Dump the starship somewhere in the galaxy ! 15: ** ! 16: ** Parameter is zero if bounce off of negative energy barrier, ! 17: ** one if through a black hole ! 18: ** ! 19: ** Note that the quadrant is NOT initialized here. This must ! 20: ** be done from the calling routine. ! 21: ** ! 22: ** Repair of devices must be deferred. ! 23: */ ! 24: ! 25: dumpme(flag) ! 26: int flag; ! 27: { ! 28: register int f; ! 29: double x; ! 30: register struct event *e; ! 31: register int i; ! 32: ! 33: f = flag; ! 34: Ship.quadx = ranf(NQUADS); ! 35: Ship.quady = ranf(NQUADS); ! 36: Ship.sectx = ranf(NSECTS); ! 37: Ship.secty = ranf(NSECTS); ! 38: x += 1.5 * franf(); ! 39: Move.time += x; ! 40: if (f) ! 41: { ! 42: printf("%s falls into a black hole.\n", Ship.shipname); ! 43: } ! 44: else ! 45: { ! 46: printf("Computer applies full reverse power to avoid hitting the\n"); ! 47: printf(" negative energy barrier. A space warp was entered.\n"); ! 48: } ! 49: /* bump repair dates forward */ ! 50: for (i = 0; i < MAXEVENTS; i++) ! 51: { ! 52: e = &Event[i]; ! 53: if (e->evcode != E_FIXDV) ! 54: continue; ! 55: reschedule(e, (e->date - Now.date) + x); ! 56: } ! 57: events(1); ! 58: printf("You are now in quadrant %d,%d. It is stardate %.2f\n", ! 59: Ship.quadx, Ship.quady, Now.date); ! 60: Move.time = 0; ! 61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.