diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-09-23 21:00:57 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-09-23 21:00:57 +0000 |
| commit | e55ba53ba7aa993279bf3f6a21b1e771fda74f1d (patch) | |
| tree | d2108e3ccdffe43dee99acef4bcf819141472c06 | |
| parent | ebbe51718e6b3ed81ee0932641e0bc4ddb805fcc (diff) | |
| download | zcatch-e55ba53ba7aa993279bf3f6a21b1e771fda74f1d.tar.gz zcatch-e55ba53ba7aa993279bf3f6a21b1e771fda74f1d.zip | |
fixed remote console
| -rw-r--r-- | src/engine/client/client.c | 9 | ||||
| -rw-r--r-- | src/engine/config_variables.h | 1 | ||||
| -rw-r--r-- | src/engine/interface.h | 2 | ||||
| -rw-r--r-- | src/engine/protocol.h | 1 | ||||
| -rw-r--r-- | src/engine/server/server.c | 10 | ||||
| -rw-r--r-- | src/game/client/game_client.cpp | 13 |
6 files changed, 32 insertions, 4 deletions
diff --git a/src/engine/client/client.c b/src/engine/client/client.c index 26865f37..87a3481f 100644 --- a/src/engine/client/client.c +++ b/src/engine/client/client.c @@ -299,6 +299,15 @@ static void client_send_error(const char *error) } +void client_rcon(const char *cmd) +{ + msg_pack_start_system(NETMSG_CMD, MSGFLAG_VITAL); + msg_pack_string(config.rcon_password, 32); + msg_pack_string(cmd, 256); + msg_pack_end(); + client_send_msg(); +} + static void client_send_input() { if(current_predtick <= 0) diff --git a/src/engine/config_variables.h b/src/engine/config_variables.h index 5af42668..cca544b8 100644 --- a/src/engine/config_variables.h +++ b/src/engine/config_variables.h @@ -6,6 +6,7 @@ MACRO_CONFIG_STR(player_name, 32, "nameless tee") MACRO_CONFIG_STR(clan_name, 32, "") MACRO_CONFIG_STR(password, 32, "") +MACRO_CONFIG_STR(rcon_password, 32, "") MACRO_CONFIG_INT(debug, 0, 0, 1) MACRO_CONFIG_INT(stress, 0, 0, 0) diff --git a/src/engine/interface.h b/src/engine/interface.h index 4bf25bd2..97a4b684 100644 --- a/src/engine/interface.h +++ b/src/engine/interface.h @@ -782,6 +782,8 @@ void client_connect(const char *address); void client_disconnect(); void client_quit(); +void client_rcon(const char *cmd); + void client_serverbrowse_refresh(int lan); int client_serverbrowse_getlist(SERVER_INFO **servers); diff --git a/src/engine/protocol.h b/src/engine/protocol.h index 1a41d66a..cc29e7d7 100644 --- a/src/engine/protocol.h +++ b/src/engine/protocol.h @@ -17,6 +17,7 @@ enum /* sent by client */ NETMSG_ENTERGAME, NETMSG_INPUT, + NETMSG_CMD, /* sent by both */ NETMSG_ERROR, diff --git a/src/engine/server/server.c b/src/engine/server/server.c index 293d4870..57f315f7 100644 --- a/src/engine/server/server.c +++ b/src/engine/server/server.c @@ -465,6 +465,16 @@ static void server_process_client_packet(NETPACKET *packet) clients[cid].current_input++; clients[cid].current_input %= 200; } + else if(msg == NETMSG_CMD) + { + const char *pw = msg_unpack_string(); + const char *cmd = msg_unpack_string(); + if(config.rcon_password[0] != 0 && strcmp(pw, config.rcon_password) == 0) + { + dbg_msg("server", "cid=%d rcon='%s'", cid, cmd); + config_set(cmd); + } + } else { dbg_msg("server", "strange message cid=%d msg=%d data_size=%d", cid, msg, packet->data_size); diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 178330c2..301bfdd8 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1649,10 +1649,15 @@ void render_game() config_set(&chat_input[1]); else { - msg_pack_start(MSG_SAY, MSGFLAG_VITAL); - msg_pack_string(chat_input, 512); - msg_pack_end(); - client_send_msg(); + if(inp_key_pressed(KEY_RSHIFT) || inp_key_pressed(KEY_LSHIFT)) + client_rcon(chat_input); + else + { + msg_pack_start(MSG_SAY, MSGFLAG_VITAL); + msg_pack_string(chat_input, 512); + msg_pack_end(); + client_send_msg(); + } } } } |