Commit | Line | Data |
---|---|---|
b6f0a7e4 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
e9fb6bea KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
d99e6414 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
b6f0a7e4 DF |
16 | */ |
17 | ||
7f24e2d8 | 18 | #ifndef lint |
d99e6414 | 19 | static char sccsid[] = "@(#)dcrept.c 5.3 (Berkeley) %G%"; |
e9fb6bea | 20 | #endif /* not lint */ |
7f24e2d8 KM |
21 | |
22 | # include "trek.h" | |
23 | ||
24 | /* | |
25 | ** damage control report | |
26 | ** | |
27 | ** Print damages and time to fix. This is taken from the event | |
28 | ** list. A couple of factors are set up, based on whether or not | |
29 | ** we are docked. (One of these factors will always be 1.0.) | |
30 | ** The event list is then scanned for damage fix events, the | |
31 | ** time until they occur is determined, and printed out. The | |
32 | ** magic number DAMFAC is used to tell how much faster you can | |
33 | ** fix things if you are docked. | |
34 | */ | |
35 | ||
36 | dcrept() | |
37 | { | |
38 | register int i, f; | |
06d69904 KL |
39 | double x; |
40 | double m1, m2; | |
7f24e2d8 KM |
41 | register struct event *e; |
42 | ||
43 | /* set up the magic factors to output the time till fixed */ | |
44 | if (Ship.cond == DOCKED) | |
45 | { | |
46 | m1 = 1.0 / Param.dockfac; | |
47 | m2 = 1.0; | |
48 | } | |
49 | else | |
50 | { | |
51 | m1 = 1.0; | |
52 | m2 = Param.dockfac; | |
53 | } | |
54 | printf("Damage control report:\n"); | |
55 | f = 1; | |
56 | ||
57 | /* scan for damages */ | |
58 | for (i = 0; i < MAXEVENTS; i++) | |
59 | { | |
60 | e = &Event[i]; | |
61 | if (e->evcode != E_FIXDV) | |
62 | continue; | |
63 | ||
64 | /* output the title first time */ | |
65 | if (f) | |
66 | { | |
67 | printf("\t\t\t repair times\n"); | |
68 | printf("device\t\t\tin flight docked\n"); | |
69 | f = 0; | |
70 | } | |
71 | ||
72 | /* compute time till fixed, then adjust by the magic factors */ | |
73 | x = e->date - Now.date; | |
74 | printf("%-24s%7.2f %7.2f\n", | |
75 | Device[e->systemname].name, x * m1 + 0.005, x * m2 + 0.005); | |
76 | ||
77 | /* do a little consistancy checking */ | |
78 | } | |
79 | ||
80 | /* if everything was ok, reassure the nervous captain */ | |
81 | if (f) | |
82 | printf("All devices functional\n"); | |
83 | } |