summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-05-18 22:28:46 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-05-18 22:30:39 +0200
commit68d2b3ae9ec3ef78167c20f1c9662c5020ee1f04 (patch)
treec0ad32201bd38c95ef118ae8697f61118918b0fc /src/game
parent45cdb9ec54ba66201a1d47d699802e85fca8df53 (diff)
Basic implementation of !versions.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_admin.c23
-rw-r--r--src/game/g_admin.h2
-rw-r--r--src/game/g_client.c4
-rw-r--r--src/game/g_local.h3
4 files changed, 31 insertions, 1 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 2de9296..e6b3132 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -458,7 +458,10 @@ g_admin_cmd_t g_admin_cmds[ ] =
" * will unpause all players, using no argument will unpause game clock",
"(^5name|slot|*^7)"
},
-
+ {"versions", G_admin_versions, "namelog",
+ "Check what versions of Tremulous players are running.",
+ ""
+ },
{
"warn", G_admin_warn, "warn",
"Warn a player to cease or face admin intervention",
@@ -10381,3 +10384,21 @@ qboolean G_admin_give(gentity_t *ent, int skiparg)
return qtrue;
}
+qboolean G_admin_versions(gentity_t *ent, int skiparg)
+{
+ int i;
+
+ ADMBP_begin();
+
+ for (i = 0; i < level.maxclients; i++) {
+ gclient_t *client = level.clients + i;
+
+ if (client->pers.connected == CON_DISCONNECTED)
+ continue;
+
+ ADMBP(va("% 2d '%s'\n", i, client->pers.version));
+ }
+
+ ADMBP_end();
+ return qtrue;
+}
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index d980ba8..54ea9f3 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -367,6 +367,8 @@ qboolean G_admin_scrim( gentity_t *ent, int skiparg );
qboolean G_admin_give( gentity_t *ent, int skiparg );
+qboolean G_admin_versions( gentity_t *ent, int skiparg );
+
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
void G_admin_buffer_begin( void );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index f9a72ea..6044136 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1142,6 +1142,10 @@ void ClientUserinfoChanged( int clientNum, qboolean forceName )
if( !strcmp( s, "localhost" ) )
client->pers.localClient = qtrue;
+ // check the version
+ s = Info_ValueForKey( userinfo, "version" );
+ Q_strncpyz( client->pers.version, s, MAX_CLIENT_VERSION );
+
// check the item prediction
s = Info_ValueForKey( userinfo, "cg_predictItems" );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index a3c02c8..5a8d1f8 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -373,6 +373,8 @@ typedef struct
long timeLastViewed;
} statsCounters_level;
+#define MAX_CLIENT_VERSION 80
+
// client data that stays across multiple respawns, but is cleared
// on each level change or team change at ClientBegin()
typedef struct
@@ -440,6 +442,7 @@ typedef struct
qboolean firstConnect; // This is the first map since connect
qboolean useUnlagged;
statsCounters_t statscounters;
+ char version[ MAX_CLIENT_VERSION ];
} clientPersistant_t;
#define MAX_UNLAGGED_MARKERS 256