Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13303) Unit crossing border confuses client with happy
Home

[Freeciv-Dev] (PR#13303) Unit crossing border confuses client with happy

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13303) Unit crossing border confuses client with happyborder = 1
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sat, 25 Jun 2005 11:15:54 -0700
Reply-to: bugs@xxxxxxxxxxx

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

S2_0 version
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.306.2.14
diff -u -r1.306.2.14 unittools.c
--- server/unittools.c  6 Jun 2005 19:03:29 -0000       1.306.2.14
+++ server/unittools.c  25 Jun 2005 18:14:40 -0000
@@ -2542,7 +2542,7 @@
   struct city *homecity = NULL;
   struct player *pplayer = unit_owner(punit);
   /*  struct government *g = get_gov_pplayer(pplayer);*/
-  bool senthome = FALSE;
+  bool refresh_homecity = FALSE;
 
   if (punit->homecity != 0)
     homecity = find_city_by_id(punit->homecity);
@@ -2566,37 +2566,34 @@
       }
 
       if (homecity) {
-       city_refresh(homecity);
-       send_city_info(pplayer, homecity);
+        refresh_homecity = TRUE;
       }
-      senthome = TRUE;
     }
 
     if (fromcity) { /* leaving a city */
-      if (!senthome && homecity) {
-       city_refresh(homecity);
-       send_city_info(pplayer, homecity);
+      if (homecity) {
+       refresh_homecity = TRUE;
       }
       if (fromcity != homecity && fromcity->owner == punit->owner) {
        city_refresh(fromcity);
        send_city_info(pplayer, fromcity);
       }
-      senthome = TRUE;
     }
 
-    /* entering/leaving a fortress */
-    if (map_has_special(dst_tile, S_FORTRESS)
-       && homecity
-       && is_friendly_city_near(unit_owner(punit), dst_tile)
-       && !senthome) {
-      city_refresh(homecity);
-      send_city_info(pplayer, homecity);
+    /* entering/leaving a fortress or friendly territory */
+    if (homecity) {
+      if ((game.happyborders > 0 && src_tile->owner != dst_tile->owner)
+          ||
+         (map_has_special(dst_tile, S_FORTRESS)
+          && is_friendly_city_near(unit_owner(punit), dst_tile))
+         ||
+          (map_has_special(src_tile, S_FORTRESS) 
+          && is_friendly_city_near(unit_owner(punit), src_tile))) {
+        refresh_homecity = TRUE;
+      }
     }
-
-    if (map_has_special(src_tile, S_FORTRESS)
-       && homecity
-       && is_friendly_city_near(unit_owner(punit), src_tile)
-       && !senthome) {
+    
+    if (refresh_homecity) {
       city_refresh(homecity);
       send_city_info(pplayer, homecity);
     }

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