Fix root cause for `world owned by creep' bugs

This commit is contained in:
Paul Chote
2011-03-29 21:13:01 +13:00
parent 23eb077417
commit 5d762b1f9c
2 changed files with 38 additions and 18 deletions

View File

@@ -87,8 +87,13 @@ namespace OpenRA.Editor
// upgrade maps that have no player definitions. editor doesnt care, // upgrade maps that have no player definitions. editor doesnt care,
// but this breaks the game pretty badly. // but this breaks the game pretty badly.
if (map.Players.Count == 0) if (map.Players.Count == 0)
map.Players.Add("Neutral", new PlayerReference("Neutral", map.Players.Add("Neutral", new PlayerReference
Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true)); {
Name = "Neutral",
Race = Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race,
OwnsWorld = true,
NonCombatant = true
});
PrepareMapResources(Game.modData.Manifest, map); PrepareMapResources(Game.modData.Manifest, map);
@@ -321,8 +326,22 @@ namespace OpenRA.Editor
map.Resize((int)nmd.width.Value, (int)nmd.height.Value); map.Resize((int)nmd.width.Value, (int)nmd.height.Value);
map.ResizeCordon((int)nmd.cordonLeft.Value, (int)nmd.cordonTop.Value, map.ResizeCordon((int)nmd.cordonLeft.Value, (int)nmd.cordonTop.Value,
(int)nmd.cordonRight.Value, (int)nmd.cordonBottom.Value); (int)nmd.cordonRight.Value, (int)nmd.cordonBottom.Value);
map.Players.Add("Neutral", new PlayerReference("Neutral", Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true));
map.Players.Add("Creeps", new PlayerReference("Creeps", Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true)); map.Players.Add("Neutral", new PlayerReference
{
Name = "Neutral",
Race = Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race,
OwnsWorld = true,
NonCombatant = true
});
map.Players.Add("Creeps", new PlayerReference
{
Name = "Creeps",
Race = Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race,
NonCombatant = true
});
NewMap(map); NewMap(map);
} }
} }
@@ -378,11 +397,20 @@ namespace OpenRA.Editor
eld.ShowDialog(); eld.ShowDialog();
if (!map.Players.ContainsKey("Neutral")) if (!map.Players.ContainsKey("Neutral"))
map.Players.Add("Neutral", new PlayerReference("Neutral", map.Players.Add("Neutral", new PlayerReference
Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true)); {
Name = "Neutral",
Race = Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race,
OwnsWorld = true,
NonCombatant = true
});
map.Players.Add("Creeps", new PlayerReference("Creeps", map.Players.Add("Creeps", new PlayerReference
Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true)); {
Name = "Creeps",
Race = Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race,
NonCombatant = true
});
map.Save(savePath); map.Save(savePath);
LoadMap(savePath); LoadMap(savePath);

View File

@@ -38,13 +38,5 @@ namespace OpenRA.FileFormats
{ {
FieldLoader.Load(this, my); FieldLoader.Load(this, my);
} }
public PlayerReference(string name, string race, bool ownsworld, bool noncombatant)
{
Name = name;
Race = race;
OwnsWorld = ownsworld;
NonCombatant = noncombatant;
}
} }
} }