Exclude collisions.bin from KML viewer; it's not KML anymore.

And fix a crash on the challenges screen by not considering the actions
of inactive buttons to count as duplicates.
This commit is contained in:
Dustin Carlino 2021-02-13 17:06:06 -08:00
parent 65b1f24d5d
commit 0f1c30a889
2 changed files with 6 additions and 3 deletions

View File

@ -155,6 +155,7 @@ impl State<App> for ViewKML {
.filter(|x| {
(x.ends_with(".bin") || x.ends_with(".kml") || x.ends_with(".csv"))
&& !x.ends_with("popdat.bin")
&& !x.ends_with("collisions.bin")
})
.collect(),
),

View File

@ -642,10 +642,12 @@ impl Widget {
fn get_all_click_actions(&self, actions: &mut HashSet<String>) {
if let Some(btn) = self.widget.downcast_ref::<Button>() {
if actions.contains(&btn.action) {
panic!("Two buttons in one Panel both use action {}", btn.action);
if btn.is_enabled() {
if actions.contains(&btn.action) {
panic!("Two buttons in one Panel both use action {}", btn.action);
}
actions.insert(btn.action.clone());
}
actions.insert(btn.action.clone());
} else if let Some(container) = self.widget.downcast_ref::<Container>() {
for w in &container.members {
w.get_all_click_actions(actions);