/* * @brief */ static void Cl_ParseServerData(void) { char *str; int32_t i; // wipe the cl_client_t struct Cl_ClearState(); cls.state = CL_CONNECTED; cls.key_state.dest = KEY_CONSOLE; // parse protocol version number i = Net_ReadLong(&net_message); // ensure protocol matches if (i != PROTOCOL) { Com_Error(ERR_DROP, "Server is using unknown protocol %d\n", i); } // retrieve spawn count and packet rate cl.server_count = Net_ReadLong(&net_message); cl.server_hz = Net_ReadLong(&net_message); // determine if we're viewing a demo cl.demo_server = Net_ReadByte(&net_message); // game directory str = Net_ReadString(&net_message); if (g_strcmp0(Cvar_GetString("game"), str)) { Fs_SetGame(str); // reload the client game Cl_InitCgame(); } // parse player entity number cl.entity_num = Net_ReadShort(&net_message); // get the full level name str = Net_ReadString(&net_message); Com_Print("\n"); Com_Print("%c%s\n", 2, str); }
/** * @brief */ static void Cl_ParseServerData(void) { // wipe the cl_client_t struct Cl_ClearState(); Cl_SetKeyDest(KEY_CONSOLE); // parse protocol version number const uint16_t major = Net_ReadShort(&net_message); const uint16_t minor = Net_ReadShort(&net_message); // ensure protocol major matches if (major != PROTOCOL_MAJOR) { Com_Error(ERROR_DROP, "Server is using protocol major %d\n", major); } // determine if we're viewing a demo cl.demo_server = Net_ReadByte(&net_message); // game directory char *str = Net_ReadString(&net_message); if (g_strcmp0(Cvar_GetString("game"), str)) { Fs_SetGame(str); // reload the client game Cl_InitCgame(); } // ensure protocol minor matches if (minor != cls.cgame->protocol) { Com_Error(ERROR_DROP, "Server is using protocol minor %d\n", minor); } // parse client slot number, which is our entity number + 1 cl.client_num = Net_ReadShort(&net_message); // get the full level name str = Net_ReadString(&net_message); Com_Print("\n"); Com_Print("^2%s^7\n", str); }