summaryrefslogtreecommitdiff
path: root/mcmap/region.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-08-12 14:59:37 +0200
committerKevin Chabowski <kevin@kch42.de>2013-08-12 14:59:37 +0200
commit230c827d579d868327f7b0ef31284e1154c80f06 (patch)
tree5a116ac75e15469989330bb3e33be09d9520b5a2 /mcmap/region.go
parent40b8da6d026d43328242b252aea3a09f8939e756 (diff)
downloadgomcmap-230c827d579d868327f7b0ef31284e1154c80f06.tar.gz
gomcmap-230c827d579d868327f7b0ef31284e1154c80f06.tar.bz2
gomcmap-230c827d579d868327f7b0ef31284e1154c80f06.zip
Chunks are now marked at unused in a function of Chunk.
Diffstat (limited to 'mcmap/region.go')
-rw-r--r--mcmap/region.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/mcmap/region.go b/mcmap/region.go
index 67966aa..0e569da 100644
--- a/mcmap/region.go
+++ b/mcmap/region.go
@@ -198,7 +198,7 @@ func (reg *Region) Chunk(x, z int) (*Chunk, error) {
}
var err error
- if chunk, err = pc.toChunk(); err != nil {
+ if chunk, err = pc.toChunk(reg); err != nil {
return nil, err
}
sc.chunks[cPos] = chunk
@@ -211,8 +211,7 @@ func (reg *Region) Chunk(x, z int) (*Chunk, error) {
return chunk, nil
}
-// UnloadChunk marks a chunk as unused. If all chunks of a superchunk are marked as unused, the superchunk will be unloaded and saved (if needed).
-func (reg *Region) UnloadChunk(x, z int) error {
+func (reg *Region) unloadChunk(x, z int) error {
scx, scz, cx, cz := chunkToSuperchunk(x, z)
scPos := XZPos{scx, scz}
cPos := XZPos{cx, cz}
@@ -264,7 +263,7 @@ func (reg *Region) AllChunks() <-chan XZPos {
return ch
}
-// Save saves modified and unloaded chunks.
+// Save saves modified and unused chunks.
func (reg *Region) Save() error {
return reg.cleanSuperchunks(true)
}