Page 1 of 1

Scramble map by transforming DB pos column

Posted: Sun Jul 19, 2020 12:58
by NathanBaulch
I thought it would be fun/interesting to mirror the x and y positions of all blocks in my map DB.
However for some mysterious reason all the blocks in the negative x half are raised 1 block and blocks in the positive x half are lowered 1 block. This results in an awkward 2-block step dividing my map in two.

Here's the SQL I'm using to do this transformation:

Code: Select all

alter table blocks rename to oldblocks;
create table blocks (pos int primary key, data blob);
insert into blocks select (pos & 0xfff000) | (~pos & ~0xfff000), data from oldblocks;
drop table oldblocks;
vacuum;
What am I missing? Thanks!

Re: Scramble map by transforming DB pos column

Posted: Mon Jul 20, 2020 18:00
by talamh
Mirrormap.py might do what you are trying to do.
https://github.com/AndrejIT/map_unexplore