diff --git a/OpenRA.FileFormats/Map/PlayerReference.cs b/OpenRA.FileFormats/Map/PlayerReference.cs index 3ea821d85a..75bfc19a4f 100644 --- a/OpenRA.FileFormats/Map/PlayerReference.cs +++ b/OpenRA.FileFormats/Map/PlayerReference.cs @@ -23,8 +23,8 @@ namespace OpenRA.FileFormats public Color Color2 = Color.FromArgb(44,28,24); public int InitialCash = 0; - public string[] Allies = null; - public string[] Enemies = null; + public string[] Allies = {}; + public string[] Enemies = {}; public PlayerReference() {} public PlayerReference(MiniYaml my) diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index d525707150..e71608f885 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -95,14 +95,25 @@ namespace OpenRA // Add Map Players int mapPlayerIndex = -1; + Dictionary MapPlayers = new Dictionary(); + foreach (var kv in Map.Players) { var player = new Player(this, kv.Value, mapPlayerIndex--); AddPlayer(player); - + MapPlayers.Add(kv.Key,player); if (kv.Value.OwnsWorld) WorldActor.Owner = player; } + foreach(var p in MapPlayers) + { + foreach(var q in Map.Players[p.Key].Allies) + p.Value.Stances[MapPlayers[q]] = Stance.Ally; + + foreach(var q in Map.Players[p.Key].Enemies) + p.Value.Stances[MapPlayers[q]] = Stance.Enemy; + } + // Add real players SetLocalPlayer(Game.orderManager.Connection.LocalClientId); @@ -112,8 +123,11 @@ namespace OpenRA foreach (var p in players.Values) foreach (var q in players.Values) - p.Stances[q] = Game.ChooseInitialStance(p, q); - + { + if (!p.Stances.ContainsKey(q)) + p.Stances[q] = Game.ChooseInitialStance(p, q); + } + Timer.Time( "worldActor: {0}" ); foreach (var wlh in WorldActor.TraitsImplementing()) diff --git a/OpenRA.Mods.RA/DefaultShellmapScript.cs b/OpenRA.Mods.RA/DefaultShellmapScript.cs index 2a7962fc20..a4fe5358f3 100644 --- a/OpenRA.Mods.RA/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/DefaultShellmapScript.cs @@ -18,21 +18,12 @@ namespace OpenRA.Mods.RA class DefaultShellmapScript: ILoadWorldHook, ITick { - Player goodguy; - Player greece; Dictionary MapActors; public void WorldLoaded(World w) { Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2()); - // Sound.PlayMusic("hell226m.aud"); - goodguy = w.players.Values.Where(x => x.InternalName == "GoodGuy").FirstOrDefault(); - greece = w.players.Values.Where(x => x.InternalName == "Greece").FirstOrDefault(); MapActors = w.WorldActor.Trait().MapActors; - - - goodguy.Stances[greece] = Stance.Enemy; - greece.Stances[goodguy] = Stance.Enemy; } int ticks = 0; diff --git a/mods/ra/maps/shellmap/map.uid b/mods/ra/maps/shellmap/map.uid index a8273981ec..2baf5503b3 100644 --- a/mods/ra/maps/shellmap/map.uid +++ b/mods/ra/maps/shellmap/map.uid @@ -1 +1 @@ -f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7 \ No newline at end of file +5065fbcb8e5b1b6cea2a003c64f9b48fcaa33e06 \ No newline at end of file diff --git a/mods/ra/maps/shellmap/map.yaml b/mods/ra/maps/shellmap/map.yaml index 219fc78619..d8171f8f9b 100644 --- a/mods/ra/maps/shellmap/map.yaml +++ b/mods/ra/maps/shellmap/map.yaml @@ -19,23 +19,38 @@ BottomRight: 118,93 Players: PlayerReference@Neutral: Name: Neutral + Palette: Race: allies OwnsWorld: True NonCombatant: True + Color: 255,238,238,238 + Color2: 255,44,28,24 + InitialCash: 0 + Allies: + Enemies: PlayerReference@GoodGuy: Name: GoodGuy - Color: 85,130,204 - Color2: 17,33,71 + Palette: Race: allies OwnsWorld: False NonCombatant: False + Color: 255,85,130,204 + Color2: 255,17,33,71 + InitialCash: 0 + Allies: + Enemies: Greece PlayerReference@Greece: Name: Greece - Color: 255,20,0 - Color2: 56,0,0 + Palette: Race: soviet OwnsWorld: False NonCombatant: False + Color: 255,255,20,0 + Color2: 255,56,0,0 + InitialCash: 0 + Allies: + Enemies: GoodGuy + Actors: Actor0: brik Location: 32,43 diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index c001762368..5d5b72aa6a 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -67,4 +67,4 @@ Movies: mods/ra/movies1.yaml mods/ra/movies2.yaml -ShellmapUid:f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7 +ShellmapUid:5065fbcb8e5b1b6cea2a003c64f9b48fcaa33e06