|
|
1.1 ! root 1: # include "trek.h" ! 2: ! 3: /** ! 4: ** abandon ship ! 5: **/ ! 6: ! 7: abandon() ! 8: { ! 9: register QUAD *q; ! 10: register int i; ! 11: int j; ! 12: register EVENT *e; ! 13: ! 14: if (Status.ship == QUEENE) { ! 15: printf("Ye Fairie Queene has no shuttlecraft\n"); ! 16: return; ! 17: } ! 18: if (Damage[SHUTTLE]) { ! 19: printf("Shuttlecraft damaged\n"); ! 20: return; ! 21: } ! 22: printf("Officers escape in shuttlecraft\n"); ! 23: /* decide on fate of crew */ ! 24: q = &Quad[Quadx][Quady]; ! 25: if (q->systemname == 0 || q->systemname&Q_GHOST || Damage[XPORTER]) ! 26: { ! 27: printf("Entire crew of %d left to die in outer space\n", ! 28: Status.crew); ! 29: Game.deaths =+ Status.crew; ! 30: } ! 31: else ! 32: { ! 33: i = getqname(q); ! 34: printf("Crew beams down to planet %s\n", ! 35: Systemname[i]); ! 36: } ! 37: /* see if another ship exists */ ! 38: if (Status.bases == 0) ! 39: lose(L_CAPTURED); ! 40: /* re-outfit new ship */ ! 41: printf("You are hereby put in charge of an antiquated but still\n"); ! 42: printf(" functional ship, the Fairie Queene.\n"); ! 43: Status.ship = QUEENE; ! 44: Status.shipname = "Fairie Queene"; ! 45: Initial.energy = Status.energy = 3000; ! 46: Initial.torped = Status.torped = 6; ! 47: Initial.shield = Status.shield = 1250; ! 48: Status.shldup = 0; ! 49: Status.cloaked = 0; ! 50: Status.warp = 5.0; ! 51: Status.warp2 = 25.0; ! 52: Status.warp3 = 125.0; ! 53: Status.cond = GREEN; ! 54: /* clear out damages on old ship */ ! 55: for (i = 0; i < MAXEVENTS; i++) ! 56: { ! 57: e = &Event[i]; ! 58: if (e->evcode != E_FIXDV) ! 59: continue; ! 60: unschedule(e); ! 61: Damage[e->evdata] = 0; ! 62: } ! 63: /* get rid of some devices and redistribute probabilities */ ! 64: i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK]; ! 65: Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0; ! 66: for (j = 0; j < NDEV && i > 0; j++) { ! 67: if (Param.damprob[j] != 0) ! 68: { ! 69: Param.damprob[j] =+ 1; ! 70: i =- 1; ! 71: } ! 72: } ! 73: ! 74: /* pick a starbase to restart at */ ! 75: i = ranf(Status.bases); ! 76: Quadx = Base[i].x; ! 77: Quady = Base[i].y; ! 78: /* setup that quadrant */ ! 79: while (1) ! 80: { ! 81: initquad(1); ! 82: Sect[Sectx][Secty] = EMPTY; ! 83: for (i = 0; i < 5; i++) ! 84: { ! 85: Sectx = Starbase.x + ranf(3) - 1; ! 86: if (Sectx < 0 || Sectx >= NSECTS) ! 87: continue; ! 88: Secty = Starbase.y + ranf(3) - 1; ! 89: if (Secty < 0 || Secty >= NSECTS) ! 90: continue; ! 91: if (Sect[Sectx][Secty] == EMPTY) ! 92: { ! 93: Sect[Sectx][Secty] = QUEENE; ! 94: dock(); ! 95: compkldist(0); ! 96: return; ! 97: } ! 98: } ! 99: } ! 100: } ! 101: ! 102: ! 103: getqname(q) ! 104: QUAD *q; ! 105: { ! 106: register int i; ! 107: ! 108: i = q->systemname; ! 109: if(i&Q_DISTRESS) ! 110: i=Event[i&Q_STARNAME].evdata; ! 111: return(i); ! 112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.