diff --git a/src/dsc.h b/src/dsc.h index 61b3782c..c2c29414 100644 --- a/src/dsc.h +++ b/src/dsc.h @@ -304,6 +304,22 @@ public: return t; } + int IndexOf(H h) { + int first = 0, last = n-1; + while(first <= last) { + int mid = (first + last)/2; + H hm = elem[mid].h; + if(hm.v > h.v) { + last = mid-1; // and first stays the same + } else if(hm.v < h.v) { + first = mid+1; // and last stays the same + } else { + return mid; + } + } + return -1; + } + T *FindByIdNoOops(H h) { int first = 0, last = n-1; while(first <= last) { diff --git a/src/generate.cpp b/src/generate.cpp index 048ce693..d4e45f00 100644 --- a/src/generate.cpp +++ b/src/generate.cpp @@ -168,6 +168,12 @@ void SolveSpaceUI::GenerateAll(void) { void SolveSpaceUI::GenerateAll(int first, int last, bool andFindFree) { int i, j; + // generate until active group + if(last == -2) { + last = SK.group.IndexOf(SS.GW.activeGroup); + if(last == -1) last = INT_MAX; + } + // Remove any requests or constraints that refer to a nonexistent // group; can check those immediately, since we know what the list // of groups should be. diff --git a/src/graphicswin.cpp b/src/graphicswin.cpp index 5bce93fc..909da945 100644 --- a/src/graphicswin.cpp +++ b/src/graphicswin.cpp @@ -886,7 +886,7 @@ void GraphicsWindow::MenuEdit(int id) { case MNU_REGEN_ALL: SS.ReloadAllImported(); - SS.GenerateAll(0, INT_MAX); + SS.GenerateAll(0, -2); SS.ScheduleShowTW(); break;