|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)impulse.c 4.3 (Berkeley) 5/27/83"; ! 3: #endif not lint ! 4: ! 5: # include "trek.h" ! 6: ! 7: /** ! 8: ** move under impulse power ! 9: **/ ! 10: ! 11: impulse() ! 12: { ! 13: int course; ! 14: register int power; ! 15: double dist, time; ! 16: register int percent; ! 17: extern double move(); ! 18: ! 19: if (Ship.cond == DOCKED) ! 20: return (printf("Scotty: Sorry captain, but we are still docked.\n")); ! 21: if (damaged(IMPULSE)) ! 22: return (out(IMPULSE)); ! 23: if (getcodi(&course, &dist)) ! 24: return; ! 25: power = 20 + 100 * dist; ! 26: percent = 100 * power / Ship.energy + 0.5; ! 27: if (percent >= 85) ! 28: { ! 29: printf("Scotty: That would consume %d%% of our remaining energy.\n", ! 30: percent); ! 31: if (!getynpar("Are you sure that is wise")) ! 32: return; ! 33: printf("Aye aye, sir\n"); ! 34: } ! 35: time = dist / 0.095; ! 36: percent = 100 * time / Now.time + 0.5; ! 37: if (percent >= 85) ! 38: { ! 39: printf("Spock: That would take %d%% of our remaining time.\n", ! 40: percent); ! 41: if (!getynpar("Are you sure that is wise")) ! 42: return; ! 43: printf("(He's finally gone mad)\n"); ! 44: } ! 45: Move.time = move(0, course, time, 0.095); ! 46: Ship.energy -= 20 + 100 * Move.time * 0.095; ! 47: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.