Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to increase block ID range from 8-bit to 16-bit? #231

Open
fei2020 opened this issue Sep 19, 2019 · 0 comments
Open

How to increase block ID range from 8-bit to 16-bit? #231

fei2020 opened this issue Sep 19, 2019 · 0 comments

Comments

@fei2020
Copy link

fei2020 commented Sep 19, 2019

I find many places in the code w is regarded as a signed char. Such as light_fill(), map_set and etc.
MapEntry.w is char:

typedef union {
    unsigned int value;
    struct {
        unsigned char x;
        unsigned char y;
        unsigned char z;
	char w;
    } e;
} MapEntry;

It seems a lot of code and algorithms need to be modified to increase block ID range from 8-bit to 16-bit. If I modify MapEntry::e::w be short, main.c.light_fill(...) will be leaded to dead iterator. I just simply add a violent cast in light_fill, it seems works. But I know little about the algorithm of light_fill. I worry it will work wrong in some cases.

void light_fill(
    char *opaque, char *light,
    int x, int y, int z, int w, int force)
{
	w = (char)w;  //add a violent cast simply
	if (x + w < XZ_LO || z + w < XZ_LO) {
        return;
    }
......

Related:
#116
satoshinm/NetCraft#55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant