diff options
-rw-r--r-- | doc/changelog.txt | 3 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | util/colors.txt | 23 | ||||
-rwxr-xr-x | util/minetestmapper.py | 73 |
4 files changed, 89 insertions, 12 deletions
diff --git a/doc/changelog.txt b/doc/changelog.txt index d242070b6..0b8f83636 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -11,6 +11,9 @@ X: - Fix the long-existed PeerNotFound loop bug - Some translations and localization-related fixes - Lots of small fixes, once again +- Using chosen map seed is now possible through fixed_map_seed configuration option +- Map is now saved in an SQLite database +- Fixed the nasty server-side infinite PeerNotFound loop bug 2011-07-31_3: - Fixes a bug that made the server to deny non-empty passwords from players connecting the first time diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c3b0960a..c479b4e73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,7 +74,7 @@ else() endif(APPLE) endif(BUILD_CLIENT) find_package(ZLIB REQUIRED) - set(PLATFORM_LIBS -lpthread) + set(PLATFORM_LIBS -lpthread ${CMAKE_DL_LIBS}) #set(CLIENT_PLATFORM_LIBS -lXxf86vm) # This way Xxf86vm is found on OpenBSD too find_library(XXF86VM_LIBRARY Xxf86vm) diff --git a/util/colors.txt b/util/colors.txt index 2dceb9134..b605a9e2e 100644 --- a/util/colors.txt +++ b/util/colors.txt @@ -1,22 +1,26 @@ 0 128 128 128 # CONTENT_STONE
-800 107 134 51 # CONTENT_GRASS
2 39 66 106 # CONTENT_WATER
3 255 255 0 # CONTENT_TORCH
+9 39 66 106 # CONTENT_WATERSOURCE
+e 117 86 41 # CONTENT_SIGN_WALL
+f 128 79 0 # CONTENT_CHEST
+10 118 118 118 # CONTENT_FURNACE
+15 103 78 42 # CONTENT_FENCE
+1e 162 119 53 # CONTENT_RAIL
+1f 154 110 40 # CONTENT_LADDER
+20 255 204 0 # CONTENT_LAVA
+21 255 204 0 # CONTENT_LAVASOURCE
+800 107 134 51 # CONTENT_GRASS
801 86 58 31 # CONTENT_TREE
802 48 95 8 # CONTENT_LEAVES
803 102 129 38 # CONTENT_GRASS_FOOTSTEPS
804 178 178 0 # CONTENT_MESE
805 101 84 36 # CONTENT_MUD
-9 39 66 106 # CONTENT_WATERSOURCE
808 104 78 42 # CONTENT_WOOD
809 210 194 156 # CONTENT_SAND
-e 117 86 41 # CONTENT_SIGN_WALL
-f 128 79 0 # CONTENT_CHEST
-10 118 118 118 # CONTENT_FURNACE
80a 123 123 123 # CONTENT_COBBLE
80b 199 199 199 # CONTENT_STEEL
-80c 183 183 222 # CONENT_GLASS
-15 103 78 42 # CONTENT_FENCE
+80c 183 183 222 # CONTENT_GLASS
80d 219 202 178 # CONTENT_MOSSYCOBBLE
80e 78 154 6 # CONTENT_GRAVEL
80f 204 0 0 # CONTENT_SANDSTONE
@@ -24,3 +28,8 @@ f 128 79 0 # CONTENT_CHEST 811 170 50 25 # CONTENT_BRICK
812 104 78 42 # CONTENT_CLAY
813 58 105 18 # CONTENT_PAPYRUS
+814 196 160 0 # CONTENT_BOOKSHELF
+815 205 190 121 # CONTENT_JUNGLETREE
+816 62 101 25 # CONTENT_JUNGLEGRASS
+817 255 153 255 # CONTENT_NC
+818 102 50 255 # CONTENT_NC_RB
diff --git a/util/minetestmapper.py b/util/minetestmapper.py index e13a1bdc3..c7ec0774e 100755 --- a/util/minetestmapper.py +++ b/util/minetestmapper.py @@ -85,6 +85,13 @@ def int_to_hex4(i): return "%04X" % i +def getBlockAsInteger(p): + return p[2]*16777216 + p[1]*4096 + p[0] + +def getIntegerAsBlock(i): + return i%4096, int(i/4096)%4096, int(i/16777216)%4096 + + def limit(i, l, h): if(i > h): i = h @@ -169,6 +176,30 @@ zlist = [] # List all sectors to memory and calculate the width and heigth of the # resulting picture. + +conn = None +cur = None +if os.path.exists(path + "map.sqlite"): + import sqlite3 + conn = sqlite3.connect(path + "map.sqlite") + cur = conn.cursor() + + cur.execute("SELECT `pos` FROM `blocks`") + while True: + r = cur.fetchone() + if not r: + break + + x, y, z = getIntegerAsBlock (r[0]) + + if x < sector_xmin or x > sector_xmax: + continue + if z < sector_zmin or z > sector_zmax: + continue + + xlist.append(x) + zlist.append(z) + if os.path.exists(path + "sectors2"): for filename in os.listdir(path + "sectors2"): for filename2 in os.listdir(path + "sectors2/" + filename): @@ -305,6 +336,16 @@ for n in range(len(xlist)): sectortype = "" + if cur: + ps = getBlockAsInteger((xpos, 0, zpos)) + cur.execute("SELECT `pos` FROM `blocks` WHERE `pos`>=? AND `pos`<?", (ps, ps + 4096)) + while True: + r = cur.fetchone() + if not r: + break + pos = getIntegerAsBlock(r[0])[1] + ylist.append(pos) + sectortype = "sqlite" try: for filename in os.listdir(path + "sectors/" + sector1): if(filename != "meta"): @@ -316,7 +357,7 @@ for n in range(len(xlist)): except OSError: pass - if sectortype != "old": + if sectortype == "": try: for filename in os.listdir(path + "sectors2/" + sector2): if(filename != "meta"): @@ -348,10 +389,21 @@ for n in range(len(xlist)): yhex = int_to_hex4(ypos) filename = "" - if sectortype == "old": - filename = path + "sectors/" + sector1 + "/" + yhex.lower() + if sectortype == "sqlite": + ps = getBlockAsInteger((xpos, ypos, zpos)) + cur.execute("SELECT `data` FROM `blocks` WHERE `pos`==? LIMIT 1", (ps,)) + r = cur.fetchone() + if not r: + continue + filename = "mtm_tmp" + f = file(filename, 'wb') + f.write(r[0]) + f.close() else: - filename = path + "sectors2/" + sector2 + "/" + yhex.lower() + if sectortype == "old": + filename = path + "sectors/" + sector1 + "/" + yhex.lower() + else: + filename = path + "sectors2/" + sector2 + "/" + yhex.lower() f = file(filename, "rb") @@ -374,6 +426,16 @@ for n in range(len(xlist)): if len(pixellist) > 0: for (ypos, filename) in ylist2: + ps = getBlockAsInteger((xpos, ypos, zpos)) + cur.execute("SELECT `data` FROM `blocks` WHERE `pos`==? LIMIT 1", (ps,)) + r = cur.fetchone() + if not r: + continue + filename = "mtm_tmp" + f = file(filename, 'wb') + f.write(r[0]) + f.close() + f = file(filename, "rb") version = ord(f.read(1)) @@ -495,5 +557,8 @@ if drawplayers: except OSError: pass +if os.path.isfile("mtm_tmp"): + os.remove("mtm_tmp") + print "Saving" im.save(output) |