minetest-tools / mtmapprune

Prune map blocks from map.sqlite.
GNU Lesser General Public License v2.1
4 stars 3 forks source link

max_z default to 0 when only max_x is supplied to parameters #5

Closed juozaspo closed 5 years ago

juozaspo commented 5 years ago

Running mtmapprune with only max_x supplied, the max_z defaults to 0. Instead max_z should default to value of max_x, like described in readme.md. Game screenshots before and after running mtmapprune against the map.sqlite file: screenshot_20190519_174628 screenshot_20190519_174848

Test run in the code below, in which mtmapprune behaves incorrectly:

juozas@xubuntu:~/minetest$ cp worlds/test/map.sqlite worlds/test/map.sqlite.bak
juozas@xubuntu:~/minetest$ ~/mtmapprune/mtmapprune worlds/test/map.sqlite 1024
2019/05/19 17:47:41 Collecting blocks
2019/05/19 17:47:41 Deleting blocks
2019/05/19 17:47:44 Vaccuuming database
2019/05/19 17:47:44 Removed 88802 of 91073 blocks (limits: [-1024, -1024, 0]-[1024, 1024, 0])

When _maxy is supplied too, mtmapprune behaves correctly

juozas@xubuntu:~/minetest$ rm worlds/test/map.sqlite
juozas@xubuntu:~/minetest$ cp worlds/test/map.sqlite.bak worlds/test/map.sqlite
juozas@xubuntu:~/minetest$ ~/mtmapprune/mtmapprune worlds/test/map.sqlite 1024 256
2019/05/19 17:54:44 Collecting blocks
2019/05/19 17:54:44 Deleting blocks
2019/05/19 17:54:45 Vaccuuming database
2019/05/19 17:54:46 Removed 15834 of 91073 blocks (limits: [-1024, -256, -1024]-[1024, 256, 1024])

Custom build script, workaround for #1:

#!/bin/bash
# custom build script made by juozaspo, workaround for minetest-tools/mtmapprune#1
make clean
GOPATH=/usr/share/gocode make

Built on Ubuntu 18.04 LTS (64 bit) Commit: 46fb8dff72c6ecbb993081aaa26ead337728b2fa