aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-12-18 16:43:51 +0000
committerCarsten Weisse <[email protected]>2005-12-18 16:43:51 +0000
commit922f4822fdd99312c4118740015b425e835fa97f (patch)
tree391def48518ca008113e03a9c88dd1125bb61367 /src
parent7acaf7c88a6d5fffbe0cc251a22a594667daa199 (diff)
bugfix: resolves the char encoding problem with String.getBytes()
(see RCon_f) ... code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/jake2/client/CL.java48
1 files changed, 19 insertions, 29 deletions
diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java
index cd14908..a4f18bb 100644
--- a/src/jake2/client/CL.java
+++ b/src/jake2/client/CL.java
@@ -2,7 +2,7 @@
* CL.java
* Copyright (C) 2004
*
- * $Id: CL.java,v 1.27 2005-12-16 21:14:36 salomo Exp $
+ * $Id: CL.java,v 1.28 2005-12-18 16:43:51 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -32,9 +32,7 @@ import jake2.qcommon.*;
import jake2.server.SV_MAIN;
import jake2.sound.S;
import jake2.sys.*;
-import jake2.util.Lib;
-import jake2.util.Math3D;
-import jake2.util.Vargs;
+import jake2.util.*;
import java.io.IOException;
import java.io.RandomAccessFile;
@@ -316,55 +314,47 @@ public final class CL {
*/
static xcommand_t Rcon_f = new xcommand_t() {
public void execute() {
- StringBuffer message = new StringBuffer(1024);
- int i;
- netadr_t to = new netadr_t();
- if (Globals.rcon_client_password.string == null) {
- Com
- .Printf("You must set 'rcon_password' before\nissuing an rcon command.\n");
+ if (Globals.rcon_client_password.string.length() == 0) {
+ Com.Printf("You must set 'rcon_password' before\nissuing an rcon command.\n");
return;
}
- message.append((char) 255);
- message.append((char) 255);
- message.append((char) 255);
- message.append((char) 255);
+ StringBuffer message = new StringBuffer(1024);
- NET.Config(true); // allow remote
+ // connection less packet
+ message.append('\u00ff');
+ message.append('\u00ff');
+ message.append('\u00ff');
+ message.append('\u00ff');
- //strcat (message, "rcon ");
- message.append("rcon ");
+ // allow remote
+ NET.Config(true);
- //strcat (message, rcon_client_password.string);
+ message.append("rcon ");
message.append(Globals.rcon_client_password.string);
- //strcat (message, " ");
message.append(" ");
- for (i = 1; i < Cmd.Argc(); i++) {
- //strcat (message, Cmd.Argv(i));
+ for (int i = 1; i < Cmd.Argc(); i++) {
message.append(Cmd.Argv(i));
- //strcat (message, " ");
message.append(" ");
}
+ netadr_t to = new netadr_t();
+
if (Globals.cls.state >= Defines.ca_connected)
to = Globals.cls.netchan.remote_address;
else {
if (Globals.rcon_address.string.length() == 0) {
- Com
- .Printf("You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands\n");
-
+ Com.Printf("You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands\n");
return;
}
NET.StringToAdr(Globals.rcon_address.string, to);
- if (to.port == 0)
- //to.port = BigShort (PORT_SERVER);
- to.port = Defines.PORT_SERVER;
+ if (to.port == 0) to.port = Defines.PORT_SERVER;
}
message.append('\0');
String b = message.toString();
- NET.SendPacket(Defines.NS_CLIENT, b.length(), b.getBytes(), to);
+ NET.SendPacket(Defines.NS_CLIENT, b.length(), Lib.stringToBytes(b), to);
}
};