r2922 - trunk/data/qcsrc/menu-div0test/nexuiz

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Nov 9 04:20:27 EST 2007


Author: div0
Date: 2007-11-09 04:20:01 -0500 (Fri, 09 Nov 2007)
New Revision: 2922

Modified:
   trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_join.c
   trunk/data/qcsrc/menu-div0test/nexuiz/serverlist.c
Log:
add empty/full filters


Modified: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_join.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_join.c	2007-11-09 09:09:20 UTC (rev 2921)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_multiplayer_join.c	2007-11-09 09:20:01 UTC (rev 2922)
@@ -24,7 +24,15 @@
 	slist  = makeNexuizServerList();
 
 	me.TR(me);
-		me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Filter:"));
+		me.TD(me, 1, me.columns - 1.5, e = makeNexuizTextLabel(0, "Filter:"));
+		me.TD(me, 1, 0.75, e = makeNexuizCheckBox(0, string_null, "Empty"));
+			e.checked = slist.filterShowEmpty;
+			e.onClickEntity = slist;
+			e.onClick = ServerList_ShowEmpty_Click;
+		me.TD(me, 1, 0.75, e = makeNexuizCheckBox(0, string_null, "Full"));
+			e.checked = slist.filterShowFull;
+			e.onClickEntity = slist;
+			e.onClick = ServerList_ShowFull_Click;
 
 	me.TR(me);
 		me.TD(me, 1, 1, slist.sortButton1 = makeNexuizButton(string_null, '0 0 0'));

Modified: trunk/data/qcsrc/menu-div0test/nexuiz/serverlist.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/serverlist.c	2007-11-09 09:09:20 UTC (rev 2921)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/serverlist.c	2007-11-09 09:20:01 UTC (rev 2922)
@@ -21,6 +21,8 @@
 	ATTRIB(NexuizServerList, selectedServer, string, string_null) // to restore selected server when needed
 	METHOD(NexuizServerList, setSelected, void(entity, float))
 	METHOD(NexuizServerList, setSortOrder, void(entity, float, float))
+	ATTRIB(NexuizServerList, filterShowEmpty, float, 1)
+	ATTRIB(NexuizServerList, filterShowFull, float, 1)
 	ATTRIB(NexuizServerList, nextRefreshTime, float, 0)
 	METHOD(NexuizServerList, refreshServerList, void(entity, float)) // refresh mode: 0 = just reparametrize, 1 = send new requests, 2 = clear
 	ATTRIB(NexuizServerList, needsRefresh, float, 1)
@@ -39,6 +41,8 @@
 entity makeNexuizServerList();
 void ServerList_Connect_Click(entity btn, entity me);
 void ServerList_Refresh_Click(entity btn, entity me);
+void ServerList_ShowEmpty_Click(entity box, entity me);
+void ServerList_ShowFull_Click(entity box, entity me);
 #endif
 
 #ifdef IMPLEMENTATION
@@ -117,6 +121,10 @@
 	else */
 	{
 		resethostcachemasks();
+		if(!me.filterShowEmpty)
+			sethostcachemasknumber(SLIST_MASK_AND + 0, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
+		if(!me.filterShowFull)
+			sethostcachemasknumber(SLIST_MASK_AND + 1, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL);
 		sethostcachesort(me.currentSortField, me.currentSortOrder < 0);
 		resorthostcache();
 		if(mode >= 1)
@@ -182,6 +190,16 @@
 {
 	me.setSortOrder(me, SLIST_FIELD_NUMHUMANS, -1);
 }
+void ServerList_ShowEmpty_Click(entity box, entity me)
+{
+	box.checked = me.filterShowEmpty = !me.filterShowEmpty;
+	me.refreshServerList(me, 0);
+}
+void ServerList_ShowFull_Click(entity box, entity me)
+{
+	box.checked = me.filterShowFull = !me.filterShowFull;
+	me.refreshServerList(me, 0);
+}
 void setSortOrderNexuizServerList(entity me, float field, float direction)
 {
 	if(me.currentSortField == field)




More information about the nexuiz-commits mailing list