Author: jtn
Date: Mon Feb 16 09:22:13 2015
New Revision: 28168

URL: http://svn.gna.org/viewcvs/freeciv?rev=28168&view=rev
Log:
Refresh city vision radius whenever a tech is researched, and once a
turn as backup.
This fixes delayed civ2civ3 Electricity vision bonus.

See gna bug #23254.

Modified:
    trunk/server/citytools.c
    trunk/server/citytools.h
    trunk/server/srv_main.c
    trunk/server/techtools.c

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=28168&r1=28167&r2=28168&view=diff
==============================================================================
--- trunk/server/citytools.c    (original)
+++ trunk/server/citytools.c    Mon Feb 16 09:22:13 2015
@@ -2914,6 +2914,17 @@
   ASSERT_VISION(pcity->server.vision);
 }
 
+/****************************************************************************
+  Refresh the vision of all cities owned by a player, for empire-wide
+  effects.
+****************************************************************************/
+void refresh_player_cities_vision(struct player *pplayer)
+{
+  city_list_iterate(pplayer->cities, pcity) {
+    city_refresh_vision(pcity);
+  } city_list_iterate_end;
+}
+
 /**************************************************************************
   Updates the squared city radius. Returns if the radius is changed.
 **************************************************************************/

Modified: trunk/server/citytools.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.h?rev=28168&r1=28167&r2=28168&view=diff
==============================================================================
--- trunk/server/citytools.h    (original)
+++ trunk/server/citytools.h    Mon Feb 16 09:22:13 2015
@@ -95,6 +95,7 @@
 
 void city_landlocked_sell_coastal_improvements(struct tile *ptile);
 void city_refresh_vision(struct city *pcity);
+void refresh_player_cities_vision(struct player *pplayer);
 
 void sync_cities(void);
 

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=28168&r1=28167&r2=28168&view=diff
==============================================================================
--- trunk/server/srv_main.c     (original)
+++ trunk/server/srv_main.c     Mon Feb 16 09:22:13 2015
@@ -1127,6 +1127,11 @@
     flush_packets();
   } phase_players_iterate_end;
 
+  /* Some player/global effect may have changed cities' vision range */
+  phase_players_iterate(pplayer) {
+    refresh_player_cities_vision(pplayer);
+  } phase_players_iterate_end;
+
   kill_dying_players();
 
   /* Unfreeze sending of cities. */

Modified: trunk/server/techtools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/techtools.c?rev=28168&r1=28167&r2=28168&view=diff
==============================================================================
--- trunk/server/techtools.c    (original)
+++ trunk/server/techtools.c    Mon Feb 16 09:22:13 2015
@@ -436,6 +436,7 @@
     city_list_iterate(aplayer->cities, pcity) {
       /* Refresh the city data; this also updates the squared city radius. */
       city_refresh(pcity);
+      city_refresh_vision(pcity);
       send_city_info(aplayer, pcity);
     } city_list_iterate_end;
 


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

Reply via email to