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