Mercurial > ~darius > hgwebdir.cgi > paradise_client
comparison defaults.c @ 1:ff5e05767bd3 ALPHA
Empty changelog
author | darius |
---|---|
date | Sat, 06 Dec 1997 05:41:28 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d17661b1e221 | 1:ff5e05767bd3 |
---|---|
1 /* $Id: defaults.c,v 1.1.1.1 1997/12/06 05:41:28 darius Exp $ */ | |
2 | |
3 /* defaults.c | |
4 * | |
5 * Kevin P. Smith 6/11/89 | |
6 * Bill Dyess 9/29/93 - moved all default settings to resetDefaults | |
7 * from main | |
8 * Bill Dyess 11/8/93 - created expandFilename function | |
9 * Bill Dyess 11/20/93 - added #include capability | |
10 */ | |
11 #include "copyright2.h" | |
12 #include <stdio.h> | |
13 #ifdef hpux | |
14 #include <time.h> | |
15 #else | |
16 #include <sys/time.h> | |
17 #endif | |
18 #ifdef __STDC__ | |
19 #include <stdlib.h> | |
20 #endif | |
21 #include<ctype.h> | |
22 #include<pwd.h> | |
23 #include <string.h> | |
24 #include <stdlib.h> | |
25 #include "Wlib.h" | |
26 #include "defs.h" | |
27 #include "struct.h" | |
28 #include "data.h" | |
29 #include "proto.h" | |
30 | |
31 #define MAXLINE 1024 | |
32 | |
33 /* list of files to search for [BDyess] */ | |
34 static char *filelist[] = {".paradiserc",".netrekrc",".xtrekrc",NULL}; | |
35 | |
36 /* Prototypes */ | |
37 static FILE *findDefaults P((char *home, char **deffile, char *base)); | |
38 | |
39 char * | |
40 expandFilename(filename) | |
41 char *filename; | |
42 /* expands ~ (home dir) and environment vars in filenames. This is primarily | |
43 for filenames specified in the .xtrekrc file, where the shell never gets | |
44 a chance to expand them. [BDyess] */ | |
45 { | |
46 char buf[MAXLINE], *src = filename, *dest = buf, tmpbuf[MAXLINE], | |
47 *tmppntr, *envpntr; | |
48 struct passwd *pw; | |
49 | |
50 if (!src) | |
51 return filename; | |
52 while (*src) { | |
53 if (*src == '~') { | |
54 src++; | |
55 if (*src != '/' && *src) { /* ~username */ | |
56 tmppntr = tmpbuf; | |
57 while (isalpha(*src)) | |
58 *tmppntr++ = *src++; | |
59 *tmppntr = 0; | |
60 pw = getpwnam(tmpbuf); | |
61 if (!pw) { | |
62 fprintf(stderr, "Error: can't find username %s, inserting ~ literally.\n", tmpbuf); | |
63 *dest++ = '~'; | |
64 strcpy(dest, tmpbuf); | |
65 } else | |
66 strcpy(dest, pw->pw_dir); | |
67 } else { /* just ~, insert $HOME */ | |
68 envpntr = getenv("HOME"); | |
69 if (envpntr != NULL) | |
70 strcpy(dest, envpntr); | |
71 else | |
72 printf("HOME environment variable missing, ignoring ~.\n"); | |
73 } | |
74 while (*dest) | |
75 dest++; | |
76 } else if (*src == '$') { | |
77 /* copy the shortest env var that matches */ | |
78 /* if in {}'s, the work is done for us */ | |
79 src++; | |
80 if (*src == '{') { | |
81 src++; | |
82 tmppntr = tmpbuf; | |
83 while (*src != '}' && *src) | |
84 *tmppntr++ = *src; | |
85 *tmppntr = 0; | |
86 envpntr = getenv(tmpbuf); | |
87 if (envpntr) | |
88 strcpy(dest, getenv(tmpbuf)); | |
89 while (*dest) | |
90 dest++; | |
91 } else if (*src) { /* we have to work */ | |
92 tmppntr = tmpbuf; | |
93 *tmppntr++ = *src++; | |
94 *tmppntr = 0; | |
95 while (!getenv(tmpbuf) && *src) { | |
96 *tmppntr++ = *src++; | |
97 *tmppntr = 0; | |
98 } | |
99 if (*src) | |
100 strcpy(dest, getenv(tmpbuf)); | |
101 while (*dest) | |
102 dest++; | |
103 } | |
104 } else if (*src == '\\') { /* escaped char */ | |
105 src++; | |
106 if (*src) | |
107 *dest++ = *src++; | |
108 } else { /* just a regular char */ | |
109 *dest++ = *src++; | |
110 } | |
111 } | |
112 *dest = 0; | |
113 dest = (char *) realloc(filename, strlen(buf) + 1); | |
114 strcpy(dest, buf); | |
115 return dest; | |
116 } | |
117 | |
118 void | |
119 freeDefaults() | |
120 { | |
121 struct stringlist *tmp; | |
122 while (defaults) { | |
123 tmp = defaults; | |
124 defaults = defaults->next; | |
125 free(tmp->string); | |
126 free(tmp->value); | |
127 free(tmp); | |
128 } | |
129 } | |
130 | |
131 char * | |
132 initDefaults(deffile) | |
133 char *deffile; /* As opposed to defile? */ | |
134 { | |
135 FILE *fp; | |
136 char buf[MAXLINE]; | |
137 char *includeFile; | |
138 char *home; | |
139 char *v, *r; | |
140 struct stringlist *new; | |
141 int ok, i; | |
142 int skip = 0; | |
143 | |
144 /* if(defaults) freeDefaults(); */ | |
145 if (!deffile) { | |
146 deffile = (char *) malloc(256); | |
147 home = getenv("HOME"); | |
148 #ifdef AMIGA | |
149 /* | |
150 This is VERY MISLEADING. Really want to say home="netrek:" but | |
151 that causes other problems. ixemul.library will translate | |
152 "/netrek" into "netrek:" Unless configured not to. Does by | |
153 default. Yuck, what a mess. -JR | |
154 */ | |
155 if (!home) | |
156 home = "/netrek"; | |
157 #endif /* AMIGA */ | |
158 for(i = 0;filelist[i];i++) { | |
159 /* home == NULL means search the current directory [BDyess] */ | |
160 fp = findDefaults(NULL, &deffile, filelist[i]); | |
161 if(fp) break; | |
162 fp = findDefaults(home, &deffile, filelist[i]); | |
163 if(fp) break; | |
164 } | |
165 } else { | |
166 fp = fopen(deffile, "r"); | |
167 } | |
168 #ifdef SYS_RC | |
169 if (!fp) { | |
170 fp = fopen(SYS_RC, "r"); | |
171 if (!fp) | |
172 return deffile; | |
173 printf("Using %s as defaults file.\n", SYS_RC); | |
174 } else { | |
175 printf("Using %s as defaults file.\n", deffile); | |
176 } | |
177 #else | |
178 if (!fp) | |
179 return deffile; | |
180 #endif | |
181 printf("Reading defaults from %s.\n", deffile); | |
182 while (fgets(buf, MAXLINE - 1, fp)) { | |
183 if (skip) { | |
184 skip = strncmpi(buf, "paradise-include", 16); | |
185 continue; | |
186 } else { | |
187 skip = !strncmpi(buf, "paradise-exclude", 16); | |
188 if (skip) | |
189 continue; | |
190 } | |
191 /* if (*buf=='#' || *buf==';') continue; */ | |
192 v = buf; | |
193 if (*buf == '#') { | |
194 if (strncmpi(buf + 1, "include", 7) == 0) { /* #include statement */ | |
195 v = buf + 8; | |
196 ok = 0; | |
197 while (*v == ' ' || *v == '<' || *v == '"') { | |
198 if (*v != ' ') | |
199 ok = 1; | |
200 v++; | |
201 } | |
202 if (!ok) | |
203 continue; /* must have " or < before filename */ | |
204 includeFile = strdup(v); | |
205 r = includeFile + strlen(includeFile) - 1; | |
206 *r = 0; /* remove trailing \n */ | |
207 r--; | |
208 ok = 0; | |
209 while ((*r == '"' || *r == '>' || *r == ' ') && r > includeFile) { | |
210 if (*r != ' ') | |
211 ok = 1; | |
212 *r = 0; | |
213 r--; | |
214 } | |
215 if (!ok || r <= includeFile) | |
216 continue; /* if no ending '>' or '"' */ | |
217 /* or no filename, forget it */ | |
218 includeFile = expandFilename(includeFile); | |
219 initDefaults(includeFile); /* recursively add the file */ | |
220 free(includeFile); | |
221 } | |
222 continue; | |
223 } | |
224 if (*buf != 0) | |
225 buf[strlen(buf) - 1] = 0; | |
226 while (*v != ':' && *v != 0) { | |
227 v++; | |
228 } | |
229 if (*v == 0) | |
230 continue; | |
231 *v = 0; | |
232 v++; | |
233 while (*v == ' ' || *v == '\t') { | |
234 v++; | |
235 } | |
236 if (*v != 0) { | |
237 new = (struct stringlist *) malloc(sizeof(struct stringlist)); | |
238 new->next = defaults; | |
239 if(defaults) | |
240 defaults->prev=new; | |
241 new->prev = NULL; | |
242 new->string = strdup(buf); | |
243 new->value = strdup(v); | |
244 new->searched = 0; | |
245 defaults = new; | |
246 } | |
247 } | |
248 fclose(fp); | |
249 return deffile; | |
250 } | |
251 | |
252 #if 0 | |
253 char * | |
254 strdup(str) | |
255 char *str; | |
256 { | |
257 char *s; | |
258 | |
259 s = (char *) malloc(strlen(str) + 1); | |
260 strcpy(s, str); | |
261 return (s); | |
262 } | |
263 #endif | |
264 | |
265 /* changed to search the entire defaults list once instead of as many as | |
266 three times. This is faster unless you have a "default.nickname:" entry | |
267 for almost every default on every server... -JR */ | |
268 | |
269 char * | |
270 getdefault(str) | |
271 char *str; | |
272 { | |
273 struct stringlist *slNick=0, *slFlavor=0, *slNorm=0, *sl; | |
274 char tempNick[80], tempFlavor[80]; | |
275 char *val; | |
276 | |
277 if (!str) | |
278 return NULL; | |
279 if (!strlen(str)) | |
280 return NULL; | |
281 | |
282 if (defNickName) | |
283 sprintf(tempNick, "%s.%s", str, defNickName); | |
284 | |
285 if (defFlavor) | |
286 sprintf(tempFlavor, "%s.%s", str, defFlavor); | |
287 | |
288 for(sl=defaults;sl;sl=sl->next) { | |
289 if(defNickName && !strcmpi(sl->string, tempNick)) { | |
290 return sl->value; | |
291 /* in case there's ever a reason to keep searching: */ | |
292 if(!slNick) | |
293 slNick=sl; | |
294 } else if(defFlavor && !strcmpi(sl->string, tempFlavor)) { | |
295 if(!slFlavor) | |
296 slFlavor = sl; | |
297 } | |
298 | |
299 if (!strcmpi(sl->string, str)) { | |
300 if(!slNorm) | |
301 slNorm = sl; | |
302 } | |
303 } | |
304 if(slNick) | |
305 return slNick->value; | |
306 if(slFlavor) | |
307 return slFlavor->value; | |
308 if(slNorm) | |
309 return slNorm->value; | |
310 | |
311 return (NULL); | |
312 } | |
313 | |
314 #if NO_STRCMPI && !defined(sgi) | |
315 int | |
316 strcmpi(str1, str2) | |
317 char *str1, *str2; | |
318 { | |
319 for (;;) { | |
320 register char c1 = *str1, c2 = *str2; | |
321 if (c1 <= 'z' && c1 >= 'a') | |
322 c1 += 'A' - 'a'; | |
323 if (c2 <= 'z' && c2 >= 'a') | |
324 c2 += 'A' - 'a'; | |
325 if (c1 != c2) | |
326 return (c2 - c1); | |
327 if (c1 == 0 || c2 == 0) | |
328 return (0); | |
329 str1++; | |
330 str2++; | |
331 } | |
332 return (strcmp(str1, str2)); | |
333 } | |
334 #endif | |
335 | |
336 #if NO_STRNCMPI && !defined(sgi) | |
337 int | |
338 strncmpi(str1, str2, len) | |
339 char *str1, *str2; | |
340 int len; | |
341 { | |
342 int i; | |
343 | |
344 for (i = 0; i < len; i++) { | |
345 if (tolower(*str1) != tolower(*str2)) | |
346 return (*str2 - *str1); | |
347 if (*str1 == 0 || *str2 == 0) | |
348 return (0); | |
349 str1++; | |
350 str2++; | |
351 } | |
352 return 0; | |
353 } | |
354 #endif | |
355 | |
356 int | |
357 booleanDefault(def, preferred) | |
358 char *def; | |
359 int preferred; | |
360 { | |
361 char *str; | |
362 | |
363 str = getdefault(def); | |
364 if (str == NULL) | |
365 return (preferred); | |
366 if (!strcmpi(str, "on") || !strcmpi(str, "true") || !strcmpi(str, "1")) { | |
367 return (1); | |
368 } else { | |
369 return (0); | |
370 } | |
371 } | |
372 | |
373 int | |
374 intDefault(def, preferred) | |
375 char *def; | |
376 int preferred; | |
377 { | |
378 char *str; | |
379 | |
380 str = getdefault(def); | |
381 if (!str) | |
382 return preferred; | |
383 return atoi(str); | |
384 } | |
385 | |
386 /* gets the default for the given def and returns it if it exists. | |
387 Otherwise returns a fresh copy of the preferred string */ | |
388 char * | |
389 stringDefault(def, preferred) | |
390 char *def; | |
391 char *preferred; | |
392 { | |
393 char *str; | |
394 | |
395 str = getdefault(def); | |
396 if (!str) | |
397 return strdup(preferred); | |
398 return strdup(str); | |
399 } | |
400 | |
401 /* no default file given on command line. | |
402 See if serverName is defined. If it exists we look for | |
403 HOME/.xtrekrc-<serverName> and .xtrekrc-<serverName> | |
404 Otherwise we try DEFAULT_SERVER. */ | |
405 /* modified to accept .paradiserc (or any base filename) 12/21/93 [BDyess] */ | |
406 /* extended to check for for unadorned base and to return a fp [BDyess] */ | |
407 | |
408 static FILE * | |
409 findDefaults(home, deffile, base) | |
410 char *home, **deffile, *base; | |
411 { | |
412 FILE *fp; | |
413 | |
414 /* check base-serverName */ | |
415 if (serverName) { | |
416 if (home) | |
417 sprintf(*deffile, "%s/%s-%s", home, base, serverName); | |
418 else | |
419 sprintf(*deffile, "%s-%s", base, serverName); | |
420 fp = fopen(*deffile, "r"); | |
421 if (fp) | |
422 return fp; | |
423 } | |
424 /* check base-DEFAULT_SERVER */ | |
425 if (home) | |
426 sprintf(*deffile, "%s/%s-%s", home, base, DEFAULT_SERVER); | |
427 else | |
428 sprintf(*deffile, "%s-%s", base, DEFAULT_SERVER); | |
429 fp = fopen(*deffile, "r"); | |
430 if (fp) | |
431 return fp; | |
432 | |
433 /* check just base */ | |
434 if (home) | |
435 sprintf(*deffile, "%s/%s", home, base); | |
436 else | |
437 strcpy(*deffile, base); | |
438 fp = fopen(*deffile, "r"); | |
439 return fp; | |
440 } | |
441 | |
442 /* default ship code, courtesy of Robert Blackburn <blackburn@Virginia.EDU>. | |
443 used by main(), modified to accept 2 letter initials 11/15/91 TC */ | |
444 /* modified to accept pt/ut's 10/10/93 [BDyess] */ | |
445 | |
446 int | |
447 defaultShip(preferred) | |
448 int preferred; | |
449 { | |
450 char *type; | |
451 | |
452 type = getdefault("defaultship"); | |
453 if (type == NULL) | |
454 return preferred; | |
455 if ((strcmpi(type, "scout") == 0) || (strcmpi(type, "SC") == 0)) | |
456 return SCOUT; | |
457 else if ((strcmpi(type, "destroyer") == 0) || (strcmpi(type, "DD") == 0)) | |
458 return DESTROYER; | |
459 else if ((strcmpi(type, "cruiser") == 0) || (strcmpi(type, "CA") == 0)) | |
460 return CRUISER; | |
461 else if ((strcmpi(type, "battleship") == 0) || (strcmpi(type, "BB") == 0)) | |
462 return BATTLESHIP; | |
463 else if ((strcmpi(type, "assault") == 0) || (strcmpi(type, "AS") == 0)) | |
464 return ASSAULT; | |
465 else if ((strcmpi(type, "starbase") == 0) || (strcmpi(type, "SB") == 0)) | |
466 return STARBASE; | |
467 else if ((strcmpi(type, "jumpship") == 0) || (strcmpi(type, "JS") == 0)) | |
468 return JUMPSHIP; | |
469 else if ((strcmpi(type, "warbase") == 0) || (strcmpi(type, "WB") == 0)) | |
470 return WARBASE; | |
471 else if ((strcmpi(type, "flagship") == 0) || (strcmpi(type, "FL") == 0)) | |
472 return FLAGSHIP; | |
473 else if ((strcmpi(type, "lightcruiser") == 0) || (strcmpi(type, "CL") == 0)) | |
474 return LIGHTCRUISER; | |
475 else if ((strcmpi(type, "carrier") == 0) || (strcmpi(type, "CV") == 0)) | |
476 return CARRIER; | |
477 else if ((strcmpi(type, "patrol") == 0) || (strcmpi(type, "PT") == 0)) | |
478 return PATROL; | |
479 else if ((strcmpi(type, "utility") == 0) || (strcmpi(type, "UT") == 0)) | |
480 return UTILITY; | |
481 else | |
482 return preferred; | |
483 } | |
484 | |
485 void | |
486 initLogFile() | |
487 { | |
488 if (logFile && logmess) { | |
489 logfilehandle = fopen(logFile, "a"); | |
490 if (!logfilehandle) { | |
491 fprintf(stderr, "Can't open %s: ", logFile); | |
492 perror(""); | |
493 logFile = NULL; | |
494 } else { | |
495 printf("Opening %s for logging\n", logFile); | |
496 fprintf(logfilehandle, "\n-----------------------------------------------------------------\nStarted logging for server %s at%s\n-----------------------------------------------------------------\n", | |
497 serverName, timeString(time(NULL))); | |
498 } | |
499 } | |
500 } | |
501 | |
502 void | |
503 resetDefaults() | |
504 { | |
505 char *buf; | |
506 #ifdef AUTHORIZE | |
507 if (RSA_Client >= 0) | |
508 RSA_Client = booleanDefault("useRSA", RSA_Client); | |
509 else | |
510 RSA_Client = (RSA_Client == -2); | |
511 #endif | |
512 | |
513 | |
514 showShields = booleanDefault("showshields", showShields); | |
515 showStats = booleanDefault("showstats", showStats); | |
516 keeppeace = booleanDefault("keeppeace", keeppeace); | |
517 reportKills = booleanDefault("reportkills", reportKills); | |
518 #if 0 | |
519 blk_altbits = booleanDefault("altbitmaps", blk_altbits); | |
520 #endif | |
521 blk_showStars = booleanDefault("showstars", blk_showStars); | |
522 showMySpeed = booleanDefault("showMySpeed", showMySpeed); | |
523 showTractorPressor = booleanDefault("showTractorPressor", | |
524 showTractorPressor); | |
525 /* show all tractor/pressor beams, not just your own [BDyess] */ | |
526 showAllTractorPressor = booleanDefault("showAllTractorPressor", | |
527 showAllTractorPressor); | |
528 showLock = intDefault("showLock", showLock); | |
529 drawgrid = booleanDefault("showgrid", drawgrid); | |
530 showgalactic = intDefault("showgalactic", showgalactic); | |
531 showlocal = intDefault("showlocal", showlocal); | |
532 namemode = booleanDefault("namemode", namemode); | |
533 | |
534 Dashboard = booleanDefault("newDashboard", Dashboard); | |
535 cup_half_full = booleanDefault("newDashboard2", cup_half_full); | |
536 if (cup_half_full) | |
537 Dashboard = 2; | |
538 Dashboard = intDefault("Dashboard", Dashboard); | |
539 | |
540 unixSoundPath = stringDefault("soundPath", "?"); | |
541 unixSoundDev = stringDefault("soundDev", "?"); | |
542 | |
543 cloakchars = stringDefault("cloakchars", "??"); | |
544 cloakcharslen = strlen(cloakchars); | |
545 | |
546 showPhaser = intDefault("showPhaser", showPhaser); | |
547 logmess = booleanDefault("logging", logmess); | |
548 logFile = getdefault("logfile"); | |
549 if(logFile) | |
550 logFile=expandFilename(strdup(logFile)); | |
551 | |
552 initLogFile(); | |
553 #ifdef VARY_HULL | |
554 vary_hull = booleanDefault("warnhull", vary_hull); | |
555 #endif /* VARY_HULL */ | |
556 | |
557 #ifdef TOOLS | |
558 shelltools = booleanDefault("shellTools", shelltools); | |
559 #endif | |
560 warpStreaks = booleanDefault("warpStreaks", warpStreaks); | |
561 use_msgw = booleanDefault("useMsgw", use_msgw); | |
562 logPhaserMissed = booleanDefault("logPhaserMissed", logPhaserMissed); | |
563 phaserStats = booleanDefault("phaserStats", phaserStats); | |
564 jubileePhasers = booleanDefault("jubileePhasers", jubileePhasers); | |
565 show_shield_dam = booleanDefault("showShieldDam", show_shield_dam); | |
566 updateSpeed = intDefault("udpupdates", updateSpeed); | |
567 updateSpeed = intDefault("updatespersecond", updateSpeed); | |
568 updateSpeed = intDefault("updatespersec", updateSpeed); | |
569 extraBorder = booleanDefault("extraAlertBorder", extraBorder); | |
570 if (booleanDefault("galacticfrequent", 0)) | |
571 mapmode = GMAP_FREQUENT; | |
572 #ifdef CONTINUOUS_MOUSE | |
573 continuousMouse = booleanDefault("continuousMouse", continuousMouse); | |
574 if (continuousMouse) | |
575 buttonRepeatMask = 1 << W_LBUTTON | 1 << W_RBUTTON | 1 << W_MBUTTON; | |
576 clickDelay = intDefault("clickDelay", clickDelay); | |
577 if (booleanDefault("continuousMouse.L", 0)) | |
578 buttonRepeatMask |= 1 << W_LBUTTON; | |
579 if (booleanDefault("continuousMouse.M", 0)) | |
580 buttonRepeatMask |= 1 << W_MBUTTON; | |
581 if (booleanDefault("continuousMouse.R", 0)) | |
582 buttonRepeatMask |= 1 << W_RBUTTON; | |
583 if (buttonRepeatMask) | |
584 continuousMouse = 1; | |
585 #endif /* CONTINUOUS_MOUSE */ | |
586 autoQuit = intDefault("autoQuit", autoQuit); | |
587 if (autoQuit > 199) { | |
588 autoQuit = 199; | |
589 printf("autoQuit reduced to 199\n"); | |
590 } | |
591 pigSelf = booleanDefault("pigSelf", pigSelf); | |
592 /* info icon shows info in place of the icon bitmap [BDyess] */ | |
593 infoIcon = booleanDefault("infoIcon", infoIcon); | |
594 showGalacticSequence = stringDefault("showGalacticSequence", "012345"); | |
595 for (buf = showGalacticSequence; *buf; buf++) { | |
596 if (*buf - '0' > 5) { | |
597 fprintf(stderr, "Error in showGalacticSequence: %d too high, ignoring\n", *buf); | |
598 free(showGalacticSequence); | |
599 showGalacticSequence = strdup("012345"); | |
600 break; | |
601 } | |
602 } | |
603 showLocalSequence = stringDefault("showLocalSequence", "01234"); | |
604 for (buf = showLocalSequence; *buf; buf++) { | |
605 if (*buf - '0' > 4) { | |
606 fprintf(stderr, "Error in showLocalSequence: %d too high, ignoring\n", *buf); | |
607 free(showLocalSequence); | |
608 showLocalSequence = strdup("01234"); | |
609 break; | |
610 } | |
611 } | |
612 | |
613 #ifdef ATM | |
614 udpDebug = booleanDefault("udpDebug", udpDebug); | |
615 udpClientSend = intDefault("udpClientSend", udpClientSend); | |
616 /* note: requires send */ | |
617 udpClientRecv = intDefault("udpClientReceive", udpClientRecv); | |
618 tryUdp = booleanDefault("tryUdp", tryUdp); | |
619 udpSequenceChk = booleanDefault("udpSequenceCheck", udpSequenceChk); | |
620 #endif /* ATM */ | |
621 | |
622 tryShort = booleanDefault("tryShort", tryShort); /* auto-try S_P [BDyess] */ | |
623 | |
624 /* playerlist settings */ | |
625 robsort = booleanDefault("robsort", robsort); | |
626 sortPlayers = booleanDefault("sortPlayers", sortPlayers); | |
627 hideNoKills = booleanDefault("hidenokills", hideNoKills); | |
628 showDead = booleanDefault("showDead", showDead); | |
629 showPreLogins = booleanDefault("showPreLogins", showPreLogins); | |
630 sortOutfitting = booleanDefault("sortOutfitting", sortOutfitting); | |
631 timerType = intDefault("timertype", timerType); | |
632 #ifdef WIDE_PLIST | |
633 /* | |
634 default: old playerlist (ie, no format string), number shiptype rank | |
635 name kills wins losses ratio offense defense di, number shiptype name | |
636 kills login ratio totalrating di [BDyess] | |
637 */ | |
638 playerListStart = stringDefault("playerList", | |
639 ",nTRNKWLr O D d,nTR N K lrSd"); | |
640 playerList = playerListStart; | |
641 resizePlayerList = booleanDefault("resizePlayerList",resizePlayerList); | |
642 #endif /* WIDE_PLIST */ | |
643 | |
644 #ifdef PACKET_LIGHTS | |
645 packetLights = booleanDefault("packetLights", packetLights); | |
646 #endif /* PACKET_LIGHTS */ | |
647 | |
648 viewBox = booleanDefault("viewBox", viewBox); | |
649 sectorNums = booleanDefault("sectorNums", sectorNums); | |
650 lockLine = booleanDefault("lockLine", lockLine); | |
651 mapSort = booleanDefault("mapSort", mapSort); | |
652 autoSetWar = intDefault("autoSetWar", autoSetWar); | |
653 tacPlanetInfo = intDefault("tacPlanetInfo", tacPlanetInfo); | |
654 | |
655 /* metaFork = booleanDefault("metaFork",metaFork); */ | |
656 | |
657 keepInfo = intDefault("keepInfo", keepInfo); | |
658 | |
659 #ifdef NOWARP | |
660 /* if there are alternatives to message warp, use it anyway? -JR */ | |
661 warp = booleanDefault("messageWarp", warp); | |
662 #endif | |
663 | |
664 #ifdef CHECK_DROPPED | |
665 reportDroppedPackets = booleanDefault("reportDroppedPackets", reportDroppedPackets); | |
666 #endif | |
667 | |
668 askforUpdate = booleanDefault("askforUpdate", askforUpdate); | |
669 lowercaset = booleanDefault("lowercaset", lowercaset); | |
670 scrollBeep = booleanDefault("scrollBeep", scrollBeep); | |
671 #ifdef SHORT_PACKETS | |
672 godToAllOnKills = booleanDefault("godToAllOnKills",godToAllOnKills); | |
673 #endif | |
674 | |
675 autoZoom=intDefault("autoZoom", autoZoom); | |
676 autoUnZoom = intDefault("autoUnZoom",autoUnZoom); | |
677 autoZoomOverride = intDefault("autoZoomOverride",autoZoomOverride); | |
678 | |
679 #ifdef BEEPLITE | |
680 { | |
681 DefLite = booleanDefault("DefLite", DefLite); | |
682 UseLite = booleanDefault("UseLite", UseLite); | |
683 | |
684 if (DefLite) | |
685 litedefaults(); | |
686 | |
687 beep_lite_cycle_time_planet = intDefault("planetCycleTime", | |
688 beep_lite_cycle_time_planet); | |
689 beep_lite_cycle_time_player = intDefault("playerCycleTime", | |
690 beep_lite_cycle_time_player); | |
691 } | |
692 #endif /* BEEPLITE */ | |
693 | |
694 #ifdef COW_HAS_IT_WHY_SHOULDNT_WE | |
695 showMapAtMotd = booleanDefault("showMapAtMotd",showMapAtMotd); | |
696 #endif | |
697 | |
698 #ifdef LOCAL_SHIPSTATS | |
699 localShipStats=booleanDefault("localShipStats",localShipStats); | |
700 statString = stringDefault("statString","DSEWF"); | |
701 statHeight = intDefault("statHeight",statHeight); | |
702 if(statHeight<4) statHeight=4; | |
703 if(statHeight>100) statHeight = 100; | |
704 localStatsX = intDefault("localStatsX", localStatsX); | |
705 localStatsY = intDefault("localStatsY", localStatsY); | |
706 #endif | |
707 | |
708 #ifdef SHOW_IND | |
709 showIND = booleanDefault("showIND",showIND); | |
710 #endif | |
711 | |
712 #ifdef HOCKEY | |
713 galacticHockeyLines = booleanDefault("galacticHockeyLines", | |
714 galacticHockeyLines); | |
715 tacticalHockeyLines = booleanDefault("tacticalHockeyLines", | |
716 tacticalHockeyLines); | |
717 cleanHockeyGalactic = booleanDefault("cleanHockeyGalactic", | |
718 cleanHockeyGalactic); | |
719 teamColorHockeyLines = booleanDefault("teamColorHockeyLines", | |
720 teamColorHockeyLines); | |
721 #endif /*HOCKEY*/ | |
722 | |
723 #ifdef AMIGA | |
724 getAmigaDefs(); | |
725 #endif | |
726 | |
727 #ifdef SOUND | |
728 getSoundDefs(); | |
729 #endif | |
730 | |
731 redrawDelay = intDefault("redrawDelay",redrawDelay); | |
732 | |
733 initkeymap(-1); | |
734 #ifdef MACROS | |
735 initMacros(); | |
736 #endif /* MACROS */ | |
737 | |
738 /* | |
739 sendOptionsPacket(); | |
740 *//* There is nothing on the server side that should be controlled by | |
741 xtrekrc variables. */ | |
742 } |