diff --git a/src/backends/unix/network.c b/src/backends/unix/network.c index 2c81e63a..9b198057 100644 --- a/src/backends/unix/network.c +++ b/src/backends/unix/network.c @@ -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; diff --git a/src/backends/windows/network.c b/src/backends/windows/network.c index 801b294a..11c255d4 100644 --- a/src/backends/windows/network.c +++ b/src/backends/windows/network.c @@ -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; diff --git a/src/client/cl_network.c b/src/client/cl_network.c index 3a8496f9..028de796 100644 --- a/src/client/cl_network.c +++ b/src/client/cl_network.c @@ -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]) { diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index 3c6b936c..f078a270 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -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 diff --git a/src/common/header/common.h b/src/common/header/common.h index c94fec50..a1d40749 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -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); /*=================================================================== */