Hide server option field if there are no servers found
This commit is contained in:
@@ -59,6 +59,7 @@ void ScreenNetworkOptions::Init()
|
|||||||
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
||||||
vHands.push_back( pHand );
|
vHands.push_back( pHand );
|
||||||
pHand->m_Def.m_bAllowThemeItems = false;
|
pHand->m_Def.m_bAllowThemeItems = false;
|
||||||
|
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||||
pHand->m_Def.m_sName = "Server";
|
pHand->m_Def.m_sName = "Server";
|
||||||
pHand->m_Def.m_vsChoices.push_back("Stop");
|
pHand->m_Def.m_vsChoices.push_back("Stop");
|
||||||
pHand->m_Def.m_vsChoices.push_back("Start");
|
pHand->m_Def.m_vsChoices.push_back("Start");
|
||||||
@@ -68,21 +69,23 @@ void ScreenNetworkOptions::Init()
|
|||||||
vHands.push_back( pHand );
|
vHands.push_back( pHand );
|
||||||
pHand->m_Def.m_sName = "Scoreboard";
|
pHand->m_Def.m_sName = "Scoreboard";
|
||||||
pHand->m_Def.m_vsChoices.clear();
|
pHand->m_Def.m_vsChoices.clear();
|
||||||
|
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||||
pHand->m_Def.m_vsChoices.push_back("Off");
|
pHand->m_Def.m_vsChoices.push_back("Off");
|
||||||
pHand->m_Def.m_vsChoices.push_back("On");
|
pHand->m_Def.m_vsChoices.push_back("On");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
|
||||||
vHands.push_back( pHand );
|
|
||||||
pHand->m_Def.m_sName = "Servers";
|
|
||||||
|
|
||||||
// Get info on all received servers from NSMAN.
|
// Get info on all received servers from NSMAN.
|
||||||
|
AllServers.clear();
|
||||||
NSMAN->GetListOfLANServers( AllServers );
|
NSMAN->GetListOfLANServers( AllServers );
|
||||||
if( AllServers.size() == 0 )
|
if( !AllServers.empty() )
|
||||||
pHand->m_Def.m_vsChoices.push_back( "-none-" );
|
{
|
||||||
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
||||||
for( unsigned int j = 0; j < AllServers.size(); j++ )
|
pHand->m_Def.m_sName = "Servers";
|
||||||
pHand->m_Def.m_vsChoices.push_back( AllServers[j].Name );
|
for( unsigned int j = 0; j < AllServers.size(); j++ )
|
||||||
|
pHand->m_Def.m_vsChoices.push_back( AllServers[j].Name );
|
||||||
|
vHands.push_back( pHand );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InitMenu( vHands );
|
InitMenu( vHands );
|
||||||
@@ -174,13 +177,18 @@ void ScreenNetworkOptions::MenuStart( const InputEventPlus &input )
|
|||||||
PREFSMAN->m_bEnableScoreboard.Set(false);
|
PREFSMAN->m_bEnableScoreboard.Set(false);
|
||||||
break;
|
break;
|
||||||
case PO_SERVERS:
|
case PO_SERVERS:
|
||||||
if ( AllServers.size() != 0 )
|
if ( !AllServers.empty() )
|
||||||
{
|
{
|
||||||
string sNewName = AllServers[m_pRows[GetCurrentRow()]->GetOneSharedSelection()].Address;
|
string sNewName = AllServers[m_pRows[GetCurrentRow()]->GetOneSharedSelection()].Address;
|
||||||
NSMAN->PostStartUp(sNewName);
|
NSMAN->PostStartUp(sNewName);
|
||||||
NSMAN->DisplayStartupStatus();
|
NSMAN->DisplayStartupStatus();
|
||||||
UpdateConnectStatus( );
|
UpdateConnectStatus( );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//If the server list is empty, keep passing the message on so exit works
|
||||||
|
ScreenOptions::MenuStart( input );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ScreenOptions::MenuStart( input );
|
ScreenOptions::MenuStart( input );
|
||||||
|
|||||||
Reference in New Issue
Block a user