mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Remove vestigial code from the previous attempt at clever grid
generation. Grid generation should now be orders of magnitude faster at large sizes. [originally from svn r4220]
This commit is contained in:
19
rect.c
19
rect.c
@ -216,25 +216,6 @@ static struct rectlist *get_rectlist(game_params *params, int *grid)
|
|||||||
continue;
|
continue;
|
||||||
for (x = 0; x <= params->w - rw; x++)
|
for (x = 0; x <= params->w - rw; x++)
|
||||||
for (y = 0; y <= params->h - rh; y++) {
|
for (y = 0; y <= params->h - rh; y++) {
|
||||||
/*
|
|
||||||
* We have a candidate rectangle placement. See
|
|
||||||
* if it's unobstructed.
|
|
||||||
*/
|
|
||||||
int xx, yy;
|
|
||||||
int ok;
|
|
||||||
|
|
||||||
ok = TRUE;
|
|
||||||
for (xx = x; xx < x+rw; xx++)
|
|
||||||
for (yy = y; yy < y+rh; yy++)
|
|
||||||
if (index(params, grid, xx, yy) >= 0) {
|
|
||||||
ok = FALSE;
|
|
||||||
goto break1; /* break both loops at once */
|
|
||||||
}
|
|
||||||
break1:
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (nrects >= rectsize) {
|
if (nrects >= rectsize) {
|
||||||
rectsize = nrects + 256;
|
rectsize = nrects + 256;
|
||||||
rects = sresize(rects, rectsize, struct rect);
|
rects = sresize(rects, rectsize, struct rect);
|
||||||
|
Reference in New Issue
Block a user