Author: cazfi Date: Tue Jun 28 07:41:52 2016 New Revision: 33075 URL: http://svn.gna.org/viewcvs/freeciv?rev=33075&view=rev Log: Added active_iterate macros about ruleset objects that can be disabled.
See bug #24793 Modified: branches/S2_6/common/improvement.h branches/S2_6/common/tech.h branches/S2_6/common/unittype.h branches/S2_6/tools/ruledit/tab_misc.cpp Modified: branches/S2_6/common/improvement.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/improvement.h?rev=33075&r1=33074&r2=33075&view=diff ============================================================================== --- branches/S2_6/common/improvement.h (original) +++ branches/S2_6/common/improvement.h Tue Jun 28 07:41:52 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -212,6 +212,14 @@ } \ } +#define improvement_active_iterate(_p) \ + improvement_iterate(_p) { \ + if (!_p->disabled) { + +#define improvement_active_iterate_end \ + } \ + } improvement_iterate_end; + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: branches/S2_6/common/tech.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/tech.h?rev=33075&r1=33074&r2=33075&view=diff ============================================================================== --- branches/S2_6/common/tech.h (original) +++ branches/S2_6/common/tech.h Tue Jun 28 07:41:52 2016 @@ -208,6 +208,15 @@ } \ } +#define advance_active_iterate(_p) \ + advance_iterate(A_FIRST, _p) { \ + if (_p->require[AR_ONE] != A_NEVER) { + +#define advance_active_iterate_end \ + } \ + } advance_iterate_end; + + /* Advance requirements iterator. */ struct advance_req_iter; Modified: branches/S2_6/common/unittype.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unittype.h?rev=33075&r1=33074&r2=33075&view=diff ============================================================================== --- branches/S2_6/common/unittype.h (original) +++ branches/S2_6/common/unittype.h Tue Jun 28 07:41:52 2016 @@ -725,6 +725,15 @@ } \ } +#define unit_active_type_iterate(_p) \ + unit_type_iterate(_p) { \ + if (!_p->disabled) { + +#define unit_active_type_iterate_end \ + } \ + } unit_type_iterate_end; + + void *utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai); void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai, void *data); Modified: branches/S2_6/tools/ruledit/tab_misc.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/tab_misc.cpp?rev=33075&r1=33074&r2=33075&view=diff ============================================================================== --- branches/S2_6/tools/ruledit/tab_misc.cpp (original) +++ branches/S2_6/tools/ruledit/tab_misc.cpp Tue Jun 28 07:41:52 2016 @@ -218,29 +218,23 @@ stats->item(row++, 1)->setText(QString::number(game.control.resource_count)); count = 0; - advance_iterate(A_FIRST, padv) { - if (padv->require[AR_ONE] != A_NEVER) { - count++; - } - } advance_iterate_end; + advance_active_iterate(padv) { + count++; + } advance_active_iterate_end; stats->item(row++, 1)->setText(QString::number(count)); stats->item(row++, 1)->setText(QString::number(game.control.num_unit_classes)); count = 0; - unit_type_iterate(ptype) { - if (!ptype->disabled) { - count++; - } - } unit_type_iterate_end; + unit_active_type_iterate(ptype) { + count++; + } unit_active_type_iterate_end; stats->item(row++, 1)->setText(QString::number(count)); count = 0; - improvement_iterate(pimpr) { - if (!pimpr->disabled) { - count++; - } - } improvement_iterate_end; + improvement_active_iterate(pimpr) { + count++; + } improvement_active_iterate_end; stats->item(row++, 1)->setText(QString::number(count)); // Second column _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits