aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui
diff options
context:
space:
mode:
authorF1F7Y <64418963+F1F7Y@users.noreply.github.com>2022-06-16 02:20:31 +0200
committerGitHub <noreply@github.com>2022-06-16 02:20:31 +0200
commit9fb0e0732c09b1b7f84c657d877b87516619950a (patch)
treef472a09d772534ed581b0917a997bd9ba901827e /Northstar.Client/mod/scripts/vscripts/ui
parentbdf8e684550ee4763e7eb93ae9e561ddc0dbde9a (diff)
downloadNorthstarMods-9fb0e0732c09b1b7f84c657d877b87516619950a.tar.gz
NorthstarMods-9fb0e0732c09b1b7f84c657d877b87516619950a.zip
Include server description in search (#388)v1.8.1-rc5v1.8.1-rc4v1.8.1-rc3
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut87
1 files changed, 43 insertions, 44 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
index 5f6cda1a..eb068374 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
@@ -760,54 +760,53 @@ void function FilterServerList()
totalPlayers += tempServer.serverPlayers
- // Branchless programming ;)
- if ( !( filterArguments.hideEmpty && tempServer.serverPlayers == 0 ) && !( filterArguments.hideFull && tempServer.serverPlayers == tempServer.serverPlayersMax ) && !( filterArguments.hideProtected && tempServer.serverProtected ) )
- {
- if ( filterArguments.useSearch )
- {
- string sName = tempServer.serverName.tolower() + " " + Localize( GetMapDisplayName( tempServer.serverMap ) ).tolower() + " " + tempServer.serverMap.tolower() + " " + tempServer.serverGamemode.tolower() + " " + Localize( tempServer.serverGamemode ).tolower()
-
- string sTerm = filterArguments.searchTerm.tolower()
-
- if ( sName.find( sTerm ) != null)
- {
- if ( filterArguments.filterMap != "SWITCH_ANY" && filterArguments.filterMap == tempServer.serverMap )
- {
- CheckGamemode( tempServer )
- }
- else if ( filterArguments.filterMap == "SWITCH_ANY" )
- {
- CheckGamemode( tempServer )
- }
- }
- }
- else
+ // Filters
+ if ( filterArguments.hideEmpty && tempServer.serverPlayers == 0 )
+ continue;
+
+ if ( filterArguments.hideFull && tempServer.serverPlayers == tempServer.serverPlayersMax )
+ continue;
+
+ if ( filterArguments.hideProtected && tempServer.serverProtected )
+ continue;
+
+ if ( filterArguments.filterMap != "SWITCH_ANY" && filterArguments.filterMap != tempServer.serverMap )
+ continue;
+
+ if ( filterArguments.filterGamemode != "SWITCH_ANY" && filterArguments.filterGamemode != tempServer.serverGamemode )
+ continue;
+
+ // Search
+ if ( filterArguments.useSearch )
+ {
+ array<string> sName
+ sName.append( tempServer.serverName.tolower() )
+ sName.append( Localize( GetMapDisplayName( tempServer.serverMap ) ).tolower() )
+ sName.append( tempServer.serverMap.tolower() )
+ sName.append( tempServer.serverGamemode.tolower() )
+ sName.append( Localize( tempServer.serverGamemode ).tolower() )
+ sName.append( NSGetServerDescription( i ).tolower() )
+
+ string sTerm = filterArguments.searchTerm.tolower()
+
+ bool found = false
+ for( int j = 0; j < sName.len(); j++ )
{
- if ( filterArguments.filterMap != "SWITCH_ANY" && filterArguments.filterMap == tempServer.serverMap )
- {
- CheckGamemode( tempServer )
- }
- else if ( filterArguments.filterMap == "SWITCH_ANY" )
- {
- CheckGamemode( tempServer )
- }
+ if ( sName[j].find( sTerm ) != null )
+ found = true
}
+
+ if ( !found )
+ continue;
}
- Hud_SetText( Hud_GetChild( file.menu, "InGamePlayerLabel" ), Localize("#INGAME_PLAYERS", string( totalPlayers ) ) )
- Hud_SetText( Hud_GetChild( file.menu, "TotalServerLabel" ), Localize("#TOTAL_SERVERS", string( NSGetServerCount() ) ) )
- }
-}
-
-void function CheckGamemode( serverStruct t )
-{
- if ( filterArguments.filterGamemode != "SWITCH_ANY" && filterArguments.filterGamemode == t.serverGamemode )
- {
- file.serversArrayFiltered.append( t )
- }
- else if ( filterArguments.filterGamemode == "SWITCH_ANY" )
- {
- file.serversArrayFiltered.append( t )
+
+ // Server fits our requirements, add it to the list
+ file.serversArrayFiltered.append( tempServer )
}
+
+ // Update player and server count
+ Hud_SetText( Hud_GetChild( file.menu, "InGamePlayerLabel" ), Localize("#INGAME_PLAYERS", string( totalPlayers ) ) )
+ Hud_SetText( Hud_GetChild( file.menu, "TotalServerLabel" ), Localize("#TOTAL_SERVERS", string( NSGetServerCount() ) ) )
}