From be07cbc307d1ad104e3e13dfa41922716f6b47e4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 25 Jun 2023 12:45:12 +0300 Subject: [PATCH 32/32] Ruledit: Use _re_active_iterate() at tab_???::refresh() See osdn #48288 Signed-off-by: Marko Lindqvist --- tools/ruledit/tab_building.cpp | 10 ++++------ tools/ruledit/tab_extras.cpp | 12 +++++------- tools/ruledit/tab_good.cpp | 12 +++++------- tools/ruledit/tab_gov.cpp | 12 +++++------- tools/ruledit/tab_multiplier.cpp | 12 +++++------- tools/ruledit/tab_tech.cpp | 10 ++++------ tools/ruledit/tab_terrains.cpp | 12 +++++------- tools/ruledit/tab_unit.cpp | 10 ++++------ 8 files changed, 37 insertions(+), 53 deletions(-) diff --git a/tools/ruledit/tab_building.cpp b/tools/ruledit/tab_building.cpp index 646f90cccb..b5f13301d7 100644 --- a/tools/ruledit/tab_building.cpp +++ b/tools/ruledit/tab_building.cpp @@ -120,13 +120,11 @@ void tab_building::refresh() { bldg_list->clear(); - improvement_iterate(pimpr) { - if (!pimpr->ruledit_disabled) { - QListWidgetItem *item = new QListWidgetItem(improvement_rule_name(pimpr)); + improvement_re_active_iterate(pimpr) { + QListWidgetItem *item = new QListWidgetItem(improvement_rule_name(pimpr)); - bldg_list->insertItem(improvement_index(pimpr), item); - } - } improvement_iterate_end; + bldg_list->insertItem(improvement_index(pimpr), item); + } improvement_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_extras.cpp b/tools/ruledit/tab_extras.cpp index fe5a94a546..ca93dd43b5 100644 --- a/tools/ruledit/tab_extras.cpp +++ b/tools/ruledit/tab_extras.cpp @@ -121,14 +121,12 @@ void tab_extras::refresh() { extra_list->clear(); - extra_type_iterate(pextra) { - if (!pextra->ruledit_disabled) { - QListWidgetItem *item = - new QListWidgetItem(QString::fromUtf8(extra_rule_name(pextra))); + extra_type_re_active_iterate(pextra) { + QListWidgetItem *item + = new QListWidgetItem(QString::fromUtf8(extra_rule_name(pextra))); - extra_list->insertItem(extra_index(pextra), item); - } - } extra_type_iterate_end; + extra_list->insertItem(extra_index(pextra), item); + } extra_type_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_good.cpp b/tools/ruledit/tab_good.cpp index 919869162b..2ce115376a 100644 --- a/tools/ruledit/tab_good.cpp +++ b/tools/ruledit/tab_good.cpp @@ -115,14 +115,12 @@ void tab_good::refresh() { good_list->clear(); - goods_type_iterate(pgood) { - if (!pgood->ruledit_disabled) { - QListWidgetItem *item = - new QListWidgetItem(QString::fromUtf8(goods_rule_name(pgood))); + goods_type_re_active_iterate(pgood) { + QListWidgetItem *item + = new QListWidgetItem(QString::fromUtf8(goods_rule_name(pgood))); - good_list->insertItem(goods_index(pgood), item); - } - } goods_type_iterate_end; + good_list->insertItem(goods_index(pgood), item); + } goods_type_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_gov.cpp b/tools/ruledit/tab_gov.cpp index 500bf19dfc..e2c38ece23 100644 --- a/tools/ruledit/tab_gov.cpp +++ b/tools/ruledit/tab_gov.cpp @@ -114,14 +114,12 @@ void tab_gov::refresh() { gov_list->clear(); - governments_iterate(pgov) { - if (!pgov->ruledit_disabled) { - QListWidgetItem *item = - new QListWidgetItem(QString::fromUtf8(government_rule_name(pgov))); + governments_re_active_iterate(pgov) { + QListWidgetItem *item + = new QListWidgetItem(QString::fromUtf8(government_rule_name(pgov))); - gov_list->insertItem(government_index(pgov), item); - } - } governments_iterate_end; + gov_list->insertItem(government_index(pgov), item); + } governments_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_multiplier.cpp b/tools/ruledit/tab_multiplier.cpp index 0b50d4797f..51fe4158e6 100644 --- a/tools/ruledit/tab_multiplier.cpp +++ b/tools/ruledit/tab_multiplier.cpp @@ -110,14 +110,12 @@ void tab_multiplier::refresh() { mpr_list->clear(); - multipliers_iterate(pmul) { - if (!pmul->ruledit_disabled) { - QListWidgetItem *item = - new QListWidgetItem(QString::fromUtf8(multiplier_rule_name(pmul))); + multipliers_re_active_iterate(pmul) { + QListWidgetItem *item + = new QListWidgetItem(QString::fromUtf8(multiplier_rule_name(pmul))); - mpr_list->insertItem(multiplier_index(pmul), item); - } - } multipliers_iterate_end; + mpr_list->insertItem(multiplier_index(pmul), item); + } multipliers_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_tech.cpp b/tools/ruledit/tab_tech.cpp index 9ac80c71c1..b49598b39c 100644 --- a/tools/ruledit/tab_tech.cpp +++ b/tools/ruledit/tab_tech.cpp @@ -135,13 +135,11 @@ void tab_tech::refresh() { tech_list->clear(); - advance_iterate(padv) { - if (padv->require[AR_ONE] != A_NEVER) { - QListWidgetItem *item = new QListWidgetItem(advance_rule_name(padv)); + advance_re_active_iterate(padv) { + QListWidgetItem *item = new QListWidgetItem(advance_rule_name(padv)); - tech_list->insertItem(advance_index(padv), item); - } - } advance_iterate_end; + tech_list->insertItem(advance_index(padv), item); + } advance_re_active_iterate_end; techs_to_menu(req1); techs_to_menu(req2); diff --git a/tools/ruledit/tab_terrains.cpp b/tools/ruledit/tab_terrains.cpp index ffd48cfe1c..ef65c38cdd 100644 --- a/tools/ruledit/tab_terrains.cpp +++ b/tools/ruledit/tab_terrains.cpp @@ -117,14 +117,12 @@ void tab_terrains::refresh() { terrain_list->clear(); - terrain_type_iterate(pterr) { - if (!pterr->ruledit_disabled) { - QListWidgetItem *item = - new QListWidgetItem(QString::fromUtf8(terrain_rule_name(pterr))); + terrain_re_active_iterate(pterr) { + QListWidgetItem *item + = new QListWidgetItem(QString::fromUtf8(terrain_rule_name(pterr))); - terrain_list->insertItem(terrain_index(pterr), item); - } - } terrain_type_iterate_end; + terrain_list->insertItem(terrain_index(pterr), item); + } terrain_re_active_iterate_end; } /**********************************************************************//** diff --git a/tools/ruledit/tab_unit.cpp b/tools/ruledit/tab_unit.cpp index 8225466d7a..6193257f80 100644 --- a/tools/ruledit/tab_unit.cpp +++ b/tools/ruledit/tab_unit.cpp @@ -117,13 +117,11 @@ void tab_unit::refresh() { unit_list->clear(); - unit_type_iterate(ptype) { - if (!ptype->ruledit_disabled) { - QListWidgetItem *item = new QListWidgetItem(utype_rule_name(ptype)); + unit_type_re_active_iterate(ptype) { + QListWidgetItem *item = new QListWidgetItem(utype_rule_name(ptype)); - unit_list->insertItem(utype_index(ptype), item); - } - } unit_type_iterate_end; + unit_list->insertItem(utype_index(ptype), item); + } unit_type_re_active_iterate_end; } /**********************************************************************//** -- 2.40.1