]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 ed73be09501a6a81db14751e73d824b5cd1a618e..5fa0103532ca74369d74bca47051f27f85c6aa25 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 7339e696950abb7a5de944a12eeca1acaa43a681..1afc9f85d935c3e5958a31ba9cdd206fbf56afc0 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 7fb154c8a29ba3d4193e375626ec9ee57edfbe89..10efc3c252ea3bd3a130acc4354c96861e17c238 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