From a7cb36877cb1d2c79dfbff1e373e9dd7d4a4913d Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 27 Apr 2008 05:56:56 +0000 Subject: [PATCH] commited the small thing that I had before I reinstall my machine --- default.bam | 10 ---------- scripts/tw_api.py | 30 ++++++++++++++---------------- src/game/client/gc_client.cpp | 2 +- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/default.bam b/default.bam index 7774b1412..d76d5cfda 100644 --- a/default.bam +++ b/default.bam @@ -25,16 +25,6 @@ function rc(output, input) return os.execute("rc /fo " .. output .. " " .. input) end -function cmd5(output, inputs) - print("cmd5 " .. PathFilename(output)) - cmd = cmd5_tool .. " " - for i,v in inputs do - cmd = cmd .. v .. " " - end - cmd = cmd .. " > " .. output - return os.execute(cmd) -end - function cmd5(output, inputs) cmd = cmd5_tool .. " " for i,v in inputs do diff --git a/scripts/tw_api.py b/scripts/tw_api.py index ce22c4a33..9081063b9 100644 --- a/scripts/tw_api.py +++ b/scripts/tw_api.py @@ -3,7 +3,7 @@ from socket import * import struct import sys -def tw_get_server_info(address, port): +def get_server_info(address, port): try: sock = socket(AF_INET, SOCK_DGRAM) sock.settimeout(1.5); @@ -39,7 +39,7 @@ def tw_get_server_info(address, port): except: return None -def tw_get_server_count(address, port): +def get_server_count(address, port): try: sock = socket(AF_INET, SOCK_DGRAM) sock.settimeout(1.5); @@ -52,7 +52,7 @@ def tw_get_server_count(address, port): except: return -1 -def tw_get_servers(address): +def get_servers(address): counter = 0 master_port = 8300 servers = [] @@ -78,23 +78,21 @@ def tw_get_servers(address): return None -#tw_get_server_info("10.0.0.2", 8303) - -#sys.exit(-1) - -servers = [] -for i in range(1, 16): - addr = "master%d.teeworlds.com"%i - list = tw_get_servers(addr) - if list: - print "%s had %d servers" % (addr, len(list)) - servers += list +def get_all_servers(): + servers = [] + for i in range(1, 16): + addr = "master%d.teeworlds.com"%i + list = get_servers(addr) + if list: + servers += list + return servers +servers = get_all_servers() total_players = 0 for server in servers: print "checking server", server[0], server[1] - info = tw_get_server_info(server[0], server[1]) + info = get_server_info(server[0], server[1]) if info: total_players += len(info["players"]) -print total_players +print total_players, "on", len(servers), 'servers' diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 2aeb28b96..ae22a4799 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -902,7 +902,7 @@ void render_game() server_motd_time = 0; else if (chat_mode) chat_mode = CHATMODE_NONE; - else + else if(!console_active()) { menu_active = !menu_active; if(menu_active)