annotate pped/main.c @ 19:de685799a432

Made torps wobbly when going through nebulous terrain. Only happens if nebula_effect contains photon.
author darius
date Wed, 24 Dec 1997 12:40:04 +0000
parents 2719a89505ba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
1 /*
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
2 * main.c
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
3 */
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
4
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
5 #include <stdio.h>
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
6 #include <stdlib.h>
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
7 #include <signal.h>
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
8 #include <errno.h>
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
9 #include <struct.h>
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
10 #include "common.h"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
11 #include "main.h"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
12 #include "db.h"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
13 #include "interface.h"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
14 #include "file.h"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
15
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
16 #undef PLAYERFILE
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
17 #define PLAYERFILE ".players"
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
18
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
19
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
20 static char *myname;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
21 char *playerFile;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
22
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
23 int main(int argc, char *argv[])
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
24 {
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
25 myname = argv[0];
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
26
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
27 if(argc > 2) {
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
28 fprintf(stderr, "Usage: %s [playerfile]\n", myname);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
29 exit(1);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
30 }
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
31 #ifndef SYSV
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
32 signal(SIGWINCH, getTTYinfo);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
33 #endif
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
34 if(argc == 2)
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
35 playerFile = argv[1];
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
36 else
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
37 playerFile = PLAYERFILE;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
38
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
39 getTTYinfo();
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
40 if(ReadIt(playerFile)) exit(1);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
41 Interface();
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
42 exit(0);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
43 }
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
44
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
45 void err(char *s, ...)
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
46 {
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
47 va_list ap;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
48 char txt[60];
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
49
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
50 va_start(ap, s);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
51 vsprintf(txt, s, ap);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
52 fprintf(stderr, "%s: %s\n", myname, txt);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
53 va_end(ap);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
54 }
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
55
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
56 void err_sys(char *s, ...)
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
57 {
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
58 va_list ap;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
59 char txt[60];
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
60 extern int errno;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
61 int es;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
62
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
63 es = errno;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
64
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
65 va_start(ap, s);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
66 vsprintf(txt, s, ap);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
67 fprintf(stderr, "%s: %s: %s\n", myname, txt, strerror(es));
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
68 va_end(ap);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
69 }
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
70
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
71 void GoAway(int type)
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
72 {
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
73 if(type)
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
74 if(!Verify("quit? There are unsaved changes."))
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
75 return;
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
76
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
77 printf("\npped version %s by H. Kehoe\n\n", VERSSTR);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
78 exit(0);
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
79 }
2719a89505ba First entry of Paradise Server 2.9 patch 10 Beta
darius
parents:
diff changeset
80