fix: remove crash due to wrapping

This commit is contained in:
Kazhnuz 2019-12-28 10:10:51 +01:00
parent f36f178890
commit 144cc0ba6b

View file

@ -332,7 +332,7 @@ function World:getChunkData(chunkid, turn)
return self:getFakeChunk()
else
chunkid = (chunkid - 1)
chunkid = utils.math.wrap(chunkid, 0, #self.chunks)
chunkid = chunkid % #self.chunks
return self.chunks[chunkid + 1], true
end
elseif chunkid > #self.chunks then
@ -340,7 +340,7 @@ function World:getChunkData(chunkid, turn)
return self:getFakeChunk()
else
chunkid = (chunkid - 1)
chunkid = utils.math.wrap(chunkid, 0, #self.chunks)
chunkid = chunkid % #self.chunks
return self.chunks[chunkid + 1], true
end
else