1
0
镜像自地址 https://gitlab.com/gaelysam/mapgen_rivers.git 已同步 2025-11-07 11:35:17 +01:00

Initial commit: working example using a basis of Simplex noise and implementing river flowing, lakes, and erosion

这个提交包含在:
Gael-de-Sailly
2020-04-09 21:13:38 +02:00
当前提交 0bf351b2f6
共有 7 个文件被更改,包括 497 次插入0 次删除

28
load.lua 普通文件
查看文件

@@ -0,0 +1,28 @@
local function load_map(filename, bytes, signed)
local file = io.open(filename, 'r')
local data = file:read('*all')
local map = {}
local size = math.floor(#data/bytes)
for i=1, size do
local i0, i1 = (i-1)*bytes+1, i*bytes
local elements = {data:byte(i0, i1)}
local n = elements[1]
if signed and n >= 128 then
n = n - 256
end
for j=2, bytes do
n = n*256 + elements[j]
end
map[i] = n
end
file:close()
return map
end
return load_map