Implement a "requiresConnect" attribute for menu dialogs
authorSamual Lenks <samual@xonotic.org>
Sun, 15 Sep 2013 01:18:45 +0000 (21:18 -0400)
committerSamual Lenks <samual@xonotic.org>
Sun, 15 Sep 2013 01:18:45 +0000 (21:18 -0400)
qcsrc/menu/item/dialog.c
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/dialog_teamselect.c

index ed73be0..5fa0103 100644 (file)
@@ -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)
index 7339e69..1afc9f8 100644 (file)
@@ -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);
index 7fb154c..10efc3c 100644 (file)
@@ -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