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[] = "@(#)ram.c	5.1 (Berkeley) 5/30/85";
   9: #endif not lint
  10: 
  11: # include   "trek.h"
  12: 
  13: /*
  14: **  RAM SOME OBJECT
  15: **
  16: **	You have run into some sort of object.  It may be a Klingon,
  17: **	a star, or a starbase.  If you run into a star, you are really
  18: **	stupid, because there is no hope for you.
  19: **
  20: **	If you run into something else, you destroy that object.  You
  21: **	also rack up incredible damages.
  22: */
  23: 
  24: ram(ix, iy)
  25: int ix, iy;
  26: {
  27:     register int        i;
  28:     register char       c;
  29: 
  30:     printf("RED ALERT: collision imminent\n");
  31:     c = Sect[ix][iy];
  32:     switch (c)
  33:     {
  34: 
  35:       case KLINGON:
  36:         printf("%s rams Klingon at %d,%d\n", Ship.shipname, ix, iy);
  37:         killk(ix, iy);
  38:         break;
  39: 
  40:       case STAR:
  41:       case INHABIT:
  42:         printf("Yeoman Rand: Captain, isn't it getting hot in here?\n");
  43:         sleep(2);
  44:         printf("Spock: Hull temperature approaching 550 Degrees Kelvin.\n");
  45:         lose(L_STAR);
  46: 
  47:       case BASE:
  48:         printf("You ran into the starbase at %d,%d\n", ix, iy);
  49:         killb(Ship.quadx, Ship.quady);
  50:         /* don't penalize the captain if it wasn't his fault */
  51:         if (!damaged(SINS))
  52:             Game.killb += 1;
  53:         break;
  54:     }
  55:     sleep(2);
  56:     printf("%s heavily damaged\n", Ship.shipname);
  57: 
  58:     /* select the number of deaths to occur */
  59:     i = 10 + ranf(20 * Game.skill);
  60:     Game.deaths += i;
  61:     Ship.crew -= i;
  62:     printf("McCoy: Take it easy Jim; we had %d casualties.\n", i);
  63: 
  64:     /* damage devices with an 80% probability */
  65:     for (i = 0; i < NDEV; i++)
  66:     {
  67:         if (ranf(100) < 20)
  68:             continue;
  69:         damage(i, (2.5 * (franf() + franf()) + 1.0) * Param.damfac[i]);
  70:     }
  71: 
  72:     /* no chance that your shields remained up in all that */
  73:     Ship.shldup = 0;
  74: }

Defined functions

ram defined in line 24; used 1 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: 946
Valid CSS Valid XHTML 1.0 Strict