Author: cazfi
Date: Sat Dec  6 09:34:37 2014
New Revision: 27188

URL: http://svn.gna.org/viewcvs/freeciv?rev=27188&view=rev
Log:
Avoid expensive check for bases that would need their flags shown if the
tile has no extras owner set at all, i.e, when all bases on tile are unowned.

See patch #5450

Modified:
    trunk/client/tilespec.c

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=27188&r1=27187&r2=27188&view=diff
==============================================================================
--- trunk/client/tilespec.c     (original)
+++ trunk/client/tilespec.c     Sat Dec  6 09:34:37 2014
@@ -5201,29 +5201,31 @@
 
         /* Show base flag. Not part of previous iteration as
          * "extras of ESTYLE_3_LAYER" != "bases" */
-        base_type_iterate(pbase) {
-          if (tile_has_base(ptile, pbase)
-              && base_has_flag(pbase, BF_SHOW_FLAG)) {
-            struct extra_type *basextra = base_extra_get(pbase);
-            bool hidden = FALSE;
-
-            extra_type_list_iterate(basextra->hiders, phider) {
-              if (BV_ISSET(textras, extra_index(phider))) {
-                hidden = TRUE;
-                break;
+        if (owner != NULL) {
+          base_type_iterate(pbase) {
+            if (tile_has_base(ptile, pbase)
+                && base_has_flag(pbase, BF_SHOW_FLAG)) {
+              struct extra_type *basextra = base_extra_get(pbase);
+              bool hidden = FALSE;
+
+              extra_type_list_iterate(basextra->hiders, phider) {
+                if (BV_ISSET(textras, extra_index(phider))) {
+                  hidden = TRUE;
+                  break;
+                }
+              } extra_type_list_iterate_end;
+
+              if (!hidden) {
+                show_flag = TRUE;
               }
-            } extra_type_list_iterate_end;
-
-            if (!hidden) {
-              show_flag = TRUE;
             }
+          } base_type_iterate_end;
+
+          if (show_flag) {
+            ADD_SPRITE(get_nation_flag_sprite(t, nation_of_player(owner)), 
TRUE,
+                       FULL_TILE_X_OFFSET + t->city_flag_offset_x,
+                       FULL_TILE_Y_OFFSET + t->city_flag_offset_y);
           }
-        } base_type_iterate_end;
-
-        if (show_flag && owner != NULL) {
-          ADD_SPRITE(get_nation_flag_sprite(t, nation_of_player(owner)), TRUE,
-                     FULL_TILE_X_OFFSET + t->city_flag_offset_x,
-                     FULL_TILE_Y_OFFSET + t->city_flag_offset_y);
         }
       }
     }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to