forked from mirrors/NBTExplorer
Cache consistency bug in Region fixed. Ready for 0.3.
This commit is contained in:
parent
d72e7881a5
commit
245e792541
3 changed files with 20 additions and 11 deletions
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.0.0")]
|
||||
[assembly: AssemblyVersion("0.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.3.0.0")]
|
||||
|
|
|
@ -245,7 +245,10 @@ namespace Substrate
|
|||
_region = _enum.Current;
|
||||
}
|
||||
if (MoveNextInRegion()) {
|
||||
_chunk = _cm.GetChunkRefInRegion(_region, _x, _z);
|
||||
_chunk = _region.GetChunkRef(_x, _z, _cm);
|
||||
if (_chunk == null) {
|
||||
throw new Exception();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ namespace Substrate
|
|||
|
||||
DeleteChunk(lcx, lcz);
|
||||
|
||||
Chunk c = new Chunk(ChunkGlobalX(lcx), ChunkGlobalZ(lcz));
|
||||
Chunk c = new Chunk(lcx, lcz);
|
||||
c.Save(GetChunkOutStream(lcx, lcz));
|
||||
|
||||
ChunkRef cr = new ChunkRef(this, cache, lcx, lcz);
|
||||
|
@ -356,8 +356,10 @@ namespace Substrate
|
|||
{
|
||||
int saved = 0;
|
||||
foreach (ChunkRef c in _dirty.Values) {
|
||||
int lcx = c.LocalX;
|
||||
int lcz = c.LocalZ;
|
||||
int cx = c.X;
|
||||
int cz = c.Z;
|
||||
int lcx = cx - _rx * ChunkManager.REGION_XLEN;
|
||||
int lcz = cz - _rz * ChunkManager.REGION_ZLEN;
|
||||
|
||||
if (!ChunkExists(lcx, lcz)) {
|
||||
throw new MissingChunkException();
|
||||
|
@ -384,8 +386,10 @@ namespace Substrate
|
|||
|
||||
public bool MarkChunkDirty (ChunkRef chunk)
|
||||
{
|
||||
int lcx = chunk.LocalX;
|
||||
int lcz = chunk.LocalZ;
|
||||
int cx = chunk.X;
|
||||
int cz = chunk.Z;
|
||||
int lcx = cx - _rx * ChunkManager.REGION_XLEN;
|
||||
int lcz = cz - _rz * ChunkManager.REGION_ZLEN;
|
||||
|
||||
ChunkKey k = new ChunkKey(lcx, lcz);
|
||||
if (!_dirty.ContainsKey(k)) {
|
||||
|
@ -397,10 +401,12 @@ namespace Substrate
|
|||
|
||||
public bool MarkChunkClean (ChunkRef chunk)
|
||||
{
|
||||
int lcx = chunk.LocalX;
|
||||
int lcz = chunk.LocalZ;
|
||||
int cx = chunk.X;
|
||||
int cz = chunk.Z;
|
||||
int lcx = cx - _rx * ChunkManager.REGION_XLEN;
|
||||
int lcz = cz - _rz * ChunkManager.REGION_ZLEN;
|
||||
|
||||
ChunkKey k = new ChunkKey(lcx, lcz);
|
||||
ChunkKey k = new ChunkKey(lcx, lcx);
|
||||
if (_dirty.ContainsKey(k)) {
|
||||
_dirty.Remove(k);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue