From: Rene S. <sa...@us...> - 2004-09-10 21:51:50
|
Update of /cvsroot/jake2/jake2/src/jake2/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11120/src/jake2/server Modified Files: SV_CCMDS.java SV_MAIN.java SV_SEND.java Log Message: did some cource cleanups Index: SV_CCMDS.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_CCMDS.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SV_CCMDS.java 4 Sep 2004 19:08:30 -0000 1.10 --- SV_CCMDS.java 10 Sep 2004 19:02:56 -0000 1.11 *************** *** 66,70 **** for (i= 1; i < MAX_MASTERS; i++) - //memset (&master_adr[i], 0, sizeof(master_adr[i])); master_adr[i]= new netadr_t(); --- 66,69 ---- *************** *** 169,174 **** */ public static void SV_WipeSavegame(String savename) { - //char name[MAX_OSPATH]; - //char *s; String name, s; --- 168,171 ---- *************** *** 220,224 **** } try { - f2= new RandomAccessFile(dst, "rw"); } --- 217,220 ---- *************** *** 308,315 **** // change sav to sv2 - //l = strlen(name); - //strcpy(name + l - 3, "sv2"); - //l = strlen(name2); - //strcpy(name2 + l - 3, "sv2"); name= name.substring(0, name.length() - 3) + "sv2"; name2= name2.substring(0, name2.length() - 3) + "sv2"; --- 304,307 ---- *************** *** 478,486 **** // read the comment field - comment= f.readString(); // read the mapcmd - mapcmd= f.readString(); --- 470,476 ---- *************** *** 648,654 **** */ public static void SV_Loadgame_f() { - //char name[MAX_OSPATH]; - //FILE * f; - //char * dir; String name; --- 638,641 ---- *************** *** 686,690 **** SV_CopySaveGame(Cmd.Argv(1), "current"); - SV_ReadServerFile(); --- 673,676 ---- *************** *** 750,759 **** // copy it off SV_CopySaveGame("current", dir); - Com.Printf("Done.\n"); } //=============================================================== - /* ================== --- 736,743 ---- *************** *** 997,1001 **** try { svs.demofile.writeInt(len); ! svs.demofile.write(buf.data); } catch (IOException e1) { --- 981,985 ---- try { svs.demofile.writeInt(len); ! svs.demofile.write(buf.data,0, buf.cursize); } catch (IOException e1) { Index: SV_MAIN.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_MAIN.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SV_MAIN.java 29 Aug 2004 21:39:25 -0000 1.6 --- SV_MAIN.java 10 Sep 2004 19:02:56 -0000 1.7 *************** *** 36,43 **** public class SV_MAIN extends SV_GAME { ! static netadr_t master_adr[] = new netadr_t[MAX_MASTERS]; // address of group servers static { ! for (int i = 0; i < MAX_MASTERS; i++) { ! master_adr[i] = new netadr_t(); } } --- 36,43 ---- public class SV_MAIN extends SV_GAME { ! static netadr_t master_adr[]= new netadr_t[MAX_MASTERS]; // address of group servers static { ! for (int i= 0; i < MAX_MASTERS; i++) { ! master_adr[i]= new netadr_t(); } } *************** *** 95,103 **** if (drop.download != null) { FS.FreeFile(drop.download); ! drop.download = null; } ! drop.state = Defines.cs_zombie; // become free in a few seconds ! drop.name = ""; } --- 95,103 ---- if (drop.download != null) { FS.FreeFile(drop.download); ! drop.download= null; } ! drop.state= Defines.cs_zombie; // become free in a few seconds ! drop.name= ""; } *************** *** 119,123 **** public static String SV_StatusString() { String player; ! String status = ""; int i; client_t cl; --- 119,123 ---- public static String SV_StatusString() { String player; ! String status= ""; int i; client_t cl; *************** *** 125,137 **** int playerLength; ! status = Cvar.Serverinfo() + "\n"; ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state == Defines.cs_connected || cl.state == Defines.cs_spawned) { ! player = "" + cl.edict.client.ps.stats[Defines.STAT_FRAGS] + " " + cl.ping + "\"" + cl.name + "\"\n"; ! playerLength = player.length(); ! statusLength = status.length(); if (statusLength + playerLength >= 1024) --- 125,137 ---- int playerLength; ! status= Cvar.Serverinfo() + "\n"; ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state == Defines.cs_connected || cl.state == Defines.cs_spawned) { ! player= "" + cl.edict.client.ps.stats[Defines.STAT_FRAGS] + " " + cl.ping + "\"" + cl.name + "\"\n"; ! playerLength= player.length(); ! statusLength= status.length(); if (statusLength + playerLength >= 1024) *************** *** 182,196 **** return; // ignore in single player ! version = atoi(Cmd.Argv(1)); if (version != PROTOCOL_VERSION) ! string = hostname.string + ": wrong version\n"; else { ! count = 0; ! for (i = 0; i < maxclients.value; i++) if (svs.clients[i].state >= cs_connected) count++; ! string = hostname.string + " " + sv.name + " " + count + "/" + (int) maxclients.value + "\n"; } --- 182,196 ---- return; // ignore in single player ! version= atoi(Cmd.Argv(1)); if (version != PROTOCOL_VERSION) ! string= hostname.string + ": wrong version\n"; else { ! count= 0; ! for (i= 0; i < maxclients.value; i++) if (svs.clients[i].state >= cs_connected) count++; ! string= hostname.string + " " + sv.name + " " + count + "/" + (int) maxclients.value + "\n"; } *************** *** 225,238 **** int oldestTime; ! oldest = 0; ! oldestTime = 0x7fffffff; // see if we already have a challenge for this ip ! for (i = 0; i < MAX_CHALLENGES; i++) { if (NET.NET_CompareBaseAdr(Netchan.net_from, svs.challenges[i].adr)) break; if (svs.challenges[i].time < oldestTime) { ! oldestTime = svs.challenges[i].time; ! oldest = i; } } --- 225,238 ---- int oldestTime; ! oldest= 0; ! oldestTime= 0x7fffffff; // see if we already have a challenge for this ip ! for (i= 0; i < MAX_CHALLENGES; i++) { if (NET.NET_CompareBaseAdr(Netchan.net_from, svs.challenges[i].adr)) break; if (svs.challenges[i].time < oldestTime) { ! oldestTime= svs.challenges[i].time; ! oldest= i; } } *************** *** 240,247 **** if (i == MAX_CHALLENGES) { // overwrite the oldest ! svs.challenges[oldest].challenge = rand() & 0x7fff; ! svs.challenges[oldest].adr = Netchan.net_from; ! svs.challenges[oldest].time = (int) Globals.curtime; ! i = oldest; } --- 240,247 ---- if (i == MAX_CHALLENGES) { // overwrite the oldest ! svs.challenges[oldest].challenge= rand() & 0x7fff; ! svs.challenges[oldest].adr= Netchan.net_from; ! svs.challenges[oldest].time= (int) Globals.curtime; ! i= oldest; } *************** *** 258,267 **** */ public static void SVC_DirectConnect() { - //char userinfo[MAX_INFO_STRING]; String userinfo; netadr_t adr; int i; client_t cl; ! edict_t ent; int edictnum; --- 258,266 ---- */ public static void SVC_DirectConnect() { String userinfo; netadr_t adr; int i; client_t cl; ! edict_t ent; int edictnum; *************** *** 269,277 **** int qport; ! adr = Netchan.net_from; Com.DPrintf("SVC_DirectConnect ()\n"); ! version = atoi(Cmd.Argv(1)); if (version != PROTOCOL_VERSION) { Netchan.OutOfBandPrint(NS_SERVER, adr, "print\nServer is version " + VERSION + "\n"); --- 268,276 ---- int qport; ! adr= Netchan.net_from; Com.DPrintf("SVC_DirectConnect ()\n"); ! version= atoi(Cmd.Argv(1)); if (version != PROTOCOL_VERSION) { Netchan.OutOfBandPrint(NS_SERVER, adr, "print\nServer is version " + VERSION + "\n"); *************** *** 280,291 **** } ! qport = atoi(Cmd.Argv(2)); ! int challenge = atoi(Cmd.Argv(3)); ! userinfo = Cmd.Argv(4); //userinfo[sizeof(userinfo) - 1] = 0; // force the IP key/value pair so the game can filter based on ip ! userinfo = Info.Info_SetValueForKey1(userinfo, "ip", NET.AdrToString(Netchan.net_from)); // attractloop servers are ONLY for local clients --- 279,290 ---- } ! qport= atoi(Cmd.Argv(2)); ! int challenge= atoi(Cmd.Argv(3)); ! userinfo= Cmd.Argv(4); //userinfo[sizeof(userinfo) - 1] = 0; // force the IP key/value pair so the game can filter based on ip ! userinfo= Info.Info_SetValueForKey1(userinfo, "ip", NET.AdrToString(Netchan.net_from)); // attractloop servers are ONLY for local clients *************** *** 300,304 **** // see if the challenge is valid if (!NET.IsLocalAddress(adr)) { ! for (i = 0; i < MAX_CHALLENGES; i++) { if (NET.NET_CompareBaseAdr(Netchan.net_from, svs.challenges[i].adr)) { if (challenge == svs.challenges[i].challenge) --- 299,303 ---- // see if the challenge is valid if (!NET.IsLocalAddress(adr)) { ! for (i= 0; i < MAX_CHALLENGES; i++) { if (NET.NET_CompareBaseAdr(Netchan.net_from, svs.challenges[i].adr)) { if (challenge == svs.challenges[i].challenge) *************** *** 314,324 **** } - //newcl = temp; - //memset (newcl, 0, sizeof(client_t)); - //newcl = new client_t(); - // if there is already a slot for this ip, reuse it ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state == cs_free) --- 313,319 ---- } // if there is already a slot for this ip, reuse it ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state == cs_free) *************** *** 339,347 **** // find a client slot //newcl = null; ! int index = -1; ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state == cs_free) { ! index = i; break; } --- 334,342 ---- // find a client slot //newcl = null; ! int index= -1; ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state == cs_free) { ! index= i; break; } *************** *** 361,370 **** //*newcl = temp; ! sv_client = svs.clients[i]; //edictnum = (newcl-svs.clients)+1; ! int edictnum = i + 1; ! edict_t ent = GameBase.g_edicts[edictnum]; ! svs.clients[i].edict = ent; ! svs.clients[i].challenge = challenge; // save challenge for checksumming // get the game a chance to reject this connection or modify the userinfo --- 356,365 ---- //*newcl = temp; ! sv_client= svs.clients[i]; //edictnum = (newcl-svs.clients)+1; ! int edictnum= i + 1; ! edict_t ent= GameBase.g_edicts[edictnum]; ! svs.clients[i].edict= ent; ! svs.clients[i].challenge= challenge; // save challenge for checksumming // get the game a chance to reject this connection or modify the userinfo *************** *** 382,386 **** // parse some info from the info strings ! svs.clients[i].userinfo = userinfo; SV_UserinfoChanged(svs.clients[i]); --- 377,381 ---- // parse some info from the info strings ! svs.clients[i].userinfo= userinfo; SV_UserinfoChanged(svs.clients[i]); *************** *** 390,399 **** Netchan.Setup(NS_SERVER, svs.clients[i].netchan, adr, qport); ! svs.clients[i].state = cs_connected; SZ.Init(svs.clients[i].datagram, svs.clients[i].datagram_buf, svs.clients[i].datagram_buf.length); ! svs.clients[i].datagram.allowoverflow = true; ! svs.clients[i].lastmessage = svs.realtime; // don't timeout ! svs.clients[i].lastconnect = svs.realtime; Com.DPrintf("new client added.\n"); } --- 385,394 ---- Netchan.Setup(NS_SERVER, svs.clients[i].netchan, adr, qport); ! svs.clients[i].state= cs_connected; SZ.Init(svs.clients[i].datagram, svs.clients[i].datagram_buf, svs.clients[i].datagram_buf.length); ! svs.clients[i].datagram.allowoverflow= true; ! svs.clients[i].lastmessage= svs.realtime; // don't timeout ! svs.clients[i].lastconnect= svs.realtime; Com.DPrintf("new client added.\n"); } *************** *** 423,429 **** String remaining; ! i = Rcon_Validate(); ! String msg = new String(net_message.data, 4, -1); if (i == 0) --- 418,424 ---- String remaining; ! i= Rcon_Validate(); ! String msg= new String(net_message.data, 4, -1); if (i == 0) *************** *** 442,448 **** } else { ! remaining = ""; ! for (i = 2; i < Cmd.Argc(); i++) { remaining += Cmd.Argv(i); remaining += " "; --- 437,443 ---- } else { ! remaining= ""; ! for (i= 2; i < Cmd.Argc(); i++) { remaining += Cmd.Argv(i); remaining += " "; *************** *** 472,480 **** MSG.ReadLong(net_message); // skip the -1 marker ! s = MSG.ReadStringLine(net_message); Cmd.TokenizeString(s.toCharArray(), false); ! c = Cmd.Argv(0); //Com.Printf("Packet " + NET.AdrToString(Netchan.net_from) + " : " + c + "\n"); //Com.Printf(Lib.hexDump(net_message.data, 64, false) + "\n"); --- 467,475 ---- MSG.ReadLong(net_message); // skip the -1 marker ! s= MSG.ReadStringLine(net_message); Cmd.TokenizeString(s.toCharArray(), false); ! c= Cmd.Argv(0); //Com.Printf("Packet " + NET.AdrToString(Netchan.net_from) + " : " + c + "\n"); //Com.Printf(Lib.hexDump(net_message.data, 64, false) + "\n"); *************** *** 494,499 **** else if (0 == strcmp(c, "rcon")) SVC_RemoteCommand(); ! else ! { Com.Printf("bad connectionless packet from " + NET.AdrToString(Netchan.net_from) + "\n"); Com.Printf("[" + s + "]\n"); --- 489,493 ---- else if (0 == strcmp(c, "rcon")) SVC_RemoteCommand(); ! else { Com.Printf("bad connectionless packet from " + NET.AdrToString(Netchan.net_from) + "\n"); Com.Printf("[" + s + "]\n"); *************** *** 516,527 **** int total, count; ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state != cs_spawned) continue; ! total = 0; ! count = 0; ! for (j = 0; j < LATENCY_COUNTS; j++) { if (cl.frame_latency[j] > 0) { count++; --- 510,521 ---- int total, count; ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state != cs_spawned) continue; ! total= 0; ! count= 0; ! for (j= 0; j < LATENCY_COUNTS; j++) { if (cl.frame_latency[j] > 0) { count++; *************** *** 530,539 **** } if (0 == count) ! cl.ping = 0; else ! cl.ping = total / count; // let the game dll know about the ping ! cl.edict.client.ping = cl.ping; } } --- 524,533 ---- } if (0 == count) ! cl.ping= 0; else ! cl.ping= total / count; // let the game dll know about the ping ! cl.edict.client.ping= cl.ping; } } *************** *** 554,563 **** return; ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state == cs_free) continue; ! cl.commandMsec = 1800; // 1600 + some slop } } --- 548,557 ---- return; ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state == cs_free) continue; ! cl.commandMsec= 1800; // 1600 + some slop } } *************** *** 571,575 **** int i; client_t cl; ! int qport =0; while (NET.GetPacket(NS_SERVER, Netchan.net_from, net_message)) { --- 565,569 ---- int i; client_t cl; ! int qport= 0; while (NET.GetPacket(NS_SERVER, Netchan.net_from, net_message)) { *************** *** 589,597 **** MSG.ReadLong(net_message); // sequence number MSG.ReadLong(net_message); // sequence number ! qport = MSG.ReadShort(net_message) & 0xffff; // check for packets from connected clients ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state == cs_free) continue; --- 583,591 ---- MSG.ReadLong(net_message); // sequence number MSG.ReadLong(net_message); // sequence number ! qport= MSG.ReadShort(net_message) & 0xffff; // check for packets from connected clients ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state == cs_free) continue; *************** *** 602,611 **** if (cl.netchan.remote_address.port != Netchan.net_from.port) { Com.Printf("SV_ReadPackets: fixing up a translated port\n"); ! cl.netchan.remote_address.port = Netchan.net_from.port; } if (Netchan.Process(cl.netchan, net_message)) { // this is a valid, sequenced packet, so process it if (cl.state != cs_zombie) { ! cl.lastmessage = svs.realtime; // don't timeout SV_USER.SV_ExecuteClientMessage(cl); } --- 596,605 ---- if (cl.netchan.remote_address.port != Netchan.net_from.port) { Com.Printf("SV_ReadPackets: fixing up a translated port\n"); ! cl.netchan.remote_address.port= Netchan.net_from.port; } if (Netchan.Process(cl.netchan, net_message)) { // this is a valid, sequenced packet, so process it if (cl.state != cs_zombie) { ! cl.lastmessage= svs.realtime; // don't timeout SV_USER.SV_ExecuteClientMessage(cl); } *************** *** 638,652 **** int zombiepoint; ! droppoint = (int) (svs.realtime - 1000 * timeout.value); ! zombiepoint = (int) (svs.realtime - 1000 * zombietime.value); ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; // message times may be wrong across a changelevel if (cl.lastmessage > svs.realtime) ! cl.lastmessage = svs.realtime; if (cl.state == cs_zombie && cl.lastmessage < zombiepoint) { ! cl.state = cs_free; // can now be reused continue; } --- 632,646 ---- int zombiepoint; ! droppoint= (int) (svs.realtime - 1000 * timeout.value); ! zombiepoint= (int) (svs.realtime - 1000 * zombietime.value); ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; // message times may be wrong across a changelevel if (cl.lastmessage > svs.realtime) ! cl.lastmessage= svs.realtime; if (cl.state == cs_zombie && cl.lastmessage < zombiepoint) { ! cl.state= cs_free; // can now be reused continue; } *************** *** 654,658 **** SV_SEND.SV_BroadcastPrintf(PRINT_HIGH, cl.name + " timed out\n"); SV_DropClient(cl); ! cl.state = cs_free; // don't bother with zombie state } } --- 648,652 ---- SV_SEND.SV_BroadcastPrintf(PRINT_HIGH, cl.name + " timed out\n"); SV_DropClient(cl); ! cl.state= cs_free; // don't bother with zombie state } } *************** *** 671,678 **** int i; ! for (i = 0; i < GameBase.num_edicts; i++) { ! ent = GameBase.g_edicts[i]; // events only last for a single message ! ent.s.event = 0; } --- 665,672 ---- int i; ! for (i= 0; i < GameBase.num_edicts; i++) { ! ent= GameBase.g_edicts[i]; // events only last for a single message ! ent.s.event= 0; } *************** *** 686,690 **** public static void SV_RunGameFrame() { if (host_speeds.value != 0) ! time_before_game = Sys.Milliseconds(); // we always need to bump framenum, even if we --- 680,684 ---- public static void SV_RunGameFrame() { if (host_speeds.value != 0) ! time_before_game= Sys.Milliseconds(); // we always need to bump framenum, even if we *************** *** 693,697 **** // has the "current" frame sv.framenum++; ! sv.time = sv.framenum * 100; // don't run if paused --- 687,691 ---- // has the "current" frame sv.framenum++; ! sv.time= sv.framenum * 100; // don't run if paused *************** *** 703,712 **** if (sv_showclamp.value != 0) Com.Printf("sv highclamp\n"); ! svs.realtime = sv.time; } } if (host_speeds.value != 0) ! time_after_game = Sys.Milliseconds(); } --- 697,706 ---- if (sv_showclamp.value != 0) Com.Printf("sv highclamp\n"); ! svs.realtime= sv.time; } } if (host_speeds.value != 0) ! time_after_game= Sys.Milliseconds(); } *************** *** 719,723 **** */ public static void SV_Frame(long msec) { ! Globals.time_before_game = Globals.time_after_game = 0; // if server is not active, do nothing --- 713,717 ---- */ public static void SV_Frame(long msec) { ! Globals.time_before_game= Globals.time_after_game= 0; // if server is not active, do nothing *************** *** 735,749 **** // get packets from clients SV_ReadPackets(); ! //if (Game.g_edicts[1] !=null) // Com.p("player at:" + Lib.vtofsbeaty(Game.g_edicts[1].s.origin )); // move autonomous things around if enough time has passed ! if (0== sv_timedemo.value && svs.realtime < sv.time) { // never let the time get too far off if (sv.time - svs.realtime > 100) { if (sv_showclamp.value != 0) Com.Printf("sv lowclamp\n"); ! svs.realtime = sv.time - 100; } NET.NET_Sleep(sv.time - svs.realtime); --- 729,743 ---- // get packets from clients SV_ReadPackets(); ! //if (Game.g_edicts[1] !=null) // Com.p("player at:" + Lib.vtofsbeaty(Game.g_edicts[1].s.origin )); // move autonomous things around if enough time has passed ! if (0 == sv_timedemo.value && svs.realtime < sv.time) { // never let the time get too far off if (sv.time - svs.realtime > 100) { if (sv_showclamp.value != 0) Com.Printf("sv lowclamp\n"); ! svs.realtime= sv.time - 100; } NET.NET_Sleep(sv.time - svs.realtime); *************** *** 788,792 **** ================ */ ! public static final int HEARTBEAT_SECONDS = 300; public static void Master_Heartbeat() { String string; --- 782,786 ---- ================ */ ! public static final int HEARTBEAT_SECONDS= 300; public static void Master_Heartbeat() { String string; *************** *** 803,818 **** // check for time wraparound if (svs.last_heartbeat > svs.realtime) ! svs.last_heartbeat = svs.realtime; if (svs.realtime - svs.last_heartbeat < HEARTBEAT_SECONDS * 1000) return; // not time to send yet ! svs.last_heartbeat = svs.realtime; // send the same string that we would give for a status OOB command ! string = SV_StatusString(); // send to group master ! for (i = 0; i < MAX_MASTERS; i++) if (master_adr[i].port != 0) { Com.Printf("Sending heartbeat to " + NET.AdrToString(master_adr[i]) + "\n"); --- 797,812 ---- // check for time wraparound if (svs.last_heartbeat > svs.realtime) ! svs.last_heartbeat= svs.realtime; if (svs.realtime - svs.last_heartbeat < HEARTBEAT_SECONDS * 1000) return; // not time to send yet ! svs.last_heartbeat= svs.realtime; // send the same string that we would give for a status OOB command ! string= SV_StatusString(); // send to group master ! for (i= 0; i < MAX_MASTERS; i++) if (master_adr[i].port != 0) { Com.Printf("Sending heartbeat to " + NET.AdrToString(master_adr[i]) + "\n"); *************** *** 840,844 **** // send to group master ! for (i = 0; i < MAX_MASTERS; i++) if (master_adr[i].port != 0) { if (i > 0) --- 834,838 ---- // send to group master ! for (i= 0; i < MAX_MASTERS; i++) if (master_adr[i].port != 0) { if (i > 0) *************** *** 866,870 **** // name for C code ! cl.name = Info.Info_ValueForKey(cl.userinfo, "name"); // mask off high bit --- 860,864 ---- // name for C code ! cl.name= Info.Info_ValueForKey(cl.userinfo, "name"); // mask off high bit *************** *** 874,893 **** // rate command ! val = Info.Info_ValueForKey(cl.userinfo, "rate"); if (val.length() > 0) { ! i = atoi(val); ! cl.rate = i; if (cl.rate < 100) ! cl.rate = 100; if (cl.rate > 15000) ! cl.rate = 15000; } else ! cl.rate = 5000; // msg command ! val = Info.Info_ValueForKey(cl.userinfo, "msg"); if (val.length() > 0) { ! cl.messagelevel = atoi(val); } --- 868,887 ---- // rate command ! val= Info.Info_ValueForKey(cl.userinfo, "rate"); if (val.length() > 0) { ! i= atoi(val); ! cl.rate= i; if (cl.rate < 100) ! cl.rate= 100; if (cl.rate > 15000) ! cl.rate= 15000; } else ! cl.rate= 5000; // msg command ! val= Info.Info_ValueForKey(cl.userinfo, "msg"); if (val.length() > 0) { ! cl.messagelevel= atoi(val); } *************** *** 904,910 **** */ public static void SV_Init() { ! SV_CCMDS.SV_InitOperatorCommands (); //ok. ! rcon_password = Cvar.Get("rcon_password", "", 0); Cvar.Get("skill", "1", 0); Cvar.Get("deathmatch", "0", CVAR_LATCH); --- 898,904 ---- */ public static void SV_Init() { ! SV_CCMDS.SV_InitOperatorCommands(); //ok. ! rcon_password= Cvar.Get("rcon_password", "", 0); Cvar.Get("skill", "1", 0); Cvar.Get("deathmatch", "0", CVAR_LATCH); *************** *** 916,940 **** Cvar.Get("cheats", "1", CVAR_SERVERINFO | CVAR_LATCH); Cvar.Get("protocol", "" + PROTOCOL_VERSION, CVAR_SERVERINFO | CVAR_NOSET); ! ! SV_MAIN.maxclients = Cvar.Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); ! hostname = Cvar.Get("hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE); ! timeout = Cvar.Get("timeout", "125", 0); ! zombietime = Cvar.Get("zombietime", "2", 0); ! sv_showclamp = Cvar.Get("showclamp", "0", 0); ! sv_paused = Cvar.Get("paused", "0", 0); ! sv_timedemo = Cvar.Get("timedemo", "0", 0); ! sv_enforcetime = Cvar.Get("sv_enforcetime", "0", 0); ! // TODO: carsten, re-allow downloads per default ! allow_download = Cvar.Get("allow_download", "0", CVAR_ARCHIVE); ! allow_download_players = Cvar.Get("allow_download_players", "0", CVAR_ARCHIVE); ! allow_download_models = Cvar.Get("allow_download_models", "1", CVAR_ARCHIVE); ! allow_download_sounds = Cvar.Get("allow_download_sounds", "1", CVAR_ARCHIVE); ! allow_download_maps = Cvar.Get("allow_download_maps", "1", CVAR_ARCHIVE); ! sv_noreload = Cvar.Get("sv_noreload", "0", 0); ! sv_airaccelerate = Cvar.Get("sv_airaccelerate", "0", CVAR_LATCH); ! public_server = Cvar.Get("public", "0", 0); ! sv_reconnect_limit = Cvar.Get("sv_reconnect_limit", "3", CVAR_ARCHIVE); SZ.Init(net_message, net_message_buffer, net_message_buffer.length); --- 910,934 ---- Cvar.Get("cheats", "1", CVAR_SERVERINFO | CVAR_LATCH); Cvar.Get("protocol", "" + PROTOCOL_VERSION, CVAR_SERVERINFO | CVAR_NOSET); ! ! SV_MAIN.maxclients= Cvar.Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); ! hostname= Cvar.Get("hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE); ! timeout= Cvar.Get("timeout", "125", 0); ! zombietime= Cvar.Get("zombietime", "2", 0); ! sv_showclamp= Cvar.Get("showclamp", "0", 0); ! sv_paused= Cvar.Get("paused", "0", 0); ! sv_timedemo= Cvar.Get("timedemo", "0", 0); ! sv_enforcetime= Cvar.Get("sv_enforcetime", "0", 0); ! // TODO: carsten, re-allow downloads per default ! allow_download= Cvar.Get("allow_download", "0", CVAR_ARCHIVE); ! allow_download_players= Cvar.Get("allow_download_players", "0", CVAR_ARCHIVE); ! allow_download_models= Cvar.Get("allow_download_models", "1", CVAR_ARCHIVE); ! allow_download_sounds= Cvar.Get("allow_download_sounds", "1", CVAR_ARCHIVE); ! allow_download_maps= Cvar.Get("allow_download_maps", "1", CVAR_ARCHIVE); ! sv_noreload= Cvar.Get("sv_noreload", "0", 0); ! sv_airaccelerate= Cvar.Get("sv_airaccelerate", "0", CVAR_LATCH); ! public_server= Cvar.Get("public", "0", 0); ! sv_reconnect_limit= Cvar.Get("sv_reconnect_limit", "3", CVAR_ARCHIVE); SZ.Init(net_message, net_message_buffer, net_message_buffer.length); *************** *** 968,978 **** // stagger the packets to crutch operating system limited buffers ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state >= cs_connected) Netchan.Transmit(cl.netchan, net_message.cursize, net_message.data); } ! for (i = 0; i < maxclients.value; i++) { ! cl = svs.clients[i]; if (cl.state >= cs_connected) Netchan.Transmit(cl.netchan, net_message.cursize, net_message.data); --- 962,972 ---- // stagger the packets to crutch operating system limited buffers ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state >= cs_connected) Netchan.Transmit(cl.netchan, net_message.cursize, net_message.data); } ! for (i= 0; i < maxclients.value; i++) { ! cl= svs.clients[i]; if (cl.state >= cs_connected) Netchan.Transmit(cl.netchan, net_message.cursize, net_message.data); *************** *** 993,998 **** Master_Shutdown(); ! ! SV_GAME.SV_ShutdownGameProgs (); // free current level --- 987,992 ---- Master_Shutdown(); ! ! SV_GAME.SV_ShutdownGameProgs(); // free current level *************** *** 1005,1018 **** } ! //memset (&sv, 0, sizeof(sv)); ! sv = new server_t(); ! ! Globals.server_state= sv.state; ! // free server static data ! //if (svs.clients!=null) ! // Z_Free (svs.clients); ! //if (svs.client_entities) ! // Z_Free (svs.client_entities); if (svs.demofile != null) --- 999,1005 ---- } ! sv= new server_t(); ! Globals.server_state= sv.state; if (svs.demofile != null) *************** *** 1023,1028 **** e1.printStackTrace(); } ! //memset (&svs, 0, sizeof(svs)); ! svs = new server_static_t(); } } --- 1010,1015 ---- e1.printStackTrace(); } ! ! svs= new server_static_t(); } } Index: SV_SEND.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/server/SV_SEND.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SV_SEND.java 22 Aug 2004 14:25:13 -0000 1.4 --- SV_SEND.java 10 Sep 2004 19:02:56 -0000 1.5 *************** *** 71,84 **** */ public static void SV_ClientPrintf(client_t cl, int level, String s) { ! // va_list argptr; ! // char string[1024]; ! // if (level < cl.messagelevel) return; - // va_start (argptr,fmt); - // vsprintf (string, fmt,argptr); - // va_end (argptr); - MSG.WriteByte(cl.netchan.message, svc_print); MSG.WriteByte(cl.netchan.message, level); --- 71,78 ---- */ public static void SV_ClientPrintf(client_t cl, int level, String s) { ! if (level < cl.messagelevel) return; MSG.WriteByte(cl.netchan.message, svc_print); MSG.WriteByte(cl.netchan.message, level); *************** *** 94,118 **** */ public static void SV_BroadcastPrintf(int level, String s) { - //va_list argptr; - //char string[2048]; - client_t cl; - //int i; ! // va_start (argptr,fmt); ! // vsprintf (string, fmt,argptr); ! // va_end (argptr); // echo to console if (dedicated.value != 0) { - //char copy[1024]; - //int i; - - // mask off high bits - //for (i=0 ; i<1023 && string[i] ; i++) - //copy[i] = string[i]&127; - //copy[i] = 0; - //Com_Printf ("%s", copy); - Com.Printf(s); } --- 88,97 ---- */ public static void SV_BroadcastPrintf(int level, String s) { ! client_t cl; // echo to console if (dedicated.value != 0) { Com.Printf(s); } *************** *** 138,151 **** */ public static void SV_BroadcastCommand(String s) { - // va_list argptr; - // char string[1024]; if (sv.state == 0) return; - // va_start (argptr,fmt); - // vsprintf (string, fmt,argptr); - // va_end (argptr); - MSG.WriteByte(sv.multicast, svc_stufftext); MSG.WriteString(sv.multicast, s); --- 117,124 ---- |