fix redial dialog not honoring private clients (reported by Julien Langer)

git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@745 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
Ludwig Nussel 2005-08-23 18:22:19 +00:00 committed by l-n
parent a1360af64a
commit 3ca84e129e
5 changed files with 20 additions and 25 deletions

View File

@ -1,3 +1,7 @@
Aug 23, 2005: Ludwig Nussel <l-n@users.sourceforge.net>
- fix redial dialog not honoring private clients (reported by Julien
Langer)
Aug 20, 2005: Ludwig Nussel <l-n@users.sourceforge.net>
- fix gamespy and descent exec functions (reported by Steffen
Pankratz)

View File

@ -29,7 +29,7 @@
#include "stat.h"
#include "host.h"
#include "server.h"
#include "srv-list.h" /*pulp*/
#include "srv-list.h"
static gboolean launchnow;
@ -40,7 +40,7 @@ static const unsigned default_redial_wait = 5;
static int timeoutid;
static int res_slots; /*pulp*/
struct server_props* srv_props;
static void stat_redial_close_handler (struct stat_job *job, int killed);
static void stat_redial_server_handler (struct stat_job *job, struct server *s);
@ -142,8 +142,7 @@ static void stat_redial_close_handler (struct stat_job *job, int killed)
if (!killed)
{
if (con->s->curplayers < (con->s->maxplayers-res_slots)) /*pulp*/
//if (con->s->curplayers == 99)
if (!server_need_redial(con->s, srv_props))
{
// ok, free slot. launch!
launchnow = TRUE;
@ -249,7 +248,7 @@ static GtkWidget* create_redialwindow (void)
/** open redial dialog, return true if game should be launched, false otherwise */
gboolean redial_dialog (struct server* s, int r_slots) /*pulp*/
gboolean redial_dialog (struct server* s, struct server_props* props)
{
GtkWidget* progress;
@ -260,7 +259,7 @@ gboolean redial_dialog (struct server* s, int r_slots) /*pulp*/
timeoutid = -1;
countdown = 0;
res_slots=r_slots;
srv_props = props;
redial_window = create_redialwindow();
progress = gtk_object_get_data(GTK_OBJECT(redial_window),"secondsprogress");

View File

@ -20,8 +20,9 @@
#define _REDIAL_H__
#include "launch.h"
#include "srv-prop.h"
gboolean redial_dialog (struct server* s, int r_slots); /*pulp*/
gboolean redial_dialog (struct server* s, struct server_props* props);
#endif /* __ADDMASTER_H__ */

View File

@ -48,6 +48,13 @@ extern void properties_dialog (struct server *s);
extern void combo_set_vals (GtkWidget *combo, GList *strlist, const char *str);
static inline int server_need_redial(struct server* s, struct server_props* props)
{
return ((s->curplayers >= (s->maxplayers - (props?props->reserved_slots:0))) // really full
|| ((s->curplayers >= (s->maxplayers - s->private_client)) // private clients and no password set
&& !(props && props->server_password && *props->server_password))
);
}
#endif /* __SRV_PROP_H__ */

View File

@ -942,7 +942,6 @@ static gboolean check_launch (struct condef* con)
gboolean launch = FALSE;
struct server *s;
int reserved_slots;
if (!con)
return FALSE;
@ -987,22 +986,7 @@ static gboolean check_launch (struct condef* con)
}
}
/*pulp*/
if (props && props->reserved_slots)
{
reserved_slots=props->reserved_slots;
}
else
{
reserved_slots=0;
}
if (!launch && !con->spectate
&& ( (s->curplayers >= (s->maxplayers - reserved_slots)) // really full
|| ((s->curplayers >= (s->maxplayers - s->private_client)) // private clients and no password set
&& !(props && props->server_password && *props->server_password))
))
if (!launch && !con->spectate && server_need_redial(s, props))
{
launch = dialog_yesnoredial (NULL, 1, _("Launch"), _("Cancel"), _("Redial"),
_("Server %s:%d is full.\n\nLaunch client anyway?"),
@ -1016,7 +1000,7 @@ static gboolean check_launch (struct condef* con)
{
redialserver = 1;
launch = redial_dialog(con->s,reserved_slots);/*pulp*/
launch = redial_dialog(con->s, props);
if(launch == FALSE)
{