From 67146f6ab20693dd90ba84f8ec6acba80c8c8e87 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 16 Jan 2017 11:48:56 +0000 Subject: [PATCH] Revert "Simplify Group::IsVisible(), GroupsInOrder()." This reverts commit 022d012a4454952f454e33278af744c01f69667a. The commit above has caused crashes during pruning. --- src/generate.cpp | 11 +++++++++-- src/group.cpp | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/generate.cpp b/src/generate.cpp index 98a6617..41066c7 100644 --- a/src/generate.cpp +++ b/src/generate.cpp @@ -57,8 +57,15 @@ bool SolveSpaceUI::PruneOrphans() { bool SolveSpaceUI::GroupsInOrder(hGroup before, hGroup after) { if(before.v == 0) return true; if(after.v == 0) return true; - int beforep = SK.GetGroup(before)->order; - int afterp = SK.GetGroup(after)->order; + + int beforep = -1, afterp = -1; + int i; + for(i = 0; i < SK.groupOrder.n; i++) { + hGroup hg = SK.groupOrder.elem[i]; + if(hg.v == before.v) beforep = i; + if(hg.v == after.v) afterp = i; + } + if(beforep < 0 || afterp < 0) return false; if(beforep >= afterp) return false; return true; } diff --git a/src/group.cpp b/src/group.cpp index c3da08a..2a04d68 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -44,8 +44,7 @@ void Group::AddParam(IdList *param, hParam hp, double v) { bool Group::IsVisible() { if(!visible) return false; - Group *active = SK.GetGroup(SS.GW.activeGroup); - if(order > active->order) return false; + if(SS.GroupsInOrder(SS.GW.activeGroup, h)) return false; return true; }