move LobbyInfo onto OrderManager

This commit is contained in:
Bob
2010-10-11 16:00:02 +13:00
parent beecb8aeb1
commit 17990ab8b7
17 changed files with 98 additions and 88 deletions

View File

@@ -34,9 +34,9 @@ namespace OpenRA.Mods.RA
}
// create the players which are bound through slots.
foreach (var slot in Game.LobbyInfo.Slots)
foreach (var slot in w.LobbyInfo.Slots)
{
var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Slot == slot.Index);
var client = w.LobbyInfo.Clients.FirstOrDefault(c => c.Slot == slot.Index);
if (client != null)
{
/* spawn a real player in this slot. */
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA
static Session.Client GetClientForPlayer(Player p)
{
return Game.LobbyInfo.Clients.Single(c => c.Index == p.ClientIndex);
return p.World.LobbyInfo.ClientWithIndex(p.ClientIndex);
}
}
}

View File

@@ -28,14 +28,14 @@ namespace OpenRA.Mods.RA
public void WorldLoaded(World world)
{
var taken = Game.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0)
var taken = world.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0)
.Select(c => world.Map.SpawnPoints.ElementAt(c.SpawnPoint - 1)).ToList();
var available = world.Map.SpawnPoints.Except(taken).ToList();
// Set spawn
foreach (var slot in Game.LobbyInfo.Slots)
foreach (var slot in world.LobbyInfo.Slots)
{
var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Slot == slot.Index);
var client = world.LobbyInfo.Clients.FirstOrDefault(c => c.Slot == slot.Index);
var player = FindPlayerInSlot(world, slot);
if (player == null) continue;

View File

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.RA
public virtual IEnumerable<ActorInfo> AllItems()
{
if (Game.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
return Produceable.Select(a => a.Key);
return Produceable.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key);
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.RA
public virtual IEnumerable<ActorInfo> BuildableItems()
{
if (Game.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().AllTech)
return Produceable.Select(a => a.Key);
return Produceable.Where(a => a.Value.Buildable).Select(a => a.Key);
@@ -185,7 +185,7 @@ namespace OpenRA.Mods.RA
if (unit == null || ! unit.Traits.Contains<BuildableInfo>())
return 0;
if (Game.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild) return 0;
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild) return 0;
var cost = unit.Traits.Contains<ValuedInfo>() ? unit.Traits.Get<ValuedInfo>().Cost : 0;
var time = cost
* Info.BuildSpeed

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA
if (IsAvailable && (!Info.RequiresPower || PlayerPower.PowerState == PowerState.Normal))
{
if (Game.LobbyInfo.GlobalSettings.AllowCheats && self.Trait<DeveloperMode>().FastCharge) RemainingTime = 0;
if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Trait<DeveloperMode>().FastCharge) RemainingTime = 0;
if (RemainingTime > 0) --RemainingTime;
if (!notifiedCharging)