- convert svc_setinfo, bla bla, you know hte drill

This commit is contained in:
Adam Olsen 2001-10-18 07:23:33 +00:00
parent 634c2c6acf
commit d2fe052d59
3 changed files with 30 additions and 16 deletions

View file

@ -47,6 +47,13 @@ typedef struct net_svc_updateuserinfo_s
const char *userinfo;
} net_svc_updateuserinfo_t;
typedef struct net_svc_setinfo_s
{
byte slot;
const char *key;
const char *value;
} net_svc_setinfo_t;
typedef struct net_svc_download_s
{
short size;
@ -72,6 +79,7 @@ typedef struct net_svc_modellist_s
void NET_SVC_Print_Parse (net_svc_print_t *print, msg_t *message);
void NET_SVC_UpdateUserInfo_Parse (net_svc_updateuserinfo_t *updateuserinfo,
msg_t *message);
void NET_SVC_SetInfo_Parse (net_svc_setinfo_t *setinfo, msg_t *message);
void NET_SVC_Download_Parse (net_svc_download_t *download, msg_t *message);
void NET_SVC_Soundlist_Parse (net_svc_soundlist_t *soundlist, msg_t *message);
void NET_SVC_Modellist_Parse (net_svc_modellist_t *modellist, msg_t *message);

View file

@ -1019,28 +1019,26 @@ CL_ParseUpdateUserInfo (void)
void
CL_SetInfo (void)
{
char key[MAX_MSGLEN], value[MAX_MSGLEN];
int slot;
player_info_t *player;
int flags;
player_info_t *player;
net_svc_setinfo_t setinfo;
slot = MSG_ReadByte (net_message);
if (slot >= MAX_CLIENTS)
NET_SVC_SetInfo_Parse (&setinfo, net_message);
if (setinfo.slot >= MAX_CLIENTS)
Host_EndGame ("CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD");
player = &cl.players[slot];
player = &cl.players[setinfo.slot];
strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1);
key[sizeof (key) - 1] = 0;
strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1);
key[sizeof (value) - 1] = 0;
Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, setinfo.key,
setinfo.value);
Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value);
flags = !strequal (setinfo.key, "name");
flags |= strequal (setinfo.key, "team") << 1;
Info_SetValueForKey (player->userinfo, setinfo.key, setinfo.value,
MAX_INFO_STRING, flags);
Info_SetValueForKey (player->userinfo, key, value, MAX_INFO_STRING,
(!strequal (key, "name"))
| (strequal (key, "team") << 1));
CL_ProcessUserInfo (slot, player);
CL_ProcessUserInfo (setinfo.slot, player);
}
void

View file

@ -65,6 +65,14 @@ NET_SVC_UpdateUserInfo_Parse (net_svc_updateuserinfo_t *updateuserinfo,
updateuserinfo->userinfo = MSG_ReadString (message);
}
void
NET_SVC_SetInfo_Parse (net_svc_setinfo_t *setinfo, msg_t *message)
{
setinfo->slot = MSG_ReadByte (message);
setinfo->key = MSG_ReadString (message);
setinfo->value = MSG_ReadString (message);
}
void
NET_SVC_Download_Parse (net_svc_download_t *download, msg_t *message)
{