pattern I, and fixed the possible crashes in nearest_map and furthest_map

This commit is contained in:
Zeno Rogue 2021-07-09 14:04:04 +02:00
parent 3c7e64c66d
commit 41faa43f65
1 changed files with 11 additions and 6 deletions

View File

@ -1608,12 +1608,12 @@ EX namespace patterns {
cell *sc = currentmap->gamestart();
auto ac = currentmap->allcells();
vector<int> bydist(20, 0);
vector<int> bynei(S7+1, 0);
vector<int> bydist(100, 0);
vector<int> bynei(FULL_EDGE+1, 0);
int maxd = 0;
for(cell *d: ac) {
int di = celldistance(sc, d);
bydist[di]++;
if(di<100) bydist[di]++;
maxd = max(maxd, di);
}
@ -1649,12 +1649,12 @@ EX namespace patterns {
cell *sc = currentmap->gamestart();
auto ac = currentmap->allcells();
vector<int> bydist(20, 0);
vector<int> bynei(S7+1, 0);
vector<int> bydist(100, 0);
vector<int> bynei(FULL_EDGE+1, 0);
int maxd = 0;
for(cell *d: ac) {
int di = celldistance(sc, d);
bydist[di]++;
if(di<100) bydist[di]++;
maxd = max(maxd, di);
}
@ -1842,6 +1842,11 @@ EX namespace patterns {
if(c == cwt.at && rwalls <= 100) r &= 0xFFFFFF;
return r;
}
case 'I': {
color_t r = 0xFFD500;
if(c->type != (variation == eVariation::dual_subcubes ? 6 : 14)) r |= 0x1000000;
return r;
}
case '^': {
int x = c->master->fieldval & 4095;
int y = (c->master->fieldval >> 12) & 4095;