1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32: #include <sys/cdefs.h>
33: #ifndef lint
34: #if 0
35: static char sccsid[] = "@(#)abandon.c 8.1 (Berkeley) 5/31/93";
36: #else
37: __RCSID("$NetBSD: abandon.c,v 1.6 2003/08/07 09:37:49 agc Exp $");
38: #endif
39: #endif
40:
41: #include <stdio.h>
42: #include "trek.h"
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70: void
71: abandon(v)
72: int v __attribute__((__unused__));
73: {
74: struct quad *q;
75: int i;
76: int j;
77: struct event *e;
78:
79: if (Ship.ship == QUEENE) {
80: printf("You may not abandon ye Faire Queene\n");
81: return;
82: }
83: if (Ship.cond != DOCKED)
84: {
85: if (damaged(SHUTTLE)) {
86: out(SHUTTLE);
87: return;
88: }
89: printf("Officers escape in shuttlecraft\n");
90:
91: q = &Quad[Ship.quadx][Ship.quady];
92: if (q->qsystemname == 0 || damaged(XPORTER))
93: {
94: printf("Entire crew of %d left to die in outer space\n",
95: Ship.crew);
96: Game.deaths += Ship.crew;
97: }
98: else
99: {
100: printf("Crew beams down to planet %s\n", systemname(q));
101: }
102: }
103:
104: if (Now.bases == 0 || Game.captives < 20 * Game.skill)
105: lose(L_CAPTURED);
106:
107: printf("You are hereby put in charge of an antiquated but still\n");
108: printf(" functional ship, the Fairie Queene.\n");
109: Ship.ship = QUEENE;
110: Ship.shipname = "Fairie Queene";
111: Param.energy = Ship.energy = 3000;
112: Param.torped = Ship.torped = 6;
113: Param.shield = Ship.shield = 1250;
114: Ship.shldup = 0;
115: Ship.cloaked = 0;
116: Ship.warp = 5.0;
117: Ship.warp2 = 25.0;
118: Ship.warp3 = 125.0;
119: Ship.cond = GREEN;
120:
121: for (i = 0; i < MAXEVENTS; i++)
122: {
123: e = &Event[i];
124: if (e->evcode != E_FIXDV)
125: continue;
126: unschedule(e);
127: }
128:
129: i = Param.damprob[SHUTTLE] + Param.damprob[CLOAK];
130: Param.damprob[SHUTTLE] = Param.damprob[CLOAK] = 0;
131: while (i > 0)
132: for (j = 0; j < NDEV; j++)
133: {
134: if (Param.damprob[j] != 0)
135: {
136: Param.damprob[j] += 1;
137: i--;
138: if (i <= 0)
139: break;
140: }
141: }
142:
143: i = ranf(Now.bases);
144: Ship.quadx = Now.base[i].x;
145: Ship.quady = Now.base[i].y;
146:
147: while (1)
148: {
149: initquad(1);
150: Sect[Ship.sectx][Ship.secty] = EMPTY;
151: for (i = 0; i < 5; i++)
152: {
153: Ship.sectx = Etc.starbase.x + ranf(3) - 1;
154: if (Ship.sectx < 0 || Ship.sectx >= NSECTS)
155: continue;
156: Ship.secty = Etc.starbase.y + ranf(3) - 1;
157: if (Ship.secty < 0 || Ship.secty >= NSECTS)
158: continue;
159: if (Sect[Ship.sectx][Ship.secty] == EMPTY)
160: {
161: Sect[Ship.sectx][Ship.secty] = QUEENE;
162: dock(0);
163: compkldist(0);
164: return;
165: }
166: }
167: }
168: }