1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char sccsid[] = "@(#)impulse.c	5.1 (Berkeley) 5/30/85";
   9: #endif not lint
  10: 
  11: # include   "trek.h"
  12: 
  13: /**
  14:  **	move under impulse power
  15:  **/
  16: 
  17: impulse()
  18: {
  19:     int         course;
  20:     register int        power;
  21:     double          dist, time;
  22:     register int        percent;
  23:     extern double       move();
  24: 
  25:     if (Ship.cond == DOCKED)
  26:         return (printf("Scotty: Sorry captain, but we are still docked.\n"));
  27:     if (damaged(IMPULSE))
  28:         return (out(IMPULSE));
  29:     if (getcodi(&course, &dist))
  30:         return;
  31:     power = 20 + 100 * dist;
  32:     percent = 100 * power / Ship.energy + 0.5;
  33:     if (percent >= 85)
  34:     {
  35:         printf("Scotty: That would consume %d%% of our remaining energy.\n",
  36:             percent);
  37:         if (!getynpar("Are you sure that is wise"))
  38:             return;
  39:         printf("Aye aye, sir\n");
  40:     }
  41:     time = dist / 0.095;
  42:     percent = 100 * time / Now.time + 0.5;
  43:     if (percent >= 85)
  44:     {
  45:         printf("Spock: That would take %d%% of our remaining time.\n",
  46:             percent);
  47:         if (!getynpar("Are you sure that is wise"))
  48:             return;
  49:         printf("(He's finally gone mad)\n");
  50:     }
  51:     Move.time = move(0, course, time, 0.095);
  52:     Ship.energy -= 20 + 100 * Move.time * 0.095;
  53: }

Defined functions

impulse defined in line 17; used 2 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-05-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 578
Valid CSS Valid XHTML 1.0 Strict