From: Samual Lenks Date: Sun, 15 Sep 2013 01:18:45 +0000 (-0400) Subject: Implement a "requiresConnect" attribute for menu dialogs X-Git-Tag: xonotic-v0.8.0~331^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d45fa146e8e49ef80f45f2de8fbbcc92cdbb67fc;p=xonotic%2Fxonotic-data.pk3dir.git Implement a "requiresConnect" attribute for menu dialogs --- diff --git a/qcsrc/menu/item/dialog.c b/qcsrc/menu/item/dialog.c index ed73be095..5fa010353 100644 --- a/qcsrc/menu/item/dialog.c +++ b/qcsrc/menu/item/dialog.c @@ -58,6 +58,8 @@ CLASS(Dialog) EXTENDS(InputContainer) ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0) ATTRIB(Dialog, zoomedOutTitleBar, float, 0) + ATTRIB(Dialog, requiresConnection, float, 0) // set to TRUE if the dialog requires a connection to be opened + ATTRIB(Dialog, backgroundImage, string, string_null) ATTRIB(Dialog, borderLines, float, 1) ATTRIB(Dialog, closeButtonImage, string, string_null) diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 7339e6969..1afc9f85d 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -991,7 +991,8 @@ void m_goto(string itemname) for(e = NULL; (e = find(e, name, itemname)); ) if(e.classname != "vtbl") break; - if(e) + + if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED)))) { m_hide(); m_activate_window(e); diff --git a/qcsrc/menu/xonotic/dialog_teamselect.c b/qcsrc/menu/xonotic/dialog_teamselect.c index 7fb154c8a..10efc3c25 100644 --- a/qcsrc/menu/xonotic/dialog_teamselect.c +++ b/qcsrc/menu/xonotic/dialog_teamselect.c @@ -12,6 +12,7 @@ CLASS(XonoticTeamSelectDialog) EXTENDS(XonoticRootDialog) ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL) ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL) ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL) + ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, TRUE) ENDCLASS(XonoticTeamSelectDialog) #endif