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