]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
More prominently show if server has stats enabled
authorFreddy <schro.sb@gmail.com>
Thu, 3 Jan 2019 14:17:38 +0000 (15:17 +0100)
committerFreddy <schro.sb@gmail.com>
Tue, 31 Dec 2019 19:22:05 +0000 (20:22 +0100)
qcsrc/common/constants.qh
qcsrc/common/playerstats.qc
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qh
qcsrc/menu/xonotic/serverlist.qc

index a7e7da546e0b05337766b8247b2832be94c7438c..7d5a5ca4d155e26f21ded18fae58868f852142af 100644 (file)
@@ -16,9 +16,9 @@ const int KEY_ATCK2 = BIT(7);
 ///////////////////////////
 // cvar constants
 
-const int CVAR_SAVE = 1;
-const int CVAR_NOTIFY = 2;
-const int CVAR_READONLY = 4;
+const int CVAR_SAVE = BIT(0);
+const int CVAR_NOTIFY = BIT(1);
+const int CVAR_READONLY = BIT(2);
 
 ///////////////////////////
 // csqc communication stuff
@@ -43,9 +43,10 @@ const int FRAGS_SPECTATOR = -666;
 const int FRAGS_PLAYER_OUT_OF_GAME = -616;
 
 // server flags
-const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
-const int SERVERFLAG_TEAMPLAY = 2;
-const int SERVERFLAG_PLAYERSTATS = 4;
+const int SERVERFLAG_ALLOW_FULLBRIGHT = BIT(0);
+const int SERVERFLAG_TEAMPLAY = BIT(1);
+const int SERVERFLAG_PLAYERSTATS = BIT(2);
+const int SERVERFLAG_PLAYERSTATS_CUSTOM = BIT(3);
 
 // a bit more constant
 const vector PL_MAX_CONST = '16 16 45';
index 511ac46e66eedc7a8b35ce447b328b56f1a89ff7..c065e6e293a10fa023c37c9320d9bc545c41e41b 100644 (file)
@@ -224,6 +224,10 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
                PlayerStats_GameReport_DelayMapVote = true;
 
                serverflags |= SERVERFLAG_PLAYERSTATS;
+               if(autocvar_g_playerstats_gamereport_uri != "http://stats.xonotic.org/stats/submit")
+               {
+                       serverflags |= SERVERFLAG_PLAYERSTATS_CUSTOM;
+               }
 
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ALIVETIME);
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_AVGLATENCY);
index 5745ce072e044940ddadd3d2e19dd41875e65dbb..3f39077c82143dd13fdce4dae390bc1df1fb89ca 100644 (file)
@@ -169,6 +169,10 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        if (!s) { s = _("N/A"); }
        me.currentServerKey = strzone(s);
        me.keyLabel.setText(me.keyLabel, me.currentServerKey);
+
+       me.currentServerStatsStatus = ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? ((sflags & SERVERFLAG_PLAYERSTATS_CUSTOM) ? _("custom stats server") : _("stats enabled")) : _("stats disabled"));
+       me.currentServerStatsStatus = strzone(me.currentServerStatsStatus);
+       me.statsLabel.setText(me.statsLabel, me.currentServerStatsStatus);
 }
 
 void XonoticServerInfoDialog_fill(entity me)
@@ -246,6 +250,11 @@ void XonoticServerInfoDialog_fill(entity me)
                me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
                        e.allowCut = 1;
                        me.idLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Stats:")));
+               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
+                       e.allowCut = 1;
+                       me.statsLabel = e;
 
        me.gotoRC(me, 2, 2.2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Players:")));
index 68f5ab8ca0c08cc95084715202fbb9ec5e442f36..f4f422991aa968a440926626416280745219e979 100644 (file)
@@ -24,6 +24,7 @@ CLASS(XonoticServerInfoDialog, XonoticDialog)
        ATTRIB(XonoticServerInfoDialog, currentServerID, string);
        ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string);
        ATTRIB(XonoticServerInfoDialog, currentServerPure, string);
+       ATTRIB(XonoticServerInfoDialog, currentServerStatsStatus, string);
 
        ATTRIB(XonoticServerInfoDialog, nameLabel, entity);
        ATTRIB(XonoticServerInfoDialog, cnameLabel, entity);
@@ -40,6 +41,7 @@ CLASS(XonoticServerInfoDialog, XonoticDialog)
        ATTRIB(XonoticServerInfoDialog, encryptLabel, entity);
        ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity);
        ATTRIB(XonoticServerInfoDialog, pureLabel, entity);
+       ATTRIB(XonoticServerInfoDialog, statsLabel, entity);
 ENDCLASS(XonoticServerInfoDialog)
 
 void Join_Click(entity btn, entity me);
index 021e9765119d7bf70861a5cdccca8d99c1108280..684cef920563258e94436b422ef6c8371307aeaf 100644 (file)
@@ -1033,7 +1033,20 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is
 
        // Stats
        if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS))
-               draw_Picture(iconPos, "icon_stats1", iconSize, '1 1 1', 1);
+       {
+               if (sflags & SERVERFLAG_PLAYERSTATS_CUSTOM)
+               {
+                       draw_Picture(iconPos, "icon_mod_", iconSize, '1 1 1', 1); // TODO: icon
+               }
+               else
+               {
+                       draw_Picture(iconPos, "icon_stats1", iconSize, '1 1 1', 1);
+               }
+       }
+       else
+       {
+               draw_Picture(iconPos, "icon_mod_jeff", iconSize, '1 1 1', 1); // TODO: icon
+       }
 
        if(isFocused && me.mouseOverIcons && !me.tooltip)
        {
@@ -1045,7 +1058,7 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is
                if(pure_available)
                        t = strcat(t, sprintf(" (%s)", (pure) ? _("official settings") : _("modified settings")));
                t = strcat(t, ", ");
-               t = strcat(t, ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? _("stats enabled") : _("stats disabled")));
+               t = strcat(t, ((sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS)) ? ((sflags & SERVERFLAG_PLAYERSTATS_CUSTOM) ? _("custom stats server") : _("stats enabled")) : _("stats disabled")));
                setZonedTooltip(me, t, string_null);
        }
        // --------------