Author: cazfi
Date: Fri Dec 18 21:06:49 2015
New Revision: 31077
URL: http://svn.gna.org/viewcvs/freeciv?rev=31077&view=rev
Log:
Use extra_type_by_cause_iterate() instead of extra_type_iterate() with extra
checks
in editor.
See patch #6687
Modified:
trunk/client/gui-gtk-2.0/editprop.c
trunk/client/gui-gtk-3.0/editprop.c
Modified: trunk/client/gui-gtk-2.0/editprop.c
URL:
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/editprop.c?rev=31077&r1=31076&r2=31077&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/editprop.c (original)
+++ trunk/client/gui-gtk-2.0/editprop.c Fri Dec 18 21:06:49 2015
@@ -1507,21 +1507,19 @@
break;
case OPID_TILE_ROADS:
BV_CLR_ALL(pv->data.v_bv_roads);
- extra_type_iterate(pextra) {
- if (tile_has_extra(ptile, pextra)
- && is_extra_caused_by(pextra, EC_ROAD)) {
+ extra_type_by_cause_iterate(EC_ROAD, pextra) {
+ if (tile_has_extra(ptile, pextra)) {
BV_SET(pv->data.v_bv_roads, road_index(extra_road_get(pextra)));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
break;
case OPID_TILE_BASES:
BV_CLR_ALL(pv->data.v_bv_bases);
- extra_type_iterate(pextra) {
- if (tile_has_extra(ptile, pextra)
- && is_extra_caused_by(pextra, EC_BASE)) {
+ extra_type_by_cause_iterate(EC_BASE, pextra) {
+ if (tile_has_extra(ptile, pextra)) {
BV_SET(pv->data.v_bv_bases, base_index(extra_base_get(pextra)));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
break;
case OPID_TILE_VISION:
pv->data.v_tile_vision = fc_malloc(sizeof(struct tile_vision_data));
@@ -2366,30 +2364,26 @@
} extra_type_by_cause_iterate_end;
return;
case OPID_TILE_ROADS:
- extra_type_iterate(pextra) {
- if (is_extra_caused_by(pextra, EC_ROAD)) {
- int ridx = road_index(extra_road_get(pextra));
-
- if (BV_ISSET(pv->data.v_bv_roads, ridx)) {
- BV_SET(packet->extras, extra_index(pextra));
- } else {
- BV_CLR(packet->extras, extra_index(pextra));
- }
+ extra_type_by_cause_iterate(EC_ROAD, pextra) {
+ int ridx = road_index(extra_road_get(pextra));
+
+ if (BV_ISSET(pv->data.v_bv_roads, ridx)) {
+ BV_SET(packet->extras, extra_index(pextra));
+ } else {
+ BV_CLR(packet->extras, extra_index(pextra));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
return;
case OPID_TILE_BASES:
- extra_type_iterate(pextra) {
- if (is_extra_caused_by(pextra, EC_BASE)) {
- int bidx = base_index(extra_base_get(pextra));
-
- if (BV_ISSET(pv->data.v_bv_bases, bidx)) {
- BV_SET(packet->extras, extra_index(pextra));
- } else {
- BV_CLR(packet->extras, extra_index(pextra));
- }
+ extra_type_by_cause_iterate(EC_BASE, pextra) {
+ int bidx = base_index(extra_base_get(pextra));
+
+ if (BV_ISSET(pv->data.v_bv_bases, bidx)) {
+ BV_SET(packet->extras, extra_index(pextra));
+ } else {
+ BV_CLR(packet->extras, extra_index(pextra));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
return;
case OPID_TILE_LABEL:
sz_strlcpy(packet->label, pv->data.v_string);
Modified: trunk/client/gui-gtk-3.0/editprop.c
URL:
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/editprop.c?rev=31077&r1=31076&r2=31077&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/editprop.c (original)
+++ trunk/client/gui-gtk-3.0/editprop.c Fri Dec 18 21:06:49 2015
@@ -1507,21 +1507,19 @@
break;
case OPID_TILE_ROADS:
BV_CLR_ALL(pv->data.v_bv_roads);
- extra_type_iterate(pextra) {
- if (tile_has_extra(ptile, pextra)
- && is_extra_caused_by(pextra, EC_ROAD)) {
+ extra_type_by_cause_iterate(EC_ROAD, pextra) {
+ if (tile_has_extra(ptile, pextra)) {
BV_SET(pv->data.v_bv_roads, road_index(extra_road_get(pextra)));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
break;
case OPID_TILE_BASES:
BV_CLR_ALL(pv->data.v_bv_bases);
- extra_type_iterate(pextra) {
- if (tile_has_extra(ptile, pextra)
- && is_extra_caused_by(pextra, EC_BASE)) {
+ extra_type_by_cause_iterate(EC_BASE, pextra) {
+ if (tile_has_extra(ptile, pextra)) {
BV_SET(pv->data.v_bv_bases, base_index(extra_base_get(pextra)));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
break;
case OPID_TILE_VISION:
pv->data.v_tile_vision = fc_malloc(sizeof(struct tile_vision_data));
@@ -2366,30 +2364,26 @@
} extra_type_by_cause_iterate_end;
return;
case OPID_TILE_ROADS:
- extra_type_iterate(pextra) {
- if (is_extra_caused_by(pextra, EC_ROAD)) {
- int ridx = road_index(extra_road_get(pextra));
-
- if (BV_ISSET(pv->data.v_bv_roads, ridx)) {
- BV_SET(packet->extras, extra_index(pextra));
- } else {
- BV_CLR(packet->extras, extra_index(pextra));
- }
+ extra_type_by_cause_iterate(EC_ROAD, pextra) {
+ int ridx = road_index(extra_road_get(pextra));
+
+ if (BV_ISSET(pv->data.v_bv_roads, ridx)) {
+ BV_SET(packet->extras, extra_index(pextra));
+ } else {
+ BV_CLR(packet->extras, extra_index(pextra));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
return;
case OPID_TILE_BASES:
- extra_type_iterate(pextra) {
- if (is_extra_caused_by(pextra, EC_BASE)) {
- int bidx = base_index(extra_base_get(pextra));
-
- if (BV_ISSET(pv->data.v_bv_bases, bidx)) {
- BV_SET(packet->extras, extra_index(pextra));
- } else {
- BV_CLR(packet->extras, extra_index(pextra));
- }
+ extra_type_by_cause_iterate(EC_BASE, pextra) {
+ int bidx = base_index(extra_base_get(pextra));
+
+ if (BV_ISSET(pv->data.v_bv_bases, bidx)) {
+ BV_SET(packet->extras, extra_index(pextra));
+ } else {
+ BV_CLR(packet->extras, extra_index(pextra));
}
- } extra_type_iterate_end;
+ } extra_type_by_cause_iterate_end;
return;
case OPID_TILE_LABEL:
sz_strlcpy(packet->label, pv->data.v_string);
_______________________________________________
Freeciv-commits mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-commits