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