|
|
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[] = "@(#)dcrept.c 5.1 (Berkeley) 5/30/85"; ! 9: #endif not lint ! 10: ! 11: # include "trek.h" ! 12: ! 13: /* ! 14: ** damage control report ! 15: ** ! 16: ** Print damages and time to fix. This is taken from the event ! 17: ** list. A couple of factors are set up, based on whether or not ! 18: ** we are docked. (One of these factors will always be 1.0.) ! 19: ** The event list is then scanned for damage fix events, the ! 20: ** time until they occur is determined, and printed out. The ! 21: ** magic number DAMFAC is used to tell how much faster you can ! 22: ** fix things if you are docked. ! 23: */ ! 24: ! 25: dcrept() ! 26: { ! 27: register int i, f; ! 28: double x; ! 29: double m1, m2; ! 30: register struct event *e; ! 31: ! 32: /* set up the magic factors to output the time till fixed */ ! 33: if (Ship.cond == DOCKED) ! 34: { ! 35: m1 = 1.0 / Param.dockfac; ! 36: m2 = 1.0; ! 37: } ! 38: else ! 39: { ! 40: m1 = 1.0; ! 41: m2 = Param.dockfac; ! 42: } ! 43: printf("Damage control report:\n"); ! 44: f = 1; ! 45: ! 46: /* scan for damages */ ! 47: for (i = 0; i < MAXEVENTS; i++) ! 48: { ! 49: e = &Event[i]; ! 50: if (e->evcode != E_FIXDV) ! 51: continue; ! 52: ! 53: /* output the title first time */ ! 54: if (f) ! 55: { ! 56: printf("\t\t\t repair times\n"); ! 57: printf("device\t\t\tin flight docked\n"); ! 58: f = 0; ! 59: } ! 60: ! 61: /* compute time till fixed, then adjust by the magic factors */ ! 62: x = e->date - Now.date; ! 63: printf("%-24s%7.2f %7.2f\n", ! 64: Device[e->systemname].name, x * m1 + 0.005, x * m2 + 0.005); ! 65: ! 66: /* do a little consistancy checking */ ! 67: } ! 68: ! 69: /* if everything was ok, reassure the nervous captain */ ! 70: if (f) ! 71: printf("All devices functional\n"); ! 72: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.