private void button_Start_MouseClick(object sender, MouseEventArgs e) { textBoxClientMessages.ReadOnly = false; textBoxServerMessages.ReadOnly = false; int port; int players; bool isNr = false; String gameMode = "FFA"; String mapName = "Media/Maps/" + this.map_combobox.GetItemText(this.map_combobox.SelectedItem); String str_port = textBox_Port.Text.Trim(); String str_players = textBox_Players.Text.Trim(); if (FFARadioButton.Checked) { gameMode = "FFA"; } else if (TestGameModeRadioButton.Checked) { gameMode = "TestMode"; } isNr = int.TryParse(str_port, out port); if (!isNr) { MessageBox.Show("Invalid port: \"" + str_port + "\""); return; } isNr = int.TryParse(str_players, out players); if (!isNr) { MessageBox.Show("Invalid port: \"" + str_players + "\""); return; } if (players > MAX_PLAYERS || players <= 0) { MessageBox.Show("Invalid number of players: \"" + players + "\".\n" + "Valid number of players are are: 1-" + MAX_PLAYERS + "."); return; } String ret = m_ServerEngine.Init(port, players, gameMode, mapName); if (ret != "") { MessageBox.Show("Error: " + ret); } else { if (!this.m_ServerEngine.StartHost()) { MessageBox.Show("Error: Server was never initialized."); } else { this.button_Start.Enabled = false; max_pl = players; textBox_public_ip.Text = IPADD + ":" + textBox_Port.Text; } } }