aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_inventory.h
diff options
context:
space:
mode:
authorSelat <LongExampletestName@gmail.com>2014-02-05 19:52:59 +0200
committersapier <Sapier at GMX dot net>2014-02-07 20:43:12 +0100
commit6715c422aecf0e8cb409a3d2cb056a1bffe63446 (patch)
tree9916fe9e36f40de56336d86b68f7874d4823bca9 /src/script/cpp_api/s_inventory.h
parentbc0bbffa1436eafd6aa75df8549a43da51fe7601 (diff)
downloadminetest-6715c422aecf0e8cb409a3d2cb056a1bffe63446.tar.gz
minetest-6715c422aecf0e8cb409a3d2cb056a1bffe63446.tar.bz2
minetest-6715c422aecf0e8cb409a3d2cb056a1bffe63446.zip
Fix memory leak in database migration
Diffstat (limited to 'src/script/cpp_api/s_inventory.h')
0 files changed, 0 insertions, 0 deletions
opt">.format((i>>8) & 0x000f) s += '{0:1x}'.format((i>>4) & 0x000f) s += '{0:1x}'.format((i>>0) & 0x000f) return s def getrand(): i = random.randrange(0,2) if i==0: return 0 return 254 def writeblock(mapdir, px,py,pz, version): sectordir = mapdir + "/sectors/" + to4h(px) + to4h(pz) try: os.makedirs(sectordir) except OSError: pass f = open(sectordir+"/"+to4h(py), "wb") if version == 0: # version f.write(struct.pack('B', 0)) # is_underground f.write(struct.pack('B', 0)) elif version == 2: # version f.write(struct.pack('B', 2)) # is_underground f.write(struct.pack('B', 0)) for z in range(0,16): for y in range(0,16): for x in range(0,16): b = 254 r = 20.0*pnoise((px*16+x)/100.,(pz*16+z)/100.,0) r += 5.0*pnoise((px*16+x)/25.,(pz*16+z)/25.,0) #print("r="+str(r)) y1 = py*16+y if y1 <= r-3: b = 0 #stone elif y1 <= r: b = 1 #grass elif y1 <= 1: b = 9 #water if version == 0: # Material content f.write(struct.pack('B', b))