UBrowser
Class UBrowserSubsetFact

source: e:\games\UnrealTournament\UBrowser\Classes\UBrowserSubsetFact.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowList
         |
         +--UBrowser.UBrowserServerListFactory
            |
            +--UBrowser.UBrowserSubsetFact
Direct Known Subclasses:None

class UBrowserSubsetFact
extends UBrowser.UBrowserServerListFactory


Variables
 string GameMode
 string GameType
 int MaxPing
 int MinPlayers
 string NotFoundError
 string NotReadyError
 float Ping
 name SupersetTag
 UBrowserServerListWindow SupersetWindow
 bool bCompatibleServersOnly
 bool bLocalServersOnly


Function Summary
 void ConsiderItem(UBrowserServerList L)
 void Query(optional bool, optional bool)
 void QueryFinished(bool bSuccess, optional string)
 void Shutdown(optional bool)



Source Code


00001	class UBrowserSubsetFact extends UBrowserServerListFactory;
00002	
00003	// Config
00004	var() config string		GameMode;
00005	var() config string		GameType;
00006	var() config float		Ping;
00007	var() config name		SupersetTag;
00008	var() config bool		bLocalServersOnly;
00009	var() config bool		bCompatibleServersOnly;
00010	var() config int		MinPlayers;
00011	var() config int		MaxPing;
00012	
00013	// Errors
00014	var localized string		NotFoundError;
00015	var localized string		NotReadyError;
00016	
00017	var UBrowserServerListWindow	SupersetWindow;
00018	
00019	function Query(optional bool bBySuperset, optional bool bInitial)
00020	{
00021		local UBrowserMainClientWindow W;
00022		local int i;
00023		local UBrowserServerList l, List;
00024	
00025		Super.Query(bBySuperset, bInitial);
00026	
00027		W = UBrowserMainClientWindow(Owner.Owner.GetParent(class'UBrowserMainClientWindow'));
00028	
00029		for(i=0;i<20;i++)
00030		{
00031			if(W.ServerListNames[i] == SupersetTag)
00032			{
00033				SupersetWindow = W.FactoryWindows[i];
00034				List = W.FactoryWindows[i].PingedList;
00035				break;
00036			}
00037		}
00038		
00039		if(SupersetWindow != None)
00040		{
00041			SupersetWindow.AddSubset(Self);
00042			Owner.Owner.AddSuperSet(SupersetWindow);
00043		}
00044		else
00045		{
00046			QueryFinished(False, NotFoundError$SupersetTag);	
00047		}
00048	
00049		if(List == None)
00050		{
00051			QueryFinished(False, NotReadyError$SupersetTag);	
00052		}
00053		else
00054		{
00055			if(!bBySuperset && !bInitial)
00056			{
00057				List.Owner.Refresh();
00058				return;
00059			}
00060	
00061			for(l = UBrowserServerList(List.Next);l != None;l = UBrowserServerList(l.Next)) 
00062				ConsiderItem(l);
00063			
00064			QueryFinished(True);
00065		}
00066	}
00067	
00068	function Shutdown(optional bool bBySuperset)
00069	{
00070		Super.Shutdown(bBySuperset);
00071		SupersetWindow.RemoveSubset(Self);
00072	}
00073	
00074	function ConsiderItem(UBrowserServerList L)
00075	{
00076		local UBrowserServerList NewItem;
00077		local int MinNetVer;
00078		local int GameVer;
00079	
00080		if(!L.bPinged)
00081			return;	
00082	
00083		if(bLocalServersOnly && !L.bLocalServer)
00084			return;
00085	
00086		MinNetVer = int(Owner.Owner.GetPlayerOwner().Level.MinNetVersion);
00087		GameVer = int(Owner.Owner.GetPlayerOwner().Level.EngineVersion);
00088	
00089		if(bCompatibleServersOnly && (L.MinNetVer > GameVer || MinNetVer > L.GameVer))
00090			return;
00091	
00092		if(GameMode != "" && GameMode != L.GameMode)
00093			return;
00094	
00095		if(GameType != "" && GameType != L.GameType)
00096			return;
00097	
00098		if(MinPlayers != 0 && L.NumPlayers < MinPlayers)
00099			return;
00100	
00101		if(MaxPing != 0 && L.Ping > MaxPing)
00102			return;
00103	
00104		if( PingedList.FindExistingServer( L.IP, L.QueryPort ) != None)
00105			return;
00106	
00107		NewItem = UBrowserServerList(Owner.CopyExistingListItem(L.Class, L));
00108		NewItem.Remove();
00109		PingedList.AppendItem(NewItem);
00110		Owner.bNeedUpdateCount = True;
00111	}
00112	
00113	function QueryFinished(bool bSuccess, optional string ErrorMsg)
00114	{
00115		Super.QueryFinished(bSuccess, ErrorMsg);	
00116	}
00117	
00118	defaultproperties
00119	{
00120	     Ping=9999.000000
00121	     SupersetTag=All
00122	     NotFoundError="Could not find the window: "
00123	     NotReadyError="Window is not ready: "
00124	}

End Source Code