From 2b6dec51bfdacaa47dfd373d5546d515c03d60b1 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 28 Apr 2012 20:34:22 -0400 Subject: [PATCH] A bunch of bugfixes --- SubstrateCS/Properties/AssemblyInfo.cs | 4 ++-- SubstrateCS/Source/AlphaWorld.cs | 7 +++---- SubstrateCS/Source/AnvilRegion.cs | 8 ++++---- SubstrateCS/Source/AnvilWorld.cs | 6 ++---- SubstrateCS/Source/BetaWorld.cs | 7 +++---- SubstrateCS/Source/Core/Region.cs | 2 +- SubstrateCS/Source/Core/RegionManager.cs | 2 +- SubstrateCS/Source/NbtWorld.cs | 5 +++++ SubstrateCS/Substrate (NET2).csproj | 16 ++++++++++++---- SubstrateCS/Substrate (NET4).csproj | 15 ++++++++++++--- 10 files changed, 45 insertions(+), 27 deletions(-) diff --git a/SubstrateCS/Properties/AssemblyInfo.cs b/SubstrateCS/Properties/AssemblyInfo.cs index 7d71888..c2c5480 100644 --- a/SubstrateCS/Properties/AssemblyInfo.cs +++ b/SubstrateCS/Properties/AssemblyInfo.cs @@ -30,8 +30,8 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.2.1.0")] -[assembly: AssemblyFileVersion("1.2.1.0")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] // This library is compatible with all CLS-compliant .NET programming languages. [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/SubstrateCS/Source/AlphaWorld.cs b/SubstrateCS/Source/AlphaWorld.cs index d93a70a..577d06f 100644 --- a/SubstrateCS/Source/AlphaWorld.cs +++ b/SubstrateCS/Source/AlphaWorld.cs @@ -94,10 +94,8 @@ namespace Substrate return GetPlayerManagerVirt() as PlayerManager; } - /// - /// Saves the world's data, and any objects known to have unsaved changes. - /// - public void Save () + /// + public override void Save () { _level.Save(); @@ -217,6 +215,7 @@ namespace Substrate Path = path; _level = new Level(this); + _level.Version = 0; return this; } diff --git a/SubstrateCS/Source/AnvilRegion.cs b/SubstrateCS/Source/AnvilRegion.cs index 1fd61b8..189f1b4 100644 --- a/SubstrateCS/Source/AnvilRegion.cs +++ b/SubstrateCS/Source/AnvilRegion.cs @@ -7,7 +7,7 @@ namespace Substrate { public class AnvilRegion : Region { - private static Regex _namePattern = new Regex("r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mcr$"); + private static Regex _namePattern = new Regex("r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); public AnvilRegion (AnvilRegionManager rm, ChunkCache cache, int rx, int rz) : base(rm, cache, rx, rz) @@ -17,7 +17,7 @@ namespace Substrate /// public override string GetFileName () { - return "r." + _rx + "." + _rz + ".mcr"; + return "r." + _rx + "." + _rz + ".mca"; } @@ -71,12 +71,12 @@ namespace Substrate protected override IChunk CreateChunkCore (int cx, int cz) { - return AlphaChunk.Create(cz, cz); + return AnvilChunk.Create(cz, cz); } protected override IChunk CreateChunkVerifiedCore (NbtTree tree) { - return AlphaChunk.CreateVerified(tree); + return AnvilChunk.CreateVerified(tree); } } } diff --git a/SubstrateCS/Source/AnvilWorld.cs b/SubstrateCS/Source/AnvilWorld.cs index 460f4fe..04a015e 100644 --- a/SubstrateCS/Source/AnvilWorld.cs +++ b/SubstrateCS/Source/AnvilWorld.cs @@ -144,10 +144,8 @@ namespace Substrate return GetDataManagerVirt() as BetaDataManager; } - /// - /// Saves the world's data, and any objects known to have unsaved changes. - /// - public void Save () + /// + public override void Save () { _level.Save(); diff --git a/SubstrateCS/Source/BetaWorld.cs b/SubstrateCS/Source/BetaWorld.cs index 9f8a547..ec30ecb 100644 --- a/SubstrateCS/Source/BetaWorld.cs +++ b/SubstrateCS/Source/BetaWorld.cs @@ -144,10 +144,8 @@ namespace Substrate return GetDataManagerVirt() as BetaDataManager; } - /// - /// Saves the world's data, and any objects known to have unsaved changes. - /// - public void Save () + /// + public override void Save () { _level.Save(); @@ -345,6 +343,7 @@ namespace Substrate Path = path; _level = new Level(this); + _level.Version = 19132; return this; } diff --git a/SubstrateCS/Source/Core/Region.cs b/SubstrateCS/Source/Core/Region.cs index afaa9ff..ef72fbd 100644 --- a/SubstrateCS/Source/Core/Region.cs +++ b/SubstrateCS/Source/Core/Region.cs @@ -293,7 +293,7 @@ namespace Substrate.Core int cx = lcx + _rx * XDIM; int cz = lcz + _rz * ZDIM; - AlphaChunk c = AlphaChunk.Create(cx, cz); + IChunk c = CreateChunkCore(cx, cz); c.Save(GetChunkOutStream(lcx, lcz)); ChunkRef cr = ChunkRef.Create(this, lcx, lcz); diff --git a/SubstrateCS/Source/Core/RegionManager.cs b/SubstrateCS/Source/Core/RegionManager.cs index 7cc44d4..5a07ada 100644 --- a/SubstrateCS/Source/Core/RegionManager.cs +++ b/SubstrateCS/Source/Core/RegionManager.cs @@ -46,7 +46,7 @@ namespace Substrate.Core try { if (_cache.TryGetValue(k, out r) == false) { - r = CreateRegionCore(rz, rz); + r = CreateRegionCore(rx, rz); _cache.Add(k, r); } return r; diff --git a/SubstrateCS/Source/NbtWorld.cs b/SubstrateCS/Source/NbtWorld.cs index 2b8473c..f7c2d6e 100644 --- a/SubstrateCS/Source/NbtWorld.cs +++ b/SubstrateCS/Source/NbtWorld.cs @@ -136,6 +136,11 @@ namespace Substrate return null; } + /// + /// Saves the world's data, and any objects known to have unsaved changes. + /// + public abstract void Save (); + /// /// Raised when is called, used to find a concrete type that can open the world. /// diff --git a/SubstrateCS/Substrate (NET2).csproj b/SubstrateCS/Substrate (NET2).csproj index 36eb6f9..78d3b48 100644 --- a/SubstrateCS/Substrate (NET2).csproj +++ b/SubstrateCS/Substrate (NET2).csproj @@ -61,7 +61,15 @@ - + + + + + + + + + @@ -153,7 +161,7 @@ - + @@ -192,10 +200,10 @@ - + - + diff --git a/SubstrateCS/Substrate (NET4).csproj b/SubstrateCS/Substrate (NET4).csproj index 9f5fa88..5b4c800 100644 --- a/SubstrateCS/Substrate (NET4).csproj +++ b/SubstrateCS/Substrate (NET4).csproj @@ -59,14 +59,24 @@ + - + + + + + + + + + + @@ -192,10 +202,9 @@ - - +