Added salt option to scanForQuads for convenience with protobases.

This commit is contained in:
Cubitect 2021-02-21 17:50:56 +01:00
parent 11954031c6
commit f4c49c8380
2 changed files with 5 additions and 4 deletions

View File

@ -715,7 +715,7 @@ int scanForQuadBits(const StructureConfig sconf, int radius, int64_t s48,
int scanForQuads(
const StructureConfig sconf, int radius, int64_t s48,
const int64_t *lowBits, int lowBitCnt, int lowBitN,
const int64_t *lowBits, int lowBitCnt, int lowBitN, int64_t salt,
int x, int z, int w, int h, Pos *qplist, int n)
{
int i, cnt = 0;
@ -729,7 +729,7 @@ int scanForQuads(
for (i = 0; i < lowBitCnt; i++)
{
cnt += scanForQuadBits(sconf, radius, s48, lowBits[i], lowBitN, invB,
cnt += scanForQuadBits(sconf, radius, s48, lowBits[i]-salt, lowBitN, invB,
x, z, w, h, qplist+cnt, n-cnt);
if (cnt >= n)
break;

View File

@ -425,15 +425,16 @@ Pos getOptimalAfk(Pos p[4], int ax, int ay, int az, int *spcnt);
* @lowBits : consider transformations that yield one of these lower bits
* @lowBitCnt : length of lower bit subset
* @lowBitN : number of bits in the subset values (0 < lowBitN <= 48)
* @salt : salt subtracted from subset values (useful for protobases)
* @x,z,w,h : area to scan in region coordinates (inclusive)
* @qplist : output region coordinates for the descovered quad-structures
* @n : maximum number of quad-structures to look for
*
*<
* Returns the number of quad-structures found (up to 'n').
*/
int scanForQuads(
const StructureConfig sconf, int radius, int64_t s48,
const int64_t *lowBits, int lowBitCnt, int lowBitN,
const int64_t *lowBits, int lowBitCnt, int lowBitN, int64_t salt,
int x, int z, int w, int h, Pos *qplist, int n);
//==============================================================================