2
+ − 1 /*--------------------------------------------------------------------------
+ − 2 NETREK II -- Paradise
+ − 3
+ − 4 Permission to use, copy, modify, and distribute this software and its
+ − 5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
+ − 6 purpose and without fee is hereby granted, provided that this copyright
+ − 7 notice appear in all copies. No representations are made about the
+ − 8 suitability of this software for any purpose. This software is provided
+ − 9 "as is" without express or implied warranty.
+ − 10
+ − 11 Xtrek Copyright 1986 Chris Guthrie
+ − 12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
+ − 13 Scott Silvey
+ − 14 Paradise II (Netrek II) Copyright 1993 Larry Denys
+ − 15 Kurt Olsen
+ − 16 Brandon Gillespie
+ − 17 --------------------------------------------------------------------------*/
+ − 18
+ − 19
+ − 20 #include "config.h"
+ − 21 #include "defs.h"
+ − 22 #include "struct.h"
+ − 23 #include "data.h"
+ − 24
+ − 25 char *argv0;
+ − 26
+ − 27 int oldalert = PFGREEN; /* Avoid changing more than we have to */
+ − 28 int remap[9] = {0, 1, 2, -1, 3, -1, -1, -1, 4};
+ − 29 int selfdest;
+ − 30 int lastm;
+ − 31 int delay; /* delay for decaring war */
+ − 32 int rdelay; /* delay for refitting */
+ − 33 int mustexit = 0;
+ − 34 int keeppeace = 0;
+ − 35 char *shipnos = "0123456789abcdefghijklmnopqrstuvwxyz";
+ − 36 int sock = -1;
+ − 37 int xtrekPort = 2592;
+ − 38 int shipPick;
+ − 39 int tmpPick = (int) CRUISER; /* just to assign something :) */
+ − 40 int teamPick;
+ − 41 int repCount = 0;
+ − 42 char namePick[16];
+ − 43 char passPick[16];
+ − 44 int inputMask = -1;
+ − 45 int nextSocket;
+ − 46 char *host;
+ − 47 int noressurect = 0;
+ − 48 int userVersion = 0, userUdpVersion = 0;
+ − 49 int timerDelay = 200000; /* delay between sending stuff to client */
+ − 50 char testdata[KEY_SIZE];
+ − 51 int RSA_Client;
+ − 52 char RSA_client_type[256]; /* LAB 4/1/93 */
+ − 53 int testtime = -1;
+ − 54 int chaos = 0;
+ − 55 int topgun = 0; /* added 12/9/90 TC */
+ − 56 int hourratio = 1; /* Fix thing to make guests advance fast */
+ − 57 int blk_flag = 0; /* added 1/19/93 KAO */
+ − 58 int udpSock = (-1); /* UDP - the almighty socket */
+ − 59 int commMode = 0; /* UDP - initial mode is TCP only */
+ − 60 int blk_metaserver = 0; /* 1 if this call is from meta-server */
+ − 61 char *galaxyValid; /* 0 if galaxy invalid */
+ − 62
+ − 63 #ifdef FEATURE /* plus defaults, to protect client */
+ − 64 int F_feature_packets = 1; /* allow feature packets */
+ − 65 int F_allowViewBox = 1; /* allow view box */
+ − 66 int F_allowShowAllTractorPressor = 1; /* allow all tracts/presses */
+ − 67 int F_allowContinuousMouse = 1; /* allow continuous mouse */
+ − 68 int F_UseNewMacro = 1; /* allow new macros */
+ − 69 int F_UseSmartMacro = 1; /* Allow smart macros */
+ − 70 int F_multiline_enabled = 1; /* Allow multiline macros */
+ − 71 int F_why_dead = 1; /* Allow why_dead reporting */
+ − 72 int F_cloakerMaxWarp = 1; /* Allow cloaker to go maxwarp */
+ − 73 int F_gen_distress = 0; /* No RCDs (not yet implemented in server) */
+ − 74 int F_allow_beeplite = 0; /* No RCDs ==> no allowed beeplite */
+ − 75 unsigned char F_beeplite_flags; /* flags for beeplite */
+ − 76 int F_terrain = 0; /* Client isn't capable of terrain by default */
+ − 77 unsigned char F_terrain_major; /* Major terrain version client can handle */
+ − 78 unsigned char F_terrain_minor; /* Minor terrain version client can handle */
+ − 79 int F_gz_motd = 0; /* Client can't handle GZipped MOTD packets */
+ − 80 unsigned char F_gz_motd_major; /* Major gzipped format client can handle */
+ − 81 unsigned char F_gz_motd_minor; /* Minor gzipped format client can handle */
+ − 82 #endif
+ − 83
+ − 84 double oldmax = 0.0;
+ − 85
+ − 86 extern double Sin[], Cos[]; /* Initialized in sintab.c */
+ − 87
+ − 88 char pseudo[PSEUDOSIZE];
+ − 89 char login[PSEUDOSIZE];
+ − 90
+ − 91 #ifdef RANKS2
+ − 92 struct rank ranks[NUMRANKS] =
+ − 93 {
+ − 94 /* genos DI batl strat spec name */
+ − 95 {0, 0, 0.00, 0.0, 0.0, "Recruit"},
+ − 96 {1, 10, 0.30, 0.3, 0.0, "2nd Mate"},
+ − 97 {2, 25, 0.40, 0.6, 0.0, "1st Mate"},
+ − 98 {3, 45, 0.50, 0.9, 0.0, "Bosun"},
+ − 99 {4, 70, 0.70, 1.2, 0.0, "Ensign"},
+ − 100 {5, 100, 0.90, 1.5, 0.0, "2nd Lieutenant"},
+ − 101 {6, 140, 1.10, 2.0, 0.0, "1st Lieutenant"},
+ − 102 {8, 190, 1.30, 2.5, 0.0, "Lt. Cmdr."},
+ − 103 {10, 250, 1.50, 3.0, 0.5, "Commander"},
+ − 104 {15, 300, 1.80, 3.5, 0.7, "Battle Cmdr."},
+ − 105 {18, 350, 2.00, 4.0, 1.0, "Captain"},
+ − 106 {25, 400, 2.10, 4.3, 2.5, "Fleet Capt."},
+ − 107 {50, 500, 2.15, 4.8, 3.0, "Commodore"},
+ − 108 {75, 700, 2.20, 5.3, 3.3, "Rear Adml."},
+ − 109 {100, 900, 2.25, 5.7, 3.6, "Admiral"},
+ − 110 {200, 1200, 2.30, 6.0, 3.8, "Grand Adml."},
+ − 111 {300, 1700, 2.35, 6.1, 4.0, "Moff"},
+ − 112 {500, 2500, 2.40, 6.2, 4.2, "Grand Moff"}
+ − 113 };
+ − 114 #ifdef CASSIUS_ROYALTY
+ − 115 struct royalty royal[NUMROYALRANKS] = {
+ − 116 {"none"},
+ − 117 {"Wesley"},
+ − 118 {"Footslog"},
+ − 119 {"COMMODORE"},
+ − 120 {"Dread"},
+ − 121 {"Agent"},
+ − 122 {"Gorilla"},
+ − 123 {"Lord"},
+ − 124 {"Emperor"},
+ − 125 {"Q"}
+ − 126 };
+ − 127 #else
+ − 128 struct royalty royal[NUMROYALRANKS] = {
+ − 129 {"none"},
+ − 130 {"Wesley"},
+ − 131 {"Agent"},
+ − 132 {"Emperor"},
+ − 133 {"Q"}
+ − 134 };
+ − 135 #endif /* Royalty */
+ − 136 #else
+ − 137 struct rank ranks[NUMRANKS] =
+ − 138 {
+ − 139 /* gen DI batl strat spec name */
+ − 140 {0, 0, 0.00, 0.0, 0.0, "Recruit"},
+ − 141 {1, 10, 0.30, 0.3, 0.0, "Specialist"},
+ − 142 {2, 25, 0.40, 0.6, 0.0, "Cadet"},
+ − 143 {3, 45, 0.50, 0.9, 0.0, "Midshipman"},
+ − 144 {4, 70, 0.70, 1.2, 0.0, "Ensn., J.G."},
+ − 145 {5, 100, 0.90, 1.5, 0.0, "Ensign"},
+ − 146 {6, 140, 1.10, 2.0, 0.0, "Lt., J.G."},
+ − 147 {8, 190, 1.30, 2.5, 0.0, "Lieutenant"},
+ − 148 {10, 250, 1.50, 3.0, 0.5, "Lt. Cmdr."},
+ − 149 {15, 300, 1.80, 3.5, 0.7, "Commander"},
+ − 150 {18, 350, 2.00, 4.0, 1.0, "Captain"},
+ − 151 {25, 400, 2.10, 4.3, 2.5, "Fleet Capt."},
+ − 152 {50, 500, 2.15, 4.8, 3.0, "Commodore"},
+ − 153 {75, 700, 2.20, 5.3, 3.3, "Moff"},
+ − 154 {100, 900, 2.25, 5.7, 3.6, "Grand Moff"},
+ − 155 {300, 1200, 2.30, 6.0, 3.8, "Rear Adml."},
+ − 156 {700, 1700, 2.35, 6.1, 4.0, "Admiral"},
+ − 157 {1000, 2500, 2.40, 6.2, 4.2, "Grand Adml."}
+ − 158 };
+ − 159
+ − 160 struct royalty royal[NUMROYALRANKS] = {
+ − 161 {"none"},
+ − 162 {"Wesley"},
+ − 163 {"Centurion"},
+ − 164 {"Praetor"},
+ − 165 {"Q"}
+ − 166 };
+ − 167 #endif
+ − 168
+ − 169 /* ping stuff */
+ − 170 int ping = 0; /* to ping or not to ping, client's decision */
+ − 171 long packets_sent = 0; /* # all packets sent to client */
+ − 172 long packets_received = 0; /* # all packets received from client */
+ − 173 int ping_ghostbust = 0; /* ghostbust timer */
+ − 174
+ − 175
+ − 176 char _PARAVERS[] = "@(#)version 2.4 patch 10 ALPHA";
+ − 177 char *PARAVERS = &(_PARAVERS[4]);
+ − 178 char MCONTROL[] = "CONTROL->";
+ − 179 char UMPIRE[] = "Umpire ";
+ − 180 /* for sending messages from GOD/Server to others */
+ − 181 char MSERVA[] = "SRV->ALL";
+ − 182 char SERVNAME[] = "SRV";