Scramble map by transforming DB pos column

For people working on the C++ code.
Post Reply
New member
Posts: 1
Joined: Sun Jul 19, 2020 12:49
GitHub: NathanBaulch

Scramble map by transforming DB pos column

by NathanBaulch » Post

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;
What am I missing? Thanks!

Posts: 125
Joined: Sun Nov 12, 2017 18:24

Re: Scramble map by transforming DB pos column

by talamh » Post might do what you are trying to do.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests