This commit is contained in:
CaptainSegis 2016-10-26 10:43:30 -05:00
commit 6dbf882698

View File

@ -42,7 +42,7 @@ Public Class JoinServerScreen
Me.ServerList.Add(localServer) Me.ServerList.Add(localServer)
If System.IO.File.Exists(GameController.GamePath & "\Save\server_list.dat") = False Then If System.IO.File.Exists(GameController.GamePath & "\Save\server_list.dat") = False Then
System.IO.File.WriteAllText(GameController.GamePath & "\Save\server_list.dat", "Official Pokémon3D Server,karp.pokemon3d.net:15124") System.IO.File.WriteAllText(GameController.GamePath & "\Save\server_list.dat", "Official Pokémon3D Server,karp.pokemon3d.net:15124" & vbNewLine & "AGN Server,p3d.aggressivegaming.org:15124")
End If End If
If LoadOnlineServers = True Then If LoadOnlineServers = True Then
@ -411,6 +411,7 @@ Public Class JoinServerScreen
'TTL: 10000 ticks, usually at 60 Hz => 10000/60 seconds 'TTL: 10000 ticks, usually at 60 Hz => 10000/60 seconds
While sw.ElapsedMilliseconds < 10000 And Me.Pinged = False While sw.ElapsedMilliseconds < 10000 And Me.Pinged = False
'wait for server connection in main thread. 'wait for server connection in main thread.
Threading.Thread.Sleep(1)
End While End While
sw.Stop() sw.Stop()
@ -440,7 +441,6 @@ Public Class JoinServerScreen
Private Sub StartPing() Private Sub StartPing()
Dim sw As New Stopwatch() Dim sw As New Stopwatch()
sw.Start()
Try Try
Dim client As New TcpClient() Dim client As New TcpClient()
@ -454,6 +454,7 @@ Public Class JoinServerScreen
End If End If
Next Next
sw.Start()
client.Connect(connectIP, CInt(Me.Port)) client.Connect(connectIP, CInt(Me.Port))
If client.Connected = True Then If client.Connected = True Then
@ -468,6 +469,8 @@ Public Class JoinServerScreen
Dim p As New Servers.Package(streamr.ReadLine()) Dim p As New Servers.Package(streamr.ReadLine())
If p.IsValid = True Then If p.IsValid = True Then
If p.PackageType = Servers.Package.PackageTypes.ServerInfoData Then If p.PackageType = Servers.Package.PackageTypes.ServerInfoData Then
sw.Stop()
CurrentPlayersOnline = CInt(p.DataItems(0)) CurrentPlayersOnline = CInt(p.DataItems(0))
MaxPlayersOnline = CInt(p.DataItems(1)) MaxPlayersOnline = CInt(p.DataItems(1))
Name = p.DataItems(2) Name = p.DataItems(2)
@ -500,7 +503,6 @@ Public Class JoinServerScreen
End Try End Try
Me.Pinged = True Me.Pinged = True
sw.Stop()
Me.PingResult = CInt(sw.ElapsedMilliseconds) Me.PingResult = CInt(sw.ElapsedMilliseconds)
End Sub End Sub