|
|
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 ! 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. ! 16: */ ! 17: ! 18: #ifndef lint ! 19: static char sccsid[] = "@(#)impulse.c 5.3 (Berkeley) 6/18/88"; ! 20: #endif /* not lint */ ! 21: ! 22: # include "trek.h" ! 23: ! 24: /** ! 25: ** move under impulse power ! 26: **/ ! 27: ! 28: impulse() ! 29: { ! 30: int course; ! 31: register int power; ! 32: double dist, time; ! 33: register int percent; ! 34: extern double move(); ! 35: ! 36: if (Ship.cond == DOCKED) ! 37: return (printf("Scotty: Sorry captain, but we are still docked.\n")); ! 38: if (damaged(IMPULSE)) ! 39: return (out(IMPULSE)); ! 40: if (getcodi(&course, &dist)) ! 41: return; ! 42: power = 20 + 100 * dist; ! 43: percent = 100 * power / Ship.energy + 0.5; ! 44: if (percent >= 85) ! 45: { ! 46: printf("Scotty: That would consume %d%% of our remaining energy.\n", ! 47: percent); ! 48: if (!getynpar("Are you sure that is wise")) ! 49: return; ! 50: printf("Aye aye, sir\n"); ! 51: } ! 52: time = dist / 0.095; ! 53: percent = 100 * time / Now.time + 0.5; ! 54: if (percent >= 85) ! 55: { ! 56: printf("Spock: That would take %d%% of our remaining time.\n", ! 57: percent); ! 58: if (!getynpar("Are you sure that is wise")) ! 59: return; ! 60: printf("(He's finally gone mad)\n"); ! 61: } ! 62: Move.time = move(0, course, time, 0.095); ! 63: Ship.energy -= 20 + 100 * Move.time * 0.095; ! 64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.