Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12618) [Bugfix] FoW & Watchtowers
Home

[Freeciv-Dev] Re: (PR#12618) [Bugfix] FoW & Watchtowers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12618) [Bugfix] FoW & Watchtowers
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Thu, 24 Mar 2005 13:30:57 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12618 >

Marko Lindqvist wrote:
> 
>   There might be allied units in the stack...
> 
>   Untested

  S2_0 version


  - ML

diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c  2005-03-24 23:11:34.796875000 +0200
+++ freeciv/server/citytools.c  2005-03-24 23:20:23.765625000 +0200
@@ -1019,12 +1019,14 @@
   city_refresh(pcity);
 
   /* Put vision back to normal, if fortress acted as a watchtower */
-  if (player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)
-      && map_has_special(ptile, S_FORTRESS)) {
+  if (map_has_special(ptile, S_FORTRESS)) {
     unit_list_iterate((ptile)->units, punit) {
-      unfog_area(pplayer, punit->tile,
-                unit_type(punit)->vision_range);
-      fog_area(pplayer, punit->tile, get_watchtower_vision(punit));
+      struct player *owner = unit_owner(punit);
+      if (player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
+        unfog_area(owner, punit->tile,
+                   unit_type(punit)->vision_range);
+        fog_area(owner, punit->tile, get_watchtower_vision(punit));
+      }
     }
     unit_list_iterate_end;
   }
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c  2005-03-24 23:11:37.781250000 +0200
+++ freeciv/server/unittools.c  2005-03-24 23:20:02.843750000 +0200
@@ -616,21 +616,22 @@
        }
 
        /* If a watchtower has been pillaged, reduce sight to normal */
-       if (what == S_FORTRESS
-           && player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
-         freelog(LOG_VERBOSE, "Watchtower pillaged!");
-         unit_list_iterate(punit->tile->units,
-                           punit2) {
-           if (is_ground_unit(punit2)) {
-              /* Unfog (increase seen counter) first, fog (decrease counter)
-               * later, so tiles that are within vision range both before and
-               * after are not even temporarily marked fogged. */
-             unfog_area(pplayer, punit2->tile,
-                        unit_type(punit2)->vision_range);
-             fog_area(pplayer, punit2->tile,
-                      get_watchtower_vision(punit2));
-           }
-         }
+       if (what == S_FORTRESS) {
+         unit_list_iterate(punit->tile->units, punit2) {
+            struct player *owner = unit_owner(punit2);
+            freelog(LOG_VERBOSE, "Watchtower pillaged!");
+            if (player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
+              if (is_ground_unit(punit2)) {
+                /* Unfog (increase seen counter) first, fog (decrease counter)
+                 * later, so tiles that are within vision range both before and
+                 * after are not even temporarily marked fogged. */
+                unfog_area(owner, punit2->tile,
+                           unit_type(punit2)->vision_range);
+                fog_area(owner, punit2->tile,
+                         get_watchtower_vision(punit2));
+              }
+            }
+          }
          unit_list_iterate_end;
        }
       }
@@ -650,23 +651,25 @@
       update_tile_knowledge(punit->tile);
       
       /* If a watchtower has been pillaged, reduce sight to normal */
-      if (what_pillaged == S_FORTRESS
-         && player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
+      if (what_pillaged == S_FORTRESS) {
        freelog(LOG_VERBOSE, "Watchtower(2) pillaged!");
        unit_list_iterate(punit->tile->units, punit2) {
-         if (is_ground_unit(punit2)) {
-            /* Unfog (increase seen counter) first, fog (decrease counter)
-             * later, so tiles that are within vision range both before and
-             * after are not even temporarily marked fogged. */
-           unfog_area(pplayer, punit2->tile,
-                      unit_type(punit2)->vision_range);
-           fog_area(pplayer, punit2->tile,
-                    get_watchtower_vision(punit2));
-         }
-       }
+          struct player *owner = unit_owner(punit2);
+          if (player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
+            if (is_ground_unit(punit2)) {
+              /* Unfog (increase seen counter) first, fog (decrease counter)
+               * later, so tiles that are within vision range both before and
+               * after are not even temporarily marked fogged. */
+              unfog_area(owner, punit2->tile,
+                         unit_type(punit2)->vision_range);
+              fog_area(owner, punit2->tile,
+                       get_watchtower_vision(punit2));
+            }
+          }
+        }
        unit_list_iterate_end;
       }
-    }    
+    }  
   }
 
   if (activity==ACTIVITY_POLLUTION) {
@@ -691,20 +694,21 @@
       map_set_special(punit->tile, S_FORTRESS);
       unit_activity_done = TRUE;
       /* watchtower becomes effective */
-      if (player_knows_techs_with_flag(pplayer, TF_WATCHTOWER)) {
-       unit_list_iterate(ptile->units, punit) {
+      unit_list_iterate(ptile->units, punit) {
+        struct player *owner = unit_owner(punit);
+        if (player_knows_techs_with_flag(owner, TF_WATCHTOWER)) {
          if (is_ground_unit(punit)) {
             /* Unfog (increase seen counter) first, fog (decrease counter)
              * later, so tiles that are within vision range both before and
              * after are not even temporarily marked fogged. */
-           unfog_area(pplayer, punit->tile,
+           unfog_area(owner, punit->tile,
                       get_watchtower_vision(punit));
-           fog_area(pplayer, punit->tile,
+           fog_area(owner, punit->tile,
                     unit_type(punit)->vision_range);
          }
        }
-       unit_list_iterate_end;
       }
+      unit_list_iterate_end;
     }
   }
 

[Prev in Thread] Current Thread [Next in Thread]