Skip to content

Commit

Permalink
Attempted to fix radiusGenerator
Browse files Browse the repository at this point in the history
As it turns out there goes something wrong along the line while parsing chunks, culminating in different values of chunks packed array ONLY ON WINDOWS.
I am not sure where it happens, but somewhere before getBlockStates(). It's not CRLF related and hashes match. It might be cNBT, probably not.
Couldn't create tests for that because the Windows C development enviroment is hellish compared to linux.
  • Loading branch information
TCA166 committed Jul 21, 2023
1 parent 6319148 commit 15313fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chunkParser.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "errorDefs.h"
#include "chunkParser.h"

#define createMask(startBit, X) (((long)1 << X) - 1) << startBit
#define createMask(startBit, X) ((((long)1) << X) - 1) << startBit

#define statesFormula(x, y, z) (y*16*16) + (z*16) + x

Expand Down Expand Up @@ -191,6 +191,7 @@ unsigned int* getBlockStates(struct section s, int* outLen){
l = 4;
}
short numPerLong = (short)(64/l);
//fprintf(stderr, "%d %d\n", l, numPerLong);
states = malloc(numPerLong * s.blockDataLen * sizeof(unsigned int));
//foreach long
for(int a=0; a < s.blockDataLen; a++){
Expand All @@ -202,6 +203,7 @@ unsigned int* getBlockStates(struct section s, int* outLen){
short bits = b * l;
unsigned long mask = createMask(bits, l);
states[m] = (unsigned int)((mask & comp) >> bits);
//fprintf(stderr, "%ld&%ld=%ld, >>%d=%d\n", mask, comp, (mask & comp), bits, states[m]);
m++;
}
}
Expand Down

0 comments on commit 15313fa

Please sign in to comment.