From 7fc5007ac8f346812065f2fb10f795ea920d126a Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 20 May 2010 18:47:22 +1200 Subject: [PATCH] moved various other traits --- OpenRA.Game/Game.cs | 2 +- OpenRA.Game/OpenRA.Game.csproj | 9 ---- OpenRA.Game/Traits/World/SpawnMapActors.cs | 26 ----------- OpenRA.Mods.RA/AttackTurreted.cs | 3 +- .../Traits => OpenRA.Mods.RA}/Fake.cs | 3 +- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 9 ++++ .../PaletteFromFile.cs | 3 +- .../PaletteFromRGBA.cs | 3 +- .../ProductionSurround.cs | 3 +- .../RevealsShroud.cs | 4 +- .../SeedsResource.cs | 3 +- .../World => OpenRA.Mods.RA}/ShroudPalette.cs | 3 +- .../SpawnDefaultUnits.cs | 5 ++- OpenRA.Mods.RA/SpawnMapActors.cs | 45 +++++++++++++++++++ 14 files changed, 75 insertions(+), 46 deletions(-) delete mode 100644 OpenRA.Game/Traits/World/SpawnMapActors.cs rename {OpenRA.Game/Traits => OpenRA.Mods.RA}/Fake.cs (92%) rename {OpenRA.Game/Traits/World => OpenRA.Mods.RA}/PaletteFromFile.cs (94%) rename {OpenRA.Game/Traits/World => OpenRA.Mods.RA}/PaletteFromRGBA.cs (94%) rename {OpenRA.Game/Traits => OpenRA.Mods.RA}/ProductionSurround.cs (94%) rename {OpenRA.Game/Traits => OpenRA.Mods.RA}/RevealsShroud.cs (93%) rename {OpenRA.Game/Traits => OpenRA.Mods.RA}/SeedsResource.cs (94%) rename {OpenRA.Game/Traits/World => OpenRA.Mods.RA}/ShroudPalette.cs (93%) rename {OpenRA.Game/Traits/World => OpenRA.Mods.RA}/SpawnDefaultUnits.cs (95%) create mode 100644 OpenRA.Mods.RA/SpawnMapActors.cs diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 48a6b78da3..335033343e 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -59,7 +59,7 @@ namespace OpenRA internal static Renderer renderer; static int2 clientSize; static string mapName; - internal static Session LobbyInfo = new Session(); + public static Session LobbyInfo = new Session(); static bool packageChangePending; static bool mapChangePending; static Pair[] ModAssemblies; diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index c0d9173e44..3083780eb5 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -85,7 +85,6 @@ - @@ -139,7 +138,6 @@ - @@ -204,18 +202,14 @@ - - - - @@ -223,7 +217,6 @@ - @@ -240,13 +233,11 @@ - - diff --git a/OpenRA.Game/Traits/World/SpawnMapActors.cs b/OpenRA.Game/Traits/World/SpawnMapActors.cs deleted file mode 100644 index 278295e3a7..0000000000 --- a/OpenRA.Game/Traits/World/SpawnMapActors.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace OpenRA.Traits -{ - public class SpawnMapActorsInfo : TraitInfo { } - - public class SpawnMapActors : IGameStarted - { - public Dictionary MapActors = new Dictionary(); - - public void GameStarted(World world) - { - Game.skipMakeAnims = true; // rude hack - - foreach (var actorReference in world.Map.Actors) - MapActors[actorReference.Key] = world.CreateActor(actorReference.Value.Name, actorReference.Value.Location, - world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Value.Owner) - ?? world.NeutralPlayer); - - Game.skipMakeAnims = false; - } - } -} diff --git a/OpenRA.Mods.RA/AttackTurreted.cs b/OpenRA.Mods.RA/AttackTurreted.cs index 900cc08f04..07d6c9a31f 100644 --- a/OpenRA.Mods.RA/AttackTurreted.cs +++ b/OpenRA.Mods.RA/AttackTurreted.cs @@ -19,9 +19,10 @@ #endregion using System; +using OpenRA.Traits; using OpenRA.Traits.Activities; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class AttackTurretedInfo : AttackBaseInfo { diff --git a/OpenRA.Game/Traits/Fake.cs b/OpenRA.Mods.RA/Fake.cs similarity index 92% rename from OpenRA.Game/Traits/Fake.cs rename to OpenRA.Mods.RA/Fake.cs index 987408731e..7e8c560b46 100644 --- a/OpenRA.Game/Traits/Fake.cs +++ b/OpenRA.Mods.RA/Fake.cs @@ -19,8 +19,9 @@ #endregion using System.Collections.Generic; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class FakeInfo : TraitInfo { } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index f8e973dbf3..a914993e76 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -84,6 +84,7 @@ + @@ -105,9 +106,12 @@ + + + @@ -118,8 +122,13 @@ + + + + + diff --git a/OpenRA.Game/Traits/World/PaletteFromFile.cs b/OpenRA.Mods.RA/PaletteFromFile.cs similarity index 94% rename from OpenRA.Game/Traits/World/PaletteFromFile.cs rename to OpenRA.Mods.RA/PaletteFromFile.cs index a71356c217..625e0a0a10 100644 --- a/OpenRA.Game/Traits/World/PaletteFromFile.cs +++ b/OpenRA.Mods.RA/PaletteFromFile.cs @@ -19,8 +19,9 @@ #endregion using OpenRA.FileFormats; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class PaletteFromFileInfo : ITraitInfo { diff --git a/OpenRA.Game/Traits/World/PaletteFromRGBA.cs b/OpenRA.Mods.RA/PaletteFromRGBA.cs similarity index 94% rename from OpenRA.Game/Traits/World/PaletteFromRGBA.cs rename to OpenRA.Mods.RA/PaletteFromRGBA.cs index 34d3399c05..fdb1b79142 100644 --- a/OpenRA.Game/Traits/World/PaletteFromRGBA.cs +++ b/OpenRA.Mods.RA/PaletteFromRGBA.cs @@ -20,8 +20,9 @@ using System.Drawing; using OpenRA.FileFormats; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class PaletteFromRGBAInfo : ITraitInfo { diff --git a/OpenRA.Game/Traits/ProductionSurround.cs b/OpenRA.Mods.RA/ProductionSurround.cs similarity index 94% rename from OpenRA.Game/Traits/ProductionSurround.cs rename to OpenRA.Mods.RA/ProductionSurround.cs index 1ea16aa510..e85a081395 100644 --- a/OpenRA.Game/Traits/ProductionSurround.cs +++ b/OpenRA.Mods.RA/ProductionSurround.cs @@ -20,8 +20,9 @@ using System.Linq; using OpenRA.GameRules; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class ProductionSurroundInfo : ProductionInfo { diff --git a/OpenRA.Game/Traits/RevealsShroud.cs b/OpenRA.Mods.RA/RevealsShroud.cs similarity index 93% rename from OpenRA.Game/Traits/RevealsShroud.cs rename to OpenRA.Mods.RA/RevealsShroud.cs index 642544a6a2..bf6929d74a 100644 --- a/OpenRA.Game/Traits/RevealsShroud.cs +++ b/OpenRA.Mods.RA/RevealsShroud.cs @@ -18,7 +18,9 @@ */ #endregion -namespace OpenRA.Traits +using OpenRA.Traits; + +namespace OpenRA.Mods.RA { class RevealsShroudInfo : TraitInfo { } diff --git a/OpenRA.Game/Traits/SeedsResource.cs b/OpenRA.Mods.RA/SeedsResource.cs similarity index 94% rename from OpenRA.Game/Traits/SeedsResource.cs rename to OpenRA.Mods.RA/SeedsResource.cs index 233439c82e..8265fc537b 100644 --- a/OpenRA.Game/Traits/SeedsResource.cs +++ b/OpenRA.Mods.RA/SeedsResource.cs @@ -21,8 +21,9 @@ using System; using System.Linq; using System.Collections.Generic; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class SeedsResourceInfo : ITraitInfo { diff --git a/OpenRA.Game/Traits/World/ShroudPalette.cs b/OpenRA.Mods.RA/ShroudPalette.cs similarity index 93% rename from OpenRA.Game/Traits/World/ShroudPalette.cs rename to OpenRA.Mods.RA/ShroudPalette.cs index 47d7858341..4fb32258db 100644 --- a/OpenRA.Game/Traits/World/ShroudPalette.cs +++ b/OpenRA.Mods.RA/ShroudPalette.cs @@ -19,8 +19,9 @@ #endregion using OpenRA.FileFormats; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class ShroudPaletteInfo : ITraitInfo { diff --git a/OpenRA.Game/Traits/World/SpawnDefaultUnits.cs b/OpenRA.Mods.RA/SpawnDefaultUnits.cs similarity index 95% rename from OpenRA.Game/Traits/World/SpawnDefaultUnits.cs rename to OpenRA.Mods.RA/SpawnDefaultUnits.cs index 7777bcb776..7d525704f7 100644 --- a/OpenRA.Game/Traits/World/SpawnDefaultUnits.cs +++ b/OpenRA.Mods.RA/SpawnDefaultUnits.cs @@ -18,12 +18,13 @@ */ #endregion -using System.Collections.Generic; using System; +using System.Collections.Generic; using System.Linq; using OpenRA.FileFormats; +using OpenRA.Traits; -namespace OpenRA.Traits +namespace OpenRA.Mods.RA { class SpawnDefaultUnitsInfo : TraitInfo { diff --git a/OpenRA.Mods.RA/SpawnMapActors.cs b/OpenRA.Mods.RA/SpawnMapActors.cs new file mode 100644 index 0000000000..09d0828545 --- /dev/null +++ b/OpenRA.Mods.RA/SpawnMapActors.cs @@ -0,0 +1,45 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using System.Collections.Generic; +using System.Linq; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + public class SpawnMapActorsInfo : TraitInfo { } + + public class SpawnMapActors : IGameStarted + { + public Dictionary MapActors = new Dictionary(); + + public void GameStarted(World world) + { + Game.skipMakeAnims = true; // rude hack + + foreach (var actorReference in world.Map.Actors) + MapActors[actorReference.Key] = world.CreateActor(actorReference.Value.Name, actorReference.Value.Location, + world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Value.Owner) + ?? world.NeutralPlayer); + + Game.skipMakeAnims = false; + } + } +}