This commit is contained in:
Paul Chote
2010-05-23 22:39:43 +12:00
parent 9837b4ce32
commit 35ca5f80b2
9 changed files with 21 additions and 15 deletions

View File

@@ -137,9 +137,15 @@ namespace OpenRA.FileFormats
root.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null)); root.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null));
} }
root.Add("Actors", MiniYaml.FromDictionary(Actors)); Dictionary<string, MiniYaml> playerYaml = new Dictionary<string, MiniYaml>();
root.Add("Waypoints", MiniYaml.FromDictionary(Waypoints));
root.Add("Smudges", MiniYaml.FromList(Smudges)); foreach(var p in Players)
playerYaml.Add("PlayerReference@{0}".F(p.Key), FieldSaver.Save(p.Value));
root.Add("Players",new MiniYaml(null, playerYaml));
root.Add("Actors", MiniYaml.FromDictionary<string, ActorReference>(Actors));
root.Add("Waypoints", MiniYaml.FromDictionary<string, int2>(Waypoints));
root.Add("Smudges", MiniYaml.FromList<SmudgeReference>(Smudges));
root.Add("Rules", new MiniYaml(null, Rules)); root.Add("Rules", new MiniYaml(null, Rules));
SaveBinaryData(Path.Combine(filepath, "map.bin")); SaveBinaryData(Path.Combine(filepath, "map.bin"));
root.WriteToFile(Path.Combine(filepath, "map.yaml")); root.WriteToFile(Path.Combine(filepath, "map.yaml"));

View File

@@ -26,7 +26,7 @@ namespace OpenRA.FileFormats
public readonly string Palette; public readonly string Palette;
public readonly string Race; public readonly string Race;
public readonly bool OwnsWorld = false; public readonly bool OwnsWorld = false;
public readonly bool isSpecial = false; public readonly bool IsSpecial = false;
public PlayerReference(MiniYaml my) public PlayerReference(MiniYaml my)
{ {

View File

@@ -41,7 +41,7 @@ namespace OpenRA
public readonly string InternalName; public readonly string InternalName;
public readonly CountryInfo Country; public readonly CountryInfo Country;
public readonly int Index; public readonly int Index;
public readonly bool isSpecial = false; public readonly bool IsSpecial = false;
public ShroudRenderer Shroud; public ShroudRenderer Shroud;
public World World { get; private set; } public World World { get; private set; }
@@ -57,7 +57,7 @@ namespace OpenRA
Palette = pr.Palette; Palette = pr.Palette;
Color = world.PlayerColors().Where(c => c.Name == pr.Palette).FirstOrDefault().Color; Color = world.PlayerColors().Where(c => c.Name == pr.Palette).FirstOrDefault().Color;
PlayerName = InternalName = pr.Name; PlayerName = InternalName = pr.Name;
isSpecial = pr.isSpecial; IsSpecial = pr.IsSpecial;
Country = world.GetCountries() Country = world.GetCountries()
.FirstOrDefault(c => pr.Race == c.Race); .FirstOrDefault(c => pr.Race == c.Race);
} }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Widgets.Delegates
y += 35; y += 35;
foreach (var p in Game.world.players.Values.Where(a => a != Game.world.LocalPlayer && !a.isSpecial)) foreach (var p in Game.world.players.Values.Where(a => a != Game.world.LocalPlayer && !a.IsSpecial))
{ {
var pp = p; var pp = p;
var label = new LabelWidget var label = new LabelWidget

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Widgets
if (world.players.Count > 2) /* more than just us + neutral */ if (world.players.Count > 2) /* more than just us + neutral */
{ {
var conds = world.Queries.WithTrait<IVictoryConditions>() var conds = world.Queries.WithTrait<IVictoryConditions>()
.Where(c => !c.Actor.Owner.isSpecial); .Where(c => !c.Actor.Owner.IsSpecial);
if (conds.Any(c => c.Actor.Owner == world.LocalPlayer && c.Trait.HasLost)) if (conds.Any(c => c.Actor.Owner == world.LocalPlayer && c.Trait.HasLost))
DrawText("YOU ARE DEFEATED"); DrawText("YOU ARE DEFEATED");

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Widgets
? actor.Info.Traits.Get<ValuedInfo>().Description ? actor.Info.Traits.Get<ValuedInfo>().Description
: actor.Info.Name; : actor.Info.Name;
var text2 = (actor.Owner == world.LocalPlayer) var text2 = (actor.Owner == world.LocalPlayer)
? "" : (actor.Owner.isSpecial ? "{0}" : "{0} ({1})").F(actor.Owner.PlayerName, world.LocalPlayer.Stances[actor.Owner]); ? "" : (actor.Owner.IsSpecial ? "{0}" : "{0} ({1})").F(actor.Owner.PlayerName, world.LocalPlayer.Stances[actor.Owner]);
var renderer = Game.chrome.renderer; var renderer = Game.chrome.renderer;

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
var hasAnything = self.World.Queries.OwnedBy[self.Owner] var hasAnything = self.World.Queries.OwnedBy[self.Owner]
.WithTrait<MustBeDestroyed>().Any(); .WithTrait<MustBeDestroyed>().Any();
var hasLost = !hasAnything && !self.Owner.isSpecial; var hasLost = !hasAnything && !self.Owner.IsSpecial;
if (hasLost && !HasLost) if (hasLost && !HasLost)
Surrender(self); Surrender(self);

View File

@@ -22,7 +22,7 @@ Players:
Palette: neutral Palette: neutral
Race: allies Race: allies
OwnsWorld:true OwnsWorld:true
isSpecial:true IsSpecial:true
PlayerReference@GoodGuy: PlayerReference@GoodGuy:
Name: GoodGuy Name: GoodGuy
Palette: player1 Palette: player1

View File

@@ -24,7 +24,7 @@ Players:
Palette: neutral Palette: neutral
Race: allies Race: allies
OwnsWorld:true OwnsWorld:true
isSpecial:true IsSpecial:true
Actors: Actors:
Actor0: tc02 Neutral 25,39 Actor0: tc02 Neutral 25,39