|
|
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[] = "@(#)abandon.c 5.4 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: # include "trek.h" ! 25: ! 26: /* ! 27: ** Abandon Ship ! 28: ** ! 29: ** The ship is abandoned. If your current ship is the Faire ! 30: ** Queene, or if your shuttlecraft is dead, you're out of ! 31: ** luck. You need the shuttlecraft in order for the captain ! 32: ** (that's you!!) to escape. ! 33: ** ! 34: ** Your crew can beam to an inhabited starsystem in the ! 35: ** quadrant, if there is one and if the transporter is working. ! 36: ** If there is no inhabited starsystem, or if the transporter ! 37: ** is out, they are left to die in outer space. ! 38: ** ! 39: ** These currently just count as regular deaths, but they ! 40: ** should count very heavily against you. ! 41: ** ! 42: ** If there are no starbases left, you are captured by the ! 43: ** Klingons, who torture you mercilessly. However, if there ! 44: ** is at least one starbase, you are returned to the ! 45: ** Federation in a prisoner of war exchange. Of course, this ! 46: ** can't happen unless you have taken some prisoners. ! 47: ** ! 48: ** Uses trace flag 40 ! 49: */ ! 50: ! 51: abandon() ! 52: { ! 53: register struct quad *q; ! 54: register int i; ! 55: int j; ! 56: register struct event *e; ! 57: ! 58: if (Ship.ship == QUEENE) ! 59: return (printf("You may not abandon ye Faire Queene\n")); ! 60: if (Ship.cond != DOCKED) ! 61: { ! 62: if (damaged(SHUTTLE)) ! 63: return (out(SHUTTLE)); ! 64: printf("Officers escape in shuttlecraft\n"); ! 65: /* decide on fate of crew */ ! 66: q = &Quad[Ship.quadx][Ship.quady]; ! 67: if (q->qsystemname == 0 || damaged(XPORTER)) ! 68: { ! 69: printf("Entire crew of %d left to die in outer space\n", ! 70: Ship.crew); ! 71: Game.deaths += Ship.crew; ! 72: } ! 73: else ! 74: { ! 75: printf("Crew beams down to planet %s\n", systemname(q)); ! 76: } ! 77: } ! 78: /* see if you can be exchanged */ ! 79: if (Now.bases == 0 || Game.captives < 20 * Game.skill) ! 80: lose(L_CAPTURED); ! 81: /* re-outfit new ship */ ! 82: printf("You are hereby put in charge of an antiquated but still\n"); ! 83: printf(" functional ship, the Fairie Queene.\n"); ! 84: Ship.ship = QUEENE; ! 85: Ship.shipname = "Fairie Queene"; ! 86: Param.energy = Ship.energy = 3000; ! 87: Param.torped = Ship.torped = 6; ! 88: Param.shield = Ship.shield = 1250; ! 89: Ship.shldup = 0; ! 90: Ship.cloaked = 0; ! 91: Ship.warp = 5.0; ! 92: Ship.warp2 = 25.0; ! 93: Ship.warp3 = 125.0; ! 94: Ship.cond = GREEN; ! 95: /* clear out damages on old ship */ ! 96: for (i = 0; i < MAXEVENTS; i++) ! 97: { ! 98: e = &Event[i]; ! 99: if (e->evcode != E_FIXDV) ! 100: continue; ! 101: unschedule(e); ! 102: } ! 103: /* get rid of some devices and redistribute probabilities */ ! 104: i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK]; ! 105: Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0; ! 106: while (i > 0) ! 107: for (j = 0; j < NDEV; j++) ! 108: { ! 109: if (Param.damprob[j] != 0) ! 110: { ! 111: Param.damprob[j] += 1; ! 112: i--; ! 113: if (i <= 0) ! 114: break; ! 115: } ! 116: } ! 117: /* pick a starbase to restart at */ ! 118: i = ranf(Now.bases); ! 119: Ship.quadx = Now.base[i].x; ! 120: Ship.quady = Now.base[i].y; ! 121: /* setup that quadrant */ ! 122: while (1) ! 123: { ! 124: initquad(1); ! 125: Sect[Ship.sectx][Ship.secty] = EMPTY; ! 126: for (i = 0; i < 5; i++) ! 127: { ! 128: Ship.sectx = Etc.starbase.x + ranf(3) - 1; ! 129: if (Ship.sectx < 0 || Ship.sectx >= NSECTS) ! 130: continue; ! 131: Ship.secty = Etc.starbase.y + ranf(3) - 1; ! 132: if (Ship.secty < 0 || Ship.secty >= NSECTS) ! 133: continue; ! 134: if (Sect[Ship.sectx][Ship.secty] == EMPTY) ! 135: { ! 136: Sect[Ship.sectx][Ship.secty] = QUEENE; ! 137: dock(); ! 138: compkldist(0); ! 139: return; ! 140: } ! 141: } ! 142: } ! 143: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.