Pull out the SMLAN server. It very out of date and not used besides the SMO server can act as a lan server. Also add a newline to the scoreboard.
This commit is contained in:
@@ -61,16 +61,6 @@ NetworkSyncManager::NetworkSyncManager( LoadingWindow *ld )
|
|||||||
LANserver = NULL; //So we know if it has been created yet
|
LANserver = NULL; //So we know if it has been created yet
|
||||||
BroadcastReception = NULL;
|
BroadcastReception = NULL;
|
||||||
|
|
||||||
if( GetCommandlineArgument( "runserver" ))
|
|
||||||
{
|
|
||||||
ld->SetText( INITIALIZING_SERVER );
|
|
||||||
LANserver = new StepManiaLanServer;
|
|
||||||
isLanServer = true;
|
|
||||||
GetCommandlineArgument( "runserver", &LANserver->servername );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
isLanServer = false;
|
|
||||||
|
|
||||||
ld->SetText( INITIALIZING_CLIENT_NETWORK );
|
ld->SetText( INITIALIZING_CLIENT_NETWORK );
|
||||||
NetPlayerClient = new EzSockets;
|
NetPlayerClient = new EzSockets;
|
||||||
NetPlayerClient->blocking = false;
|
NetPlayerClient->blocking = false;
|
||||||
@@ -100,12 +90,6 @@ NetworkSyncManager::~NetworkSyncManager ()
|
|||||||
BroadcastReception->close();
|
BroadcastReception->close();
|
||||||
SAFE_DELETE( BroadcastReception );
|
SAFE_DELETE( BroadcastReception );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isLanServer )
|
|
||||||
{
|
|
||||||
LANserver->ServerStop();
|
|
||||||
delete LANserver;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSyncManager::CloseConnection()
|
void NetworkSyncManager::CloseConnection()
|
||||||
@@ -184,21 +168,12 @@ void NetworkSyncManager::PostStartUp(const RString& ServerIP)
|
|||||||
|
|
||||||
bool dontExit = true;
|
bool dontExit = true;
|
||||||
|
|
||||||
//Don't block if the server is running
|
NetPlayerClient->blocking = true;
|
||||||
if( isLanServer )
|
|
||||||
NetPlayerClient->blocking = false;
|
|
||||||
else
|
|
||||||
NetPlayerClient->blocking = true;
|
|
||||||
|
|
||||||
//Following packet must get through, so we block for it.
|
//Following packet must get through, so we block for it.
|
||||||
//If we are serving we do not block for this.
|
//If we are serving we do not block for this.
|
||||||
NetPlayerClient->SendPack((char*)m_packet.Data,m_packet.Position);
|
NetPlayerClient->SendPack((char*)m_packet.Data,m_packet.Position);
|
||||||
|
|
||||||
//If we are serving, do this so we properly connect
|
|
||||||
//to the server.
|
|
||||||
if( isLanServer )
|
|
||||||
LANserver->ServerUpdate();
|
|
||||||
|
|
||||||
m_packet.ClearPacket();
|
m_packet.ClearPacket();
|
||||||
|
|
||||||
while (dontExit)
|
while (dontExit)
|
||||||
@@ -228,17 +203,6 @@ void NetworkSyncManager::StartUp()
|
|||||||
{
|
{
|
||||||
RString ServerIP;
|
RString ServerIP;
|
||||||
|
|
||||||
if( isLanServer )
|
|
||||||
if (!LANserver->ServerStart())
|
|
||||||
{
|
|
||||||
//If the server happens to not start when told,
|
|
||||||
//Print to log and release the memory where the
|
|
||||||
//server was held.
|
|
||||||
isLanServer = false;
|
|
||||||
LOG->Warn("Server failed to start.");
|
|
||||||
delete LANserver;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GetCommandlineArgument( "netip", &ServerIP ) )
|
if( GetCommandlineArgument( "netip", &ServerIP ) )
|
||||||
PostStartUp(ServerIP);
|
PostStartUp(ServerIP);
|
||||||
else if( GetCommandlineArgument( "listen" ) )
|
else if( GetCommandlineArgument( "listen" ) )
|
||||||
@@ -461,11 +425,7 @@ void NetworkSyncManager::StartRequest(short position)
|
|||||||
|
|
||||||
bool dontExit=true;
|
bool dontExit=true;
|
||||||
|
|
||||||
//Don't block if we are server.
|
NetPlayerClient->blocking=true;
|
||||||
if (isLanServer)
|
|
||||||
NetPlayerClient->blocking=false;
|
|
||||||
else
|
|
||||||
NetPlayerClient->blocking=true;
|
|
||||||
|
|
||||||
//The following packet HAS to get through, so we turn blocking on for it as well
|
//The following packet HAS to get through, so we turn blocking on for it as well
|
||||||
//Don't block if we are serving
|
//Don't block if we are serving
|
||||||
@@ -478,18 +438,14 @@ void NetworkSyncManager::StartRequest(short position)
|
|||||||
|
|
||||||
while (dontExit)
|
while (dontExit)
|
||||||
{
|
{
|
||||||
//Keep the server going during the loop.
|
|
||||||
if (isLanServer)
|
|
||||||
LANserver->ServerUpdate();
|
|
||||||
|
|
||||||
m_packet.ClearPacket();
|
m_packet.ClearPacket();
|
||||||
if (NetPlayerClient->ReadPack((char *)&m_packet, NETMAXBUFFERSIZE)<1)
|
if (NetPlayerClient->ReadPack((char *)&m_packet, NETMAXBUFFERSIZE)<1)
|
||||||
if (!isLanServer)
|
|
||||||
dontExit=false; // Also allow exit if there is a problem on the socket
|
dontExit=false; // Also allow exit if there is a problem on the socket
|
||||||
// Only do if we are not the server, otherwise the sync
|
// Only do if we are not the server, otherwise the sync
|
||||||
// gets hosed up due to non blocking mode.
|
// gets hosed up due to non blocking mode.
|
||||||
if (m_packet.Read1() == (NSServerOffset + NSCGSR))
|
|
||||||
dontExit=false;
|
if (m_packet.Read1() == (NSServerOffset + NSCGSR))
|
||||||
|
dontExit=false;
|
||||||
//Only allow passing on Start request.
|
//Only allow passing on Start request.
|
||||||
//Otherwise scoreboard updates and such will confuse us.
|
//Otherwise scoreboard updates and such will confuse us.
|
||||||
|
|
||||||
@@ -521,9 +477,6 @@ void NetworkSyncManager::DisplayStartupStatus()
|
|||||||
|
|
||||||
void NetworkSyncManager::Update(float fDeltaTime)
|
void NetworkSyncManager::Update(float fDeltaTime)
|
||||||
{
|
{
|
||||||
if (isLanServer)
|
|
||||||
LANserver->ServerUpdate();
|
|
||||||
|
|
||||||
if (useSMserver)
|
if (useSMserver)
|
||||||
ProcessInput();
|
ProcessInput();
|
||||||
|
|
||||||
@@ -652,7 +605,7 @@ void NetworkSyncManager::ProcessInput()
|
|||||||
case NSSB_GRADE:
|
case NSSB_GRADE:
|
||||||
ColumnData = "Grade\n";
|
ColumnData = "Grade\n";
|
||||||
for (int i=0;i<NumberPlayers;i++)
|
for (int i=0;i<NumberPlayers;i++)
|
||||||
ColumnData += GradeToLocalizedString( Grade(m_packet.Read1()) );
|
ColumnData += GradeToLocalizedString( Grade(m_packet.Read1()) ) + "\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_Scoreboard[ColumnNumber] = ColumnData;
|
m_Scoreboard[ColumnNumber] = ColumnData;
|
||||||
|
|||||||
Reference in New Issue
Block a user