Unknown race -> Random; make it actually work, too.
This commit is contained in:
@@ -397,16 +397,16 @@ namespace OpenRA
|
|||||||
|
|
||||||
void CycleRace(bool left)
|
void CycleRace(bool left)
|
||||||
{
|
{
|
||||||
var countries = Game.world.GetCountries();
|
var countries = new[] { "Random" }.Concat(Game.world.GetCountries().Select(c => c.Name));
|
||||||
var nextCountry = countries
|
var nextCountry = countries
|
||||||
.SkipWhile(c => c.Name != Game.LocalClient.Country)
|
.SkipWhile(c => c != Game.LocalClient.Country)
|
||||||
.Skip(1)
|
.Skip(1)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (nextCountry == null)
|
if (nextCountry == null)
|
||||||
nextCountry = countries.First();
|
nextCountry = countries.First();
|
||||||
|
|
||||||
Game.IssueOrder(Order.Chat("/race " + nextCountry.Name));
|
Game.IssueOrder(Order.Chat("/race " + nextCountry));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CycleReady(bool left)
|
void CycleReady(bool left)
|
||||||
@@ -511,7 +511,7 @@ namespace OpenRA
|
|||||||
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
paletteRect.Bottom+Game.viewport.Location.Y - 5),
|
||||||
Player.PlayerColors[client.PaletteIndex].c);
|
Player.PlayerColors[client.PaletteIndex].c);
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
f.DrawText(rgbaRenderer, client.Country ?? "Unknown", new int2(r.Left + 220, y), Color.White);
|
f.DrawText(rgbaRenderer, client.Country, new int2(r.Left + 220, y), Color.White);
|
||||||
f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
f.DrawText(rgbaRenderer, client.State.ToString(), new int2(r.Left + 290, y), Color.White);
|
||||||
f.DrawText(rgbaRenderer, (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
f.DrawText(rgbaRenderer, (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|||||||
@@ -86,5 +86,11 @@ namespace OpenRA
|
|||||||
d.Add( k, ret = createFn( k ) );
|
d.Add( k, ret = createFn( k ) );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r)
|
||||||
|
{
|
||||||
|
var xs = ts.ToArray();
|
||||||
|
return xs[r.Next(xs.Length)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ namespace OpenRA
|
|||||||
Palette = "neutral";
|
Palette = "neutral";
|
||||||
Color = Color.Gray; // HACK HACK
|
Color = Color.Gray; // HACK HACK
|
||||||
}
|
}
|
||||||
|
|
||||||
Country = world.GetCountries()
|
Country = world.GetCountries()
|
||||||
.FirstOrDefault( c => client != null && client.Country == c.Name )
|
.FirstOrDefault(c => client != null && client.Country == c.Name)
|
||||||
?? world.GetCountries().First();
|
?? world.GetCountries().Random(world.SharedRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePower()
|
void UpdatePower()
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace OpenRA.Server
|
|||||||
Index = newConn.PlayerIndex,
|
Index = newConn.PlayerIndex,
|
||||||
PaletteIndex = ChooseFreePalette(),
|
PaletteIndex = ChooseFreePalette(),
|
||||||
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
Name = "Player {0}".F(1 + newConn.PlayerIndex),
|
||||||
Country = "", /* hack */
|
Country = "Random",
|
||||||
State = Session.ClientState.NotReady
|
State = Session.ClientState.NotReady
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user