Merge pull request #3475 from pchote/startgame-fix

Startgame fix and observer tweaks.
This commit is contained in:
Matthias Mailänder
2013-06-26 11:21:39 -07:00
5 changed files with 25 additions and 127 deletions

View File

@@ -55,12 +55,17 @@ namespace OpenRA.Mods.RA.Server
void CheckAutoStart(S server, Connection conn, Session.Client client)
{
var actualPlayers = server.conns
.Select(c => server.GetClient(c))
.Where(c => c.Slot != null);
var playerClients = server.lobbyInfo.Clients.Where(c => c.Bot == null && c.Slot != null);
if (actualPlayers.Count() > 0 && actualPlayers.All(c => c.State == Session.ClientState.Ready))
InterpretCommand(server, conn, client, "startgame");
// Are all players ready?
if (playerClients.Count() == 0 || playerClients.Any(c => c.State != Session.ClientState.Ready))
return;
// Are the map conditions satisfied?
if (server.lobbyInfo.Slots.Any(sl => sl.Value.Required && server.lobbyInfo.ClientInSlot(sl.Key) == null))
return;
server.StartGame();
}
public bool InterpretCommand(S server, Connection conn, Session.Client client, string cmd)
@@ -132,6 +137,7 @@ namespace OpenRA.Mods.RA.Server
{
client.Slot = null;
client.SpawnPoint = 0;
client.Color = HSLColor.FromRGB(255, 255, 255);
server.SyncLobbyInfo();
return true;
}},
@@ -525,8 +531,8 @@ namespace OpenRA.Mods.RA.Server
if (targetClient.Index != client.Index && !client.IsAdmin)
return true;
// Map has disabled color changes
if (targetClient.Slot != null && server.lobbyInfo.Slots[targetClient.Slot].LockColor)
// Spectator or map has disabled color changes
if (targetClient.Slot == null || server.lobbyInfo.Slots[targetClient.Slot].LockColor)
return true;
var ci = parts[1].Split(',').Select(cc => int.Parse(cc)).ToArray();

View File

@@ -459,8 +459,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
template = EditableSpectatorTemplate.Clone();
LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager);
LobbyUtils.SetupEditableColorWidget(template, null, c, orderManager, colorPreview);
LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager);
}
// Non-editable spectator
else
@@ -470,8 +468,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
LobbyUtils.SetupNameWidget(template, null, client);
LobbyUtils.SetupKickWidget(template, null, client, orderManager);
LobbyUtils.SetupColorWidget(template, null, client);
LobbyUtils.SetupReadyWidget(template, null, client);
}
LobbyUtils.SetupClientWidget(template, null, c, orderManager, true);

View File

@@ -295,31 +295,14 @@ Container@SERVER_LOBBY:
Width:190
Height:25
MaxLength:16
DropDownButton@COLOR:
Width:70
Height:25
X:210
Font:Regular
IgnoreChildMouseOver: true
Children:
ColorBlock@COLORBLOCK:
X:5
Y:6
Width:PARENT_RIGHT-35
Height:PARENT_BOTTOM-12
Label@SPECTATOR:
Text:Spectator
Width:220-55
Width:315-55
Height:25
X:280
X:210
Y:0
Align:Center
Font:Bold
Checkbox@STATUS_CHECKBOX:
X:448
Y:2
Width:20
Height:20
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
X:5
Y:0
@@ -363,27 +346,14 @@ Container@SERVER_LOBBY:
X:180
Y:2
Font:Bold
ColorBlock@COLORBLOCK:
X:215
Y:6
Width:35
Height:13
Label@SPECTATOR:
Text:Spectator
Width:220-55
Width:315-55
Height:25
X:280
X:210
Y:0
Align:Center
Font:Bold
Image@STATUS_IMAGE:
Visible:false
X:450
Y:4
Width:20
Height:20
ImageCollection:checkbox-bits
ImageName:checked
Container@TEMPLATE_NEW_SPECTATOR:
X:5
Y:0

View File

@@ -273,38 +273,14 @@ Background@SERVER_LOBBY:
Width:135
Height:25
MaxLength:16
DropDownButton@COLOR:
Width:80
Height:25
X:160
Font:Regular
Children:
ColorBlock@COLORBLOCK:
X:5
Y:6
Width:PARENT_RIGHT-35
Height:PARENT_BOTTOM-12
Label@SPECTATOR:
Text:Spectator
Width:198
Width:278
Height:25
X:240
X:160
Y:0
Align:Center
Font:Bold
Checkbox@STATUS_CHECKBOX:
X:448
Y:2
Width:20
Height:20
Image@STATUS_IMAGE:
Visible:false
X:450
Y:4
Width:20
Height:20
ImageCollection:checkbox-bits
ImageName:checked
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
X:5
Y:0
@@ -347,27 +323,14 @@ Background@SERVER_LOBBY:
X:125
Y:2
Font:Bold
ColorBlock@COLORBLOCK:
X:165
Y:6
Width:45
Height:13
Label@SPECTATOR:
Text:Spectator
Width:198
Width:278
Height:25
X:240
X:160
Y:0
Align:Center
Font:Bold
Image@STATUS_IMAGE:
Visible:false
X:450
Y:4
Width:20
Height:20
ImageCollection:checkbox-bits
ImageName:checked
Container@TEMPLATE_NEW_SPECTATOR:
X:5
Y:0

View File

@@ -273,38 +273,14 @@ Background@SERVER_LOBBY:
Width:135
Height:25
MaxLength:16
DropDownButton@COLOR:
Width:80
Height:25
X:160
Font:Regular
Children:
ColorBlock@COLORBLOCK:
X:5
Y:6
Width:PARENT_RIGHT-35
Height:PARENT_BOTTOM-12
Label@SPECTATOR:
Text:Spectator
Width:198
Width:278
Height:25
X:240
X:160
Y:0
Align:Center
Font:Bold
Checkbox@STATUS_CHECKBOX:
X:448
Y:2
Width:20
Height:20
Image@STATUS_IMAGE:
Visible:false
X:450
Y:4
Width:20
Height:20
ImageCollection:checkbox-bits
ImageName:checked
Container@TEMPLATE_NONEDITABLE_SPECTATOR:
X:5
Y:0
@@ -347,27 +323,14 @@ Background@SERVER_LOBBY:
X:125
Y:2
Font:Bold
ColorBlock@COLORBLOCK:
X:165
Y:6
Width:45
Height:13
Label@SPECTATOR:
Text:Spectator
Width:198
Width:278
Height:25
X:240
X:160
Y:0
Align:Center
Font:Bold
Image@STATUS_IMAGE:
Visible:false
X:450
Y:4
Width:20
Height:20
ImageCollection:checkbox-bits
ImageName:checked
Container@TEMPLATE_NEW_SPECTATOR:
X:5
Y:0