Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove broken Server.ExternalPort setting. #15003

Merged
merged 1 commit into from Mar 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenRA.Game/Server/Server.cs
Expand Up @@ -135,7 +135,7 @@ public Server(IPEndPoint endpoint, ServerSettings settings, ModData modData, boo
randomSeed = (int)DateTime.Now.ToBinary();

if (UPnP.Status == UPnPStatus.Enabled)
UPnP.ForwardPort(Settings.ListenPort, Settings.ExternalPort).Wait();
UPnP.ForwardPort(Settings.ListenPort, Settings.ListenPort).Wait();

foreach (var trait in modData.Manifest.ServerTraits)
serverTraits.Add(modData.ObjectCreator.CreateObject<ServerTrait>(trait));
Expand Down
4 changes: 0 additions & 4 deletions OpenRA.Game/Settings.cs
Expand Up @@ -14,7 +14,6 @@
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using OpenRA.Graphics;
using OpenRA.Traits;

Expand Down Expand Up @@ -42,9 +41,6 @@ public class ServerSettings
[Desc("Sets the internal port.")]
public int ListenPort = 1234;

[Desc("Sets the port advertised to the master server.")]
public int ExternalPort = 1234;

[Desc("Reports the game to the master server list.")]
public bool AdvertiseOnline = true;

Expand Down
10 changes: 1 addition & 9 deletions OpenRA.Mods.Common/Widgets/Logic/ServerCreationLogic.cs
Expand Up @@ -97,10 +97,6 @@ public ServerCreationLogic(Widget widget, ModData modData, Action onExit, Action

advertiseOnline = Game.Settings.Server.AdvertiseOnline;

var externalPort = panel.Get<TextFieldWidget>("EXTERNAL_PORT");
externalPort.Text = settings.Server.ExternalPort.ToString();
externalPort.IsDisabled = () => !advertiseOnline;

var advertiseCheckbox = panel.Get<CheckboxWidget>("ADVERTISE_CHECKBOX");
advertiseCheckbox.IsChecked = () => advertiseOnline;
advertiseCheckbox.OnClick = () =>
Expand Down Expand Up @@ -182,20 +178,16 @@ void BuildNotices()
void CreateAndJoin()
{
var name = Settings.SanitizedServerName(panel.Get<TextFieldWidget>("SERVER_NAME").Text);
int listenPort, externalPort;
int listenPort;
if (!Exts.TryParseIntegerInvariant(panel.Get<TextFieldWidget>("LISTEN_PORT").Text, out listenPort))
listenPort = 1234;

if (!Exts.TryParseIntegerInvariant(panel.Get<TextFieldWidget>("EXTERNAL_PORT").Text, out externalPort))
externalPort = 1234;

var passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
var password = passwordField != null ? passwordField.Text : "";

// Save new settings
Game.Settings.Server.Name = name;
Game.Settings.Server.ListenPort = listenPort;
Game.Settings.Server.ExternalPort = externalPort;
Game.Settings.Server.AdvertiseOnline = advertiseOnline;
Game.Settings.Server.Map = preview.Uid;
Game.Settings.Server.Password = password;
Expand Down
46 changes: 16 additions & 30 deletions mods/cnc/chrome/multiplayer-createserver.yaml
Expand Up @@ -3,7 +3,7 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
X: (WINDOW_RIGHT - WIDTH) / 2
Y: (WINDOW_BOTTOM - HEIGHT - 15) / 2
Width: 530
Height: 314
Height: 275
Children:
Label@TITLE:
Width: PARENT_RIGHT
Expand Down Expand Up @@ -63,47 +63,33 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
MaxLength: 5
Text: 1234
Checkbox@ADVERTISE_CHECKBOX:
X: 15
Y: 121
X: 180
Y: 87
Width: 150
Height: 20
Font: Regular
Text: Advertise Online
Label@EXTERNAL_PORT_LABEL:
X: 180
Y: 119
Width: 90
Height: 25
Align: Right
Text: External Port:
TextField@EXTERNAL_PORT:
X: 275
Y: 120
Width: 50
MaxLength: 5
Height: 25
Text: 1234
Label@NOTICES_HEADER_A:
X: 15
Y: 165
Y: 125
Height: 25
Align: Left
Font: Bold
Label@NOTICES_HEADER_B:
X: 15
Y: 165
Y: 125
Height: 25
Align: Left
Font: Bold
Label@NOTICES_HEADER_C:
X: 15
Y: 165
Y: 125
Height: 25
Align: Left
Font: Bold
Container@NOTICES_LAN:
X: 20
Y: 185
Y: 145
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -137,7 +123,7 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
Text: manually configure port forwarding on your router.
Container@NOTICES_NO_UPNP:
X: 20
Y: 185
Y: 145
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -168,7 +154,7 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
Height: 25
Font: Tiny
Align: Left
Text: connections from the External Port to your local IP and Port.
Text: connections to your local IP and Port.
Label@SETTINGS_A:
Y: 48
Width: 305
Expand All @@ -186,7 +172,7 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
Text: Advanced tab of the OpenRA settings menu.
Container@NOTICES_UPNP:
X: 20
Y: 185
Y: 145
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -253,18 +239,18 @@ Container@MULTIPLAYER_CREATESERVER_PANEL:
Height: 25
Font: Tiny
Align: Center
Button@MAP_BUTTON:
X: PARENT_RIGHT - 189
Y: PARENT_BOTTOM - 40
Width: 174
Height: 25
Text: Change Map
Button@BACK_BUTTON:
Key: return
Y: PARENT_BOTTOM - 36
Width: 140
Height: 35
Text: Back
Button@MAP_BUTTON:
X: PARENT_RIGHT - WIDTH - 150
Y: PARENT_BOTTOM - 36
Width: 140
Height: 35
Text: Change Map
Button@CREATE_BUTTON:
Key: return
X: PARENT_RIGHT - WIDTH
Expand Down
48 changes: 17 additions & 31 deletions mods/common/chrome/multiplayer-createserver.yaml
Expand Up @@ -3,7 +3,7 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
X: (WINDOW_RIGHT - WIDTH)/2
Y: (WINDOW_BOTTOM - HEIGHT)/2
Width: 530
Height: 345
Height: 315
Children:
Label@TITLE:
Y: 15
Expand Down Expand Up @@ -58,47 +58,33 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
MaxLength: 5
Text: 1234
Checkbox@ADVERTISE_CHECKBOX:
X: 20
Y: 151
X: 180
Y: 117
Width: 150
Height: 20
Font: Regular
Text: Advertise Online
Label@EXTERNAL_PORT_LABEL:
X: 180
Y: 149
Width: 90
Height: 25
Align: Right
Text: External Port:
TextField@EXTERNAL_PORT:
X: 275
Y: 150
Width: 50
MaxLength: 5
Height: 25
Text: 1234
Label@NOTICES_HEADER_A:
X: 20
Y: 185
Y: 155
Height: 25
Align: Left
Font: Bold
Label@NOTICES_HEADER_B:
X: 20
Y: 185
Y: 155
Height: 25
Align: Left
Font: Bold
Label@NOTICES_HEADER_C:
X: 20
Y: 185
Y: 155
Height: 25
Align: Left
Font: Bold
Container@NOTICES_LAN:
X: 25
Y: 205
Y: 175
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -132,7 +118,7 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
Text: manually configure port forwarding on your router.
Container@NOTICES_NO_UPNP:
X: 25
Y: 205
Y: 175
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -163,7 +149,7 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
Height: 25
Font: Tiny
Align: Left
Text: connections from the External Port to your local IP and Port.
Text: connections to your local IP and Port.
Label@SETTINGS_A:
Y: 48
Width: 305
Expand All @@ -181,7 +167,7 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
Text: Advanced tab of the OpenRA settings menu.
Container@NOTICES_UPNP:
X: 25
Y: 205
Y: 175
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Expand Down Expand Up @@ -249,25 +235,25 @@ Background@MULTIPLAYER_CREATESERVER_PANEL:
Font: Tiny
Align: Center
Button@MAP_BUTTON:
X: PARENT_RIGHT - 194
Y: 268
Width: 174
X: 20
Y: PARENT_BOTTOM - 45
Width: 120
Height: 25
Text: Change Map
Font: Bold
Button@BACK_BUTTON:
X: PARENT_RIGHT - 194
X: PARENT_RIGHT - WIDTH - 20
Y: PARENT_BOTTOM - 45
Width: 174
Width: 120
Height: 25
Text: Back
Font: Bold
Key: escape
Button@CREATE_BUTTON:
Key: return
X: 20
X: PARENT_RIGHT - 2*WIDTH - 30
Y: PARENT_BOTTOM - 45
Width: 174
Width: 120
Height: 25
Text: Create
Font: Bold
Expand Down