eradicate dumb UserSettings stuff that causes desyncs

This commit is contained in:
Chris Forbes
2010-03-16 20:14:57 +13:00
parent 7114f4b4ba
commit 2dde4eff07
4 changed files with 14 additions and 22 deletions

View File

@@ -151,15 +151,10 @@ namespace OpenRA
ChangeMap(mapName); ChangeMap(mapName);
if( Settings.Replay != "" ) if( Settings.Replay != "" )
{ orderManager = new OrderManager( new ReplayConnection( Settings.Replay ) );
var connection = new ReplayConnection( Settings.Replay );
orderManager = new OrderManager( connection );
}
else else
{
JoinLocal(); JoinLocal();
} }
}
internal static void JoinServer(string host, int port) internal static void JoinServer(string host, int port)
{ {
@@ -421,7 +416,7 @@ namespace OpenRA
renderer = new Renderer(resolution, windowed); renderer = new Renderer(resolution, windowed);
resolution = renderer.Resolution; resolution = renderer.Resolution;
var controller = new Controller(); /* a bit of insane input routing */ var controller = new Controller();
Game.Initialize(Game.Settings.Map, renderer, new int2(resolution), Game.Settings.Player, controller); Game.Initialize(Game.Settings.Map, renderer, new int2(resolution), Game.Settings.Player, controller);

View File

@@ -50,10 +50,5 @@ namespace OpenRA.GameRules
public readonly int ExternalPort = 1234; public readonly int ExternalPort = 1234;
public readonly bool InternetServer = true; public readonly bool InternetServer = true;
public readonly string MasterServer = "http://open-ra.org/master/"; public readonly string MasterServer = "http://open-ra.org/master/";
// Gameplay options
// TODO: These need to die
public readonly bool RepairRequiresConyard = true;
public readonly bool PowerDownBuildings = true;
} }
} }

View File

@@ -52,9 +52,6 @@ namespace OpenRA.Orders
public void Tick( World world ) public void Tick( World world )
{ {
if (!Game.Settings.RepairRequiresConyard)
return;
var hasFact = world.Queries.OwnedBy[world.LocalPlayer] var hasFact = world.Queries.OwnedBy[world.LocalPlayer]
.WithTrait<ConstructionYard>() .WithTrait<ConstructionYard>()
.Any(); .Any();

View File

@@ -24,19 +24,24 @@ namespace OpenRA.Traits
public void OnClick() { Game.controller.ToggleInputMode<SellOrderGenerator>(); } public void OnClick() { Game.controller.ToggleInputMode<SellOrderGenerator>(); }
} }
class RepairButtonInfo : StatelessTraitInfo<RepairButton> { } class RepairButtonInfo : ITraitInfo
{
public readonly bool RequiresConstructionYard = true;
public object Create(Actor self) { return new RepairButton(this); }
}
class RepairButton : IChromeButton class RepairButton : IChromeButton
{ {
public string Image { get { return "repair"; } } // todo: art RepairButtonInfo info;
public RepairButton( RepairButtonInfo info ) { this.info = info; }
public string Image { get { return "repair"; } }
public bool Enabled public bool Enabled
{ {
get get
{ {
if (!Game.Settings.RepairRequiresConyard) return !info.RequiresConstructionYard ||
return true; Game.world.Queries.OwnedBy[Game.world.LocalPlayer]
return Game.world.Queries.OwnedBy[Game.world.LocalPlayer]
.WithTrait<ConstructionYard>().Any(); .WithTrait<ConstructionYard>().Any();
} }
} }