annotate src/robotII.c @ 18:1424868939a8

Indenting
author darius
date Wed, 24 Dec 1997 12:38:35 +0000
parents 8c6d5731234d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
1 /*--------------------------------------------------------------------------
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
2 NETREK II -- Paradise
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
3
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
4 Permission to use, copy, modify, and distribute this software and its
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
6 purpose and without fee is hereby granted, provided that this copyright
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
7 notice appear in all copies. No representations are made about the
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
8 suitability of this software for any purpose. This software is provided
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
9 "as is" without express or implied warranty.
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
10
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
11 Xtrek Copyright 1986 Chris Guthrie
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
13 Scott Silvey
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
15 Kurt Olsen
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
16 Brandon Gillespie
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
17 --------------------------------------------------------------------------*/
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
18
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
19 char binary[] = "@(#)robotII";
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
20
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
21 #include "config.h"
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
22
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
23 #include <stdio.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
24 #include <sys/types.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
25 #include <sys/time.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
26 #include <sys/stat.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
27 #include <sys/file.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
28 #ifndef ULTRIX
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
29 #include <sys/fcntl.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
30 #endif
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
31 #include <signal.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
32 #include <setjmp.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
33 #include <errno.h>
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
34 #include "defs.h"
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
35 #include "struct.h"
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
36 #include "data.h"
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
37 #include "shmem.h"
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
38
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
39 extern void (*r_signal()) ();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
40
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
41 void config();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
42
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
43 struct itimerval udt;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
44 extern int redrawall; /* maint: missing "extern" 6/22/92 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
45 extern int lastm; /* maint: missing "extern" 6/22/92 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
46
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
47 /* This lets you specify which ships a robot is allowed to choose */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
48 int robotships[NUM_TYPES] = {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
49 1, /* SCOUT */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
50 1, /* DESTROYER */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
51 1, /* CRUISER */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
52 1, /* BATTLESHIP */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
53 1, /* ASSAULT */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
54 0, /* STARBASE */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
55 0, /* ATT */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
56 0, /* JUMPSHIP */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
57 1, /* FRIGATE */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
58 0, /* WARBASE */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
59 1, /* LIGHTCRUISER */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
60 0, /* CARRIER */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
61 0, /* UTILITY */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
62 1 /* PATROL */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
63 };
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
64
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
65 /* lots of neat flags */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
66 int hostile;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
67 int debug;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
68 int level;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
69 int fleet;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
70 int sticky;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
71 int berserk;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
72 int practice;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
73 int nofuel;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
74
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
75 int polymorphic; /* match opponent's ship class 8/15/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
76 int target; /* Terminator's target 7/27/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
77 int phrange; /* phaser range 7/31/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
78 int trrange; /* tractor range 8/2/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
79
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
80 int startplanet = -1; /* CRD feature - MAK, 2-Jun-93 */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
81
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
82 /* velocities 8/9/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
83
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
84 int dogslow; /* dodge speed (hard turn) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
85 int dogfast; /* dodge speed (soft turn) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
86 int runslow; /* run speed (flat etemp) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
87 int runfast; /* run speed (gain etemp) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
88 int closeslow; /* approach speed (hard turn) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
89 int closefast; /* approach speed (soft turn) */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
90
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
91 char *rnames[6] = {"M5", "Colossus", "Guardian", "HAL", "DreadPirate Bob",
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
92 "TERMINATOR"};
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
93
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
94 #ifdef ROBOTSTATS
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
95 void
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
96 do_robot_login()
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
97 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
98 int plfd, position, entries, i;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
99 char *path;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
100 struct statentry player;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
101 struct stat buf;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
102
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
103 path = build_path(PLAYERFILE);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
104 plfd = open(path, O_RDONLY, 0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
105 if (plfd < 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
106 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
107 fprintf(stderr, "%s: I cannot open the player file! (errno: %d)\n",
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
108 argv0, errno);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
109 me->p_pos = -1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
110 return;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
111 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
112 position = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
113 while (read(plfd, (char *) &player, sizeof(struct statentry)) ==
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
114 sizeof(struct statentry))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
115 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
116 if (!strcmp(pseudo, player.name))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
117 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
118 close(plfd);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
119 me->p_pos = position;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
120 memcpy(&(me->p_stats), &player.stats, sizeof(struct stats));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
121 return;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
122 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
123 position++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
124 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
125 /* Not in there, so create it */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
126 strcpy(player.name, pseudo);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
127 strcpy(player.password, "*"); /* an invalid password to prevent logins */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
128 memset(&player.stats, 0, sizeof(struct stats));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
129 player.stats.st_tticks = 1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
130 player.stats.st_flags = ST_INITIAL;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
131
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
132 plfd = open(path, O_RDWR | O_CREAT, 0644);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
133 if (plfd < 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
134 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
135 fprintf(stderr, "%s: I cannot open the player file! (errno: %d)\n",
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
136 argv0, errno);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
137 me->p_pos = -1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
138 return;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
139 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
140 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
141 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
142 fstat(plfd, &buf);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
143 entries = buf.st_size / sizeof(struct statentry);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
144 lseek(plfd, entries * sizeof(struct statentry), 0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
145 write(plfd, (char *) &player, sizeof(struct statentry));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
146 close(plfd);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
147 me->p_pos = entries;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
148 memcpy(&(me->p_stats), &player.stats, sizeof(struct stats));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
149 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
150 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
151
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
152 void
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
153 save_robot()
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
154 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
155 int fd;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
156 char *path;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
157
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
158 if (me->p_pos < 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
159 return;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
160 path = build_path(PLAYERFILE);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
161 fd = open(path, O_WRONLY, 0644);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
162 if (fd >= 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
163 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
164 me->p_stats.st_lastlogin = time(NULL);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
165 lseek(fd, 32 + me->p_pos * sizeof(struct statentry), 0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
166 write(fd, (char *) &me->p_stats, sizeof(struct stats));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
167 close(fd);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
168 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
169 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
170 #endif
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
171
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
172 int
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
173 main(argc, argv)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
174 int argc;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
175 char **argv;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
176 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
177 register int i;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
178 int rmove();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
179 int team = -1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
180 int bteam;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
181 int pno;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
182 int class; /* ship class 8/9/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
183
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
184 argv0 = argv[0];
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
185 srand48(time(NULL) + getpid());
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
186
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
187 openmem(0, 0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
188
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
189 for (;;)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
190 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
191 class = lrand48() % NUM_TYPES; /* pick a ship type */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
192 if (robotships[class] && shipsallowed[class])
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
193 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
194 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
195
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
196 target = -1; /* no target 7/27/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
197 for (; argc > 1 && argv[1][0] == '-'; argc--, argv++)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
198 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
199 switch (argv[1][1])
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
200 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
201 case 'S':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
202 startplanet = atoi(&argv[1][2]);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
203 if (startplanet >= configvals->numplanets)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
204 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
205 printf("startplanet insane: %d\n", startplanet);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
206 startplanet = -1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
207 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
208 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
209 case 'F':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
210 nofuel++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
211 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
212 case 'P':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
213 polymorphic++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
214 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
215 case 'f':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
216 fleet++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
217 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
218 case 's':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
219 sticky++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
220 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
221 case 'd':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
222 debug++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
223 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
224 case 'h':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
225 hostile++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
226 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
227 case 'p':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
228 practice++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
229 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
230 case 'b':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
231 berserk++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
232 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
233 case 'l':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
234 if (argv[1][2] != '\0')
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
235 level = atoi(&argv[1][2]);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
236 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
237 level = 100;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
238 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
239 case 'c': /* ship class */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
240 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
241 char cstr[NUM_TYPES + 1];
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
242
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
243 for (class = 0; class <= NUM_TYPES; class++)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
244 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
245 if (class == NUM_TYPES)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
246 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
247 cstr[NUM_TYPES] = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
248 fprintf(stderr, "Unknown ship class, must be one of [%s].\n", cstr);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
249 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
250 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
251 if (argv[1][2] == shipvals[class].s_letter)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
252 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
253 cstr[class] = shipvals[class].s_letter;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
254 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
255 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
256 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
257 case 'T': /* team */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
258 switch (argv[1][2])
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
259 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
260 case 'f':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
261 team = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
262 bteam = FED;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
263 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
264 case 'r':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
265 team = 1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
266 bteam = ROM;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
267 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
268 case 'k':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
269 team = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
270 bteam = KLI;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
271 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
272 case 'o':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
273 team = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
274 bteam = ORI;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
275 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
276 case 'n': /* change 5/10/91 TC neutral */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
277 case 'i':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
278 team = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
279 bteam = FED | ROM | KLI | ORI; /* don't like anybody */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
280 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
281 case 't':
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
282 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
283 char c;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
284 c = argv[1][3];
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
285
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
286 team = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
287 bteam = FED | ROM | KLI | ORI; /* don't like anybody */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
288 target = -1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
289 if (c == '\0')
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
290 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
291 fprintf(stderr, "Must specify target. e.g. -Tt3.\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
292 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
293 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
294 if ((c >= '0') && (c <= '9'))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
295 target = c - '0';
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
296 else if ((c >= 'a') && (c <= 'v'))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
297 target = c - 'a' + 10;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
298 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
299 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
300 fprintf(stderr, "Must specify target. e.g. -Tt3.\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
301 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
302 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
303 } /* end case 't' */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
304 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
305 default:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
306 fprintf(stderr, "Unknown team type. Usage -Tx where x is [frko]\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
307 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
308 } /* end switch argv */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
309 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
310 default:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
311 fprintf(stderr, "Unknown option '%c' (must be one of: bcdfpsFPT)\n", argv[1][1]);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
312 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
313 } /* end switch argv[1][1] */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
314
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
315
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
316 } /* end for */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
317
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
318 if (team < 0 || team >= 6)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
319 { /* change 7/27/91 TC was 4 now 6 */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
320 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
321 fprintf(stderr, "Choosing random team.\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
322 team = lrand48() % 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
323 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
324
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
325 pno = findrslot(); /* Robots are entitled to tester's slots. */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
326 me = &players[pno];
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
327 me->p_no = pno;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
328 myship = &me->p_ship;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
329 mystats = &me->p_stats;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
330 lastm = mctl->mc_current;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
331
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
332 /*
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
333 * At this point we have memory set up. If we aren't a fleet, we don't
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
334 * want to replace any other robots on this team, so we'll check the other
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
335 * players and get out if there are any on our team.
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
336 */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
337
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
338 if (practice)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
339 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
340 strcpy(pseudo, "Hozer");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
341 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
342 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
343 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
344 strcpy(pseudo, rnames[team]);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
345 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
346 strcpy(login, "Robot");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
347
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
348 (void) strncpy(me->p_login, login, sizeof(me->p_login));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
349 me->p_login[sizeof(me->p_login) - 1] = '\0';
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
350 (void) strncpy(me->p_monitor, "Nowhere", sizeof(me->p_monitor));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
351 me->p_monitor[sizeof(me->p_monitor) - 1] = '\0';
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
352
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
353 /* repeat "Nowhere" for completeness 4/13/92 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
354 (void) strncpy(me->p_full_hostname, "Nowhere", sizeof(me->p_full_hostname));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
355 me->p_full_hostname[sizeof(me->p_full_hostname) - 1] = '\0';
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
356
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
357 if (target >= 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
358 { /* hack 7/27/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
359 enter(team, target, pno, class, startplanet);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
360 startplanet = -1; /* Termies should forget about startplanet */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
361 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
362 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
363 startplanet = enter(team, 0, pno, class, startplanet);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
364
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
365 #ifdef ROBOTSTATS
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
366 do_robot_login();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
367 #else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
368 me->p_pos = -1; /* So robot stats don't get saved */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
369 #endif
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
370
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
371 me->p_flags |= PFROBOT; /* Mark as a robot */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
372 if ((berserk) || (team == 4)) /* indeps are hostile */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
373 me->p_hostile = (FED | ROM | KLI | ORI); /* unless they are berserk */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
374 else if (team == 5)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
375 me->p_hostile = 0; /* Termies declare war later */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
376 else if (practice)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
377 me->p_hostile = bteam; /* or practice */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
378 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
379 me->p_hostile = 0; /* robots are peaceful */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
380
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
381 if (practice)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
382 me->p_flags |= PFPRACTR; /* Mark as a practice robot */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
383 r_signal(SIGALRM, rmove);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
384
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
385 config();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
386 if (practice)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
387 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
388 udt.it_interval.tv_sec = 1; /* Robots get to move 1/sec */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
389 udt.it_interval.tv_usec = 000000;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
390 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
391 else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
392 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
393 udt.it_interval.tv_sec = 0; /* Robots get to move 2/sec */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
394 udt.it_interval.tv_usec = 500000;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
395 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
396 udt.it_value.tv_sec = 1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
397 udt.it_value.tv_usec = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
398 if (setitimer(ITIMER_REAL, &udt, 0) < 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
399 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
400 perror("setitimer");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
401 me->p_status = PFREE; /* Put robot in game */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
402 move_player(me->p_no, -1, -1, 1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
403 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
404 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
405 /* allows robots to be forked by the daemon -- Evil ultrix bullshit */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
406 #ifndef SVR4
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
407 sigsetmask(0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
408 #endif /* SVR4 */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
409
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
410 if (team == 4)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
411 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
412 int count = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
413 for (i = 0; i < MAXPLAYER; i++)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
414 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
415 if (players[i].p_status == PALIVE)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
416 count++;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
417 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
418 if (((count <= 1) && (!fleet)) ||
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
419 ((count < 1) && (fleet)))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
420 { /* if one or less players, don't show */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
421 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
422 fprintf(stderr, "No one to hoze.\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
423 players[pno].p_status = PFREE;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
424 move_player(me->p_no, -1, -1, 1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
425 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
426 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
427 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
428 if (!fleet)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
429 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
430 for (i = 0; i < MAXPLAYER; i++)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
431 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
432 if ((players[i].p_status == PALIVE) && (players[i].p_team == bteam))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
433 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
434 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
435 fprintf(stderr, "Galaxy already defended\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
436 players[pno].p_status = PFREE;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
437 move_player(me->p_no, -1, -1, 1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
438 exit(1);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
439 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
440 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
441 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
442 me->p_status = PALIVE; /* Put robot in game */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
443 while (1)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
444 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
445 pause();
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
446 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
447 return 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
448 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
449
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
450 int
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
451 findrslot()
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
452 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
453 register int i;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
454
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
455 #if 0
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
456 for (i = 0; i < MAXPLAYER; i++)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
457 #else
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
458 for (i = MAXPLAYER - 1; i >= 0; i--)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
459 #endif
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
460 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
461 /* reverse entry..let's be trendy 4/6/92 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
462 if (players[i].p_status == PFREE)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
463 { /* We have a free slot */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
464 players[i].p_status = POUTFIT; /* possible race code */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
465 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
466 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
467 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
468 if ((i == MAXPLAYER) || (i == -1))
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
469 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
470 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
471 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
472 fprintf(stderr, "No more room in game\n");
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
473 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
474 exit(0);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
475 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
476 memset(&players[i].p_stats, 0, sizeof(struct stats));
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
477 players[i].p_stats.st_tticks = 1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
478 return (i);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
479 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
480
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
481 void
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
482 warning(mess)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
483 char *mess;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
484 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
485 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
486 fprintf(stderr, "warning: %s\n", mess);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
487 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
488
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
489 void
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
490 config()
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
491 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
492 /* calc class-specific stuff */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
493
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
494 phrange = PHASEDIST * me->p_ship.s_phaser.damage / 100;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
495 trrange = TRACTDIST * me->p_ship.s_tractrng;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
496
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
497 switch (myship->s_type)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
498 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
499 case SCOUT:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
500 dogslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
501 dogfast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
502 runslow = 8;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
503 runfast = 9;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
504 closeslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
505 closefast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
506 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
507 case DESTROYER:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
508 dogslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
509 dogfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
510 runslow = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
511 runfast = 8;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
512 closeslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
513 closefast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
514 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
515 case CRUISER:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
516 dogslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
517 dogfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
518 runslow = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
519 runfast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
520 closeslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
521 closefast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
522 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
523 case BATTLESHIP:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
524 dogslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
525 dogfast = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
526 runslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
527 runfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
528 closeslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
529 closefast = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
530 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
531 case FRIGATE:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
532 dogslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
533 dogfast = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
534 runslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
535 runfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
536 closeslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
537 closefast = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
538 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
539 case ASSAULT:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
540 dogslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
541 dogfast = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
542 runslow = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
543 runfast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
544 closeslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
545 closefast = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
546 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
547 case JUMPSHIP:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
548 dogslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
549 dogfast = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
550 runslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
551 runfast = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
552 closeslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
553 closefast = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
554 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
555 case STARBASE:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
556 dogslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
557 dogfast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
558 runslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
559 runfast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
560 closeslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
561 closefast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
562 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
563 case WARBASE:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
564 dogslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
565 dogfast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
566 runslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
567 runfast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
568 closeslow = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
569 closefast = 2;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
570 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
571 case LIGHTCRUISER:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
572 dogslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
573 dogfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
574 runslow = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
575 runfast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
576 closeslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
577 closefast = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
578 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
579 case CARRIER:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
580 dogslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
581 dogfast = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
582 runslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
583 runfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
584 closeslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
585 closefast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
586 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
587 case UTILITY:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
588 dogslow = 3;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
589 dogfast = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
590 runslow = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
591 runfast = 6;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
592 closeslow = 4;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
593 closefast = 5;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
594 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
595 case PATROL:
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
596 dogslow = 7;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
597 dogfast = 8;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
598 runslow = 9;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
599 runfast = 10;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
600 closeslow = 8;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
601 closefast = 9;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
602 break;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
603 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
604
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
605 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
606 printf("My phaser range: %d.\n", phrange);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
607 if (debug)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
608 printf("My tractor range: %d.\n", trrange);
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
609
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
610 if (!nofuel)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
611 {
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
612 myship->s_phaser.cost = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
613 myship->s_torp.cost = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
614 myship->s_cloakcost = 0;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
615 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
616 if (target >= 0)
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
617 { /* 7/27/91 TC */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
618 myship->s_imp.maxspeed = 20;/* was 10, so you can't run */
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
619 myship->s_imp.cost = 1;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
620 myship->s_egncoolrate = 100;
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
621 }
8c6d5731234d First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
622 }