diff options
| author | MichaelTheShifter <[email protected]> | 2016-06-26 07:46:56 -0400 |
|---|---|---|
| committer | MichaelTheShifter <[email protected]> | 2016-06-26 07:46:56 -0400 |
| commit | a14470ce12c09a87665521387bee2f982cd5a6d0 (patch) | |
| tree | 4d6e41b24905341966bbae29256163f212eb88e9 /source/WindowsFormsApplication1/Apps/NetworkBrowser.cs | |
| parent | 2963b1bff26afef38e40ba6b04644cb5996316af (diff) | |
| download | shiftos-c--a14470ce12c09a87665521387bee2f982cd5a6d0.tar.gz shiftos-c--a14470ce12c09a87665521387bee2f982cd5a6d0.tar.bz2 shiftos-c--a14470ce12c09a87665521387bee2f982cd5a6d0.zip | |
Fix crash with phantom clients while matchmaking
Diffstat (limited to 'source/WindowsFormsApplication1/Apps/NetworkBrowser.cs')
| -rw-r--r-- | source/WindowsFormsApplication1/Apps/NetworkBrowser.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/WindowsFormsApplication1/Apps/NetworkBrowser.cs b/source/WindowsFormsApplication1/Apps/NetworkBrowser.cs index 92c87cb..1890744 100644 --- a/source/WindowsFormsApplication1/Apps/NetworkBrowser.cs +++ b/source/WindowsFormsApplication1/Apps/NetworkBrowser.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Online.Hacking; namespace ShiftOS { @@ -388,6 +389,45 @@ Those above values only matter if the leader decides to become a friend. If they API.CurrentSave.MyOnlineNetwork.Codepoints = API.Codepoints; Package_Grabber.SendMessage(selected_server.IPAddress, "join_lobby", API.CurrentSave.MyOnlineNetwork); Online.Hacking.Matchmaker.Matchmake(selected_server); + var t = new System.Windows.Forms.Timer(); + t.Interval = 5000; + int sindex = 0; + t.Tick += (o, a) => + { + SetupSidePane(Online.Hacking.Matchmaker.Players[sindex]); + if(sindex < Online.Hacking.Matchmaker.Players.Count - 1) + { + sindex = 0; + } + else + { + sindex += 1; + } + }; + t.Start(); + } + + private void SetupSidePane(Network network) + { + try + { + lbtitle.Text = network.Name; + lbnetdesc.Text = $@"{network.Description} + + - {network.Codepoints} codepoints. + - {network.Wins} wins, {network.Losses} losses."; + } + catch + { + lbtitle.Text = "<null>"; + lbnetdesc.Text = @"<no description> + + - unknown codepoints. + - unknown wins, unknown losses. + + +If you see this happen, it's a phantom client. The server won't pair you with it."; + } } private void stop_matchmake(object sender, FormClosingEventArgs e) |
