Merge pull request #278 from DanielGibson/remember-addressbook

Don't forget entries of Multiplayer "Address Book"
This commit is contained in:
Yamagi 2018-02-13 17:35:59 +01:00 committed by GitHub
commit f0240af308
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 7 deletions

View file

@ -366,7 +366,7 @@ NET_AdrToString(netadr_t a)
}
qboolean
NET_StringToSockaddr(char *s, struct sockaddr_storage *sadr)
NET_StringToSockaddr(const char *s, struct sockaddr_storage *sadr)
{
char copy[128];
char *addrs, *space;
@ -440,7 +440,7 @@ NET_StringToSockaddr(char *s, struct sockaddr_storage *sadr)
}
qboolean
NET_StringToAdr(char *s, netadr_t *a)
NET_StringToAdr(const char *s, netadr_t *a)
{
struct sockaddr_storage sadr;

View file

@ -385,7 +385,7 @@ NET_AdrToString(netadr_t a)
* 192.246.40.70:28000
*/
qboolean
NET_StringToSockaddr(char *s, struct sockaddr_storage *sadr)
NET_StringToSockaddr(const char *s, struct sockaddr_storage *sadr)
{
char copy[128];
char *addrs, *space;
@ -465,7 +465,7 @@ NET_StringToSockaddr(char *s, struct sockaddr_storage *sadr)
* 192.246.40.70:28000
*/
qboolean
NET_StringToAdr(char *s, netadr_t *a)
NET_StringToAdr(const char *s, netadr_t *a)
{
struct sockaddr_storage sadr;

View file

@ -494,7 +494,7 @@ CL_PingServers_f(void)
int i;
netadr_t adr;
char name[32];
char *adrstring;
const char *adrstring;
cvar_t *noudp;
cvar_t *noipx;
@ -530,7 +530,7 @@ CL_PingServers_f(void)
for (i = 0; i < 16; i++)
{
Com_sprintf(name, sizeof(name), "adr%i", i);
adrstring = (char *)Cvar_VariableString(name);
adrstring = Cvar_VariableString(name);
if (!adrstring || !adrstring[0])
{

View file

@ -4380,6 +4380,15 @@ M_Init(void)
Cmd_AddCommand("menu_options", M_Menu_Options_f);
Cmd_AddCommand("menu_keys", M_Menu_Keys_f);
Cmd_AddCommand("menu_quit", M_Menu_Quit_f);
/* initialize the server address book cvars (adr0, adr1, ...)
* so the entries are not lost if you don't open the address book */
for (int index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++)
{
char buffer[20];
Com_sprintf(buffer, sizeof(buffer), "adr%d", index);
Cvar_Get(buffer, "", CVAR_ARCHIVE);
}
}
void

View file

@ -531,7 +531,7 @@ qboolean NET_CompareAdr(netadr_t a, netadr_t b);
qboolean NET_CompareBaseAdr(netadr_t a, netadr_t b);
qboolean NET_IsLocalAddress(netadr_t adr);
char *NET_AdrToString(netadr_t a);
qboolean NET_StringToAdr(char *s, netadr_t *a);
qboolean NET_StringToAdr(const char *s, netadr_t *a);
void NET_Sleep(int msec);
/*=================================================================== */