diff --git a/OpenRA.FileFormats/CompressedPackage.cs b/OpenRA.FileFormats/Filesystem/CompressedPackage.cs similarity index 100% rename from OpenRA.FileFormats/CompressedPackage.cs rename to OpenRA.FileFormats/Filesystem/CompressedPackage.cs diff --git a/OpenRA.FileFormats/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs similarity index 95% rename from OpenRA.FileFormats/FileSystem.cs rename to OpenRA.FileFormats/Filesystem/FileSystem.cs index e3767c2a16..465d9f3913 100644 --- a/OpenRA.FileFormats/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -39,7 +39,7 @@ namespace OpenRA.FileFormats static IFolder OpenPackage(string filename) { if (filename.EndsWith(".mix")) - return new Package(filename, order++); + return new MixFile(filename, order++); else if (filename.EndsWith(".zip")) return new CompressedPackage(filename, order++); else diff --git a/OpenRA.FileFormats/Folder.cs b/OpenRA.FileFormats/Filesystem/Folder.cs similarity index 100% rename from OpenRA.FileFormats/Folder.cs rename to OpenRA.FileFormats/Filesystem/Folder.cs diff --git a/OpenRA.FileFormats/Package.cs b/OpenRA.FileFormats/Filesystem/MixFile.cs similarity index 93% rename from OpenRA.FileFormats/Package.cs rename to OpenRA.FileFormats/Filesystem/MixFile.cs index ef70195f37..06a35da392 100644 --- a/OpenRA.FileFormats/Package.cs +++ b/OpenRA.FileFormats/Filesystem/MixFile.cs @@ -23,7 +23,7 @@ namespace OpenRA.FileFormats int Priority { get; } } - public class Package : IFolder + public class MixFile : IFolder { readonly Dictionary index; readonly bool isRmix, isEncrypted; @@ -31,7 +31,7 @@ namespace OpenRA.FileFormats readonly Stream s; int priority; - public Package(string filename, int priority) + public MixFile(string filename, int priority) { this.priority = priority; s = FileSystem.Open(filename); diff --git a/OpenRA.FileFormats/PackageWriter.cs b/OpenRA.FileFormats/Filesystem/PackageWriter.cs similarity index 100% rename from OpenRA.FileFormats/PackageWriter.cs rename to OpenRA.FileFormats/Filesystem/PackageWriter.cs diff --git a/OpenRA.FileFormats/Map/MapStub.cs b/OpenRA.FileFormats/Map/MapStub.cs index d043791a9c..91f4f2c078 100644 --- a/OpenRA.FileFormats/Map/MapStub.cs +++ b/OpenRA.FileFormats/Map/MapStub.cs @@ -17,7 +17,7 @@ namespace OpenRA.FileFormats { public class MapStub { - public IFolder Package { get; protected set; } + public IFolder Container { get; protected set; } // Yaml map data public string Uid { get; protected set; } @@ -39,13 +39,13 @@ namespace OpenRA.FileFormats public int Height { get { return BottomRight.Y - TopLeft.Y; } } public MapStub() {} // Hack for the editor - not used for anything important - public MapStub(IFolder package) + public MapStub(IFolder container) { - Package = package; - var yaml = MiniYaml.FromStream(Package.GetContent("map.yaml")); + Container = container; + var yaml = MiniYaml.FromStream(Container.GetContent("map.yaml")); FieldLoader.Load( this, new MiniYaml( null, yaml ) ); - Uid = Package.GetContent("map.uid").ReadAllText(); + Uid = Container.GetContent("map.uid").ReadAllText(); } static object LoadWaypoints( MiniYaml y ) diff --git a/OpenRA.FileFormats/OpenRA.FileFormats.csproj b/OpenRA.FileFormats/OpenRA.FileFormats.csproj index 093bb41250..f3b11ae7f5 100644 --- a/OpenRA.FileFormats/OpenRA.FileFormats.csproj +++ b/OpenRA.FileFormats/OpenRA.FileFormats.csproj @@ -1,4 +1,4 @@ - + Debug @@ -59,8 +59,6 @@ - - @@ -68,8 +66,6 @@ - - @@ -101,8 +97,12 @@ - + + + + + + + + \ No newline at end of file diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs old mode 100755 new mode 100644 index 592bdf979a..ee04e41f0d --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -80,11 +80,12 @@ namespace OpenRA public int2 Location = int2.Zero; public string Owner = null; } - + + public Map(MapStub stub) : this(stub.Container) {} public Map(IFolder package) : base(package) { - var yaml = new MiniYaml( null, MiniYaml.FromStream( Package.GetContent( "map.yaml" ) ) ); + var yaml = new MiniYaml( null, MiniYaml.FromStream( Container.GetContent( "map.yaml" ) ) ); // 'Simple' metadata FieldLoader.Load( this, yaml ); @@ -184,7 +185,7 @@ namespace OpenRA public void Save(string filepath) { // Todo: save to a zip file in the support dir by default - Package = new Folder(filepath, 0); + Container = new Folder(filepath, 0); MapFormat = 3; var root = new List(); @@ -232,7 +233,7 @@ namespace OpenRA public void LoadBinaryData() { - using (var dataStream = Package.GetContent("map.bin")) + using (var dataStream = Container.GetContent("map.bin")) { if (ReadByte(dataStream) != 1) throw new InvalidDataException("Unknown binary map format"); @@ -298,8 +299,8 @@ namespace OpenRA { // UID is calculated by taking an SHA1 of the yaml and binary data // Read the relevant data into a buffer - var data = Package.GetContent("map.yaml").ReadAllBytes() - .Concat(Package.GetContent("map.bin").ReadAllBytes()).ToArray(); + var data = Container.GetContent("map.yaml").ReadAllBytes() + .Concat(Container.GetContent("map.bin").ReadAllBytes()).ToArray(); // Take the SHA1 using (var csp = SHA1.Create()) diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index f590d22948..d1441dba07 100755 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -60,7 +60,7 @@ namespace OpenRA if (!AvailableMaps.ContainsKey(uid)) throw new InvalidDataException("Invalid map uid: {0}".F(uid)); - var map = new Map(AvailableMaps[uid].Package); + var map = new Map(AvailableMaps[uid]); Rules.LoadRules(Manifest, map); if (map.Theater != cachedTheatre) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index c8ff05bd38..c0d762d0c5 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -162,7 +162,7 @@ namespace OpenRA.Server static void LoadMap() { - Map = new Map(ModData.AvailableMaps[lobbyInfo.GlobalSettings.Map].Package); + Map = new Map(ModData.AvailableMaps[lobbyInfo.GlobalSettings.Map]); lobbyInfo.Slots = Map.Players .Select(p => MakeSlotFromPlayerReference(p.Value)) .Where(s => s != null) diff --git a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs index 4a17f5289b..0e1b7a89cd 100755 --- a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs @@ -183,7 +183,7 @@ namespace OpenRA.Widgets.Delegates { if (MapUid == orderManager.LobbyInfo.GlobalSettings.Map) return; MapUid = orderManager.LobbyInfo.GlobalSettings.Map; - Map = new Map(Game.modData.AvailableMaps[MapUid].Package); + Map = new Map(Game.modData.AvailableMaps[MapUid]); var title = Widget.RootWidget.GetWidget("LOBBY_TITLE"); title.Text = "OpenRA Multiplayer Lobby - " + orderManager.LobbyInfo.GlobalSettings.ServerName; diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index 4807b72317..d46d1097aa 100644 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -24,7 +24,7 @@ namespace OpenRA.Widgets public Func Map = () => null; public Action OnSpawnClick = spawn => {}; public Func> SpawnColors = () => new Dictionary(); - static Cache PreviewCache = new Cache(stub => Minimap.RenderMapPreview( new Map( stub.Package ))); + static Cache PreviewCache = new Cache(stub => Minimap.RenderMapPreview( new Map( stub ))); public MapPreviewWidget() : base() { } protected MapPreviewWidget(MapPreviewWidget other)