Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] Re: (PR#9169) Units happy inside borders
Home

[Freeciv-Dev] Re: (PR#9169) Units happy inside borders

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9169) Units happy inside borders
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 12 Jul 2004 14:02:25 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9169 >

On Sat, 3 Jul 2004, Per Inge Mathisen wrote:
> This patch makes units to not cause unhappiness when they are inside their
> own borders, when borders are used.

And makes it a server option (defaulting to on), as requested by db.

  - Per

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.387
diff -u -r1.387 packhand.c
--- client/packhand.c   12 Jul 2004 17:22:02 -0000      1.387
+++ client/packhand.c   12 Jul 2004 21:00:29 -0000
@@ -2157,6 +2157,7 @@
   game.num_tech_types = packet->num_tech_types;
 
   game.borders = packet->borders;
+  game.happyborders = packet->happyborders;
   game.slow_invasions = packet->slow_invasions;
 
   governments_alloc(packet->government_count);
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.172
diff -u -r1.172 capstr.c
--- common/capstr.c     12 Jul 2004 03:03:28 -0000      1.172
+++ common/capstr.c     12 Jul 2004 21:00:29 -0000
@@ -77,7 +77,7 @@
                    "+starter +union +iso_maps +big_map_size +orders2client " \
                    "+change_production +tilespec1 +no_earth +trans " \
                    "+want_hack invasions bombard +killstack2 spec +spec2 " \
-                   "+city_map startunits +turn_last_built"
+                   "+city_map startunits +turn_last_built +happyborders"
 
 /* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
  *
@@ -127,6 +127,9 @@
  * "startunits" means the initial units are stored as a server string var.
  *
  * "turn_last_built" means that turn_last_built is stored as a turn
+ * 
+ * "happyborders" means that units may not cause unhappiness inside
+ * our own borders.
  */
 
 void init_our_capability(void)
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.144
diff -u -r1.144 game.h
--- common/game.h       12 Jul 2004 17:22:02 -0000      1.144
+++ common/game.h       12 Jul 2004 21:00:29 -0000
@@ -162,6 +162,7 @@
   int allowed_city_names;
 
   int borders;         /* distance of border from city; 0=disabled. */
+  bool happyborders;
   int diplomacy;        /* who can do it */
   bool slow_invasions;  /* land units lose all movement landing on shores */
 
@@ -340,6 +341,8 @@
 #define GAME_MIN_BORDERS             0
 #define GAME_MAX_BORDERS             24
 
+#define GAME_DEFAULT_HAPPYBORDERS    TRUE
+
 #define GAME_DEFAULT_SLOW_INVASIONS  TRUE
 
 #define GAME_DEFAULT_DIPLOMACY       0
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.32
diff -u -r1.32 packets.def
--- common/packets.def  12 Jul 2004 17:22:02 -0000      1.32
+++ common/packets.def  12 Jul 2004 21:00:30 -0000
@@ -1238,6 +1238,7 @@
   UINT8 playable_nation_count;
   UINT8 style_count;
   UINT8 borders;
+  BOOL happyborders;
   BOOL slow_invasions; add-cap(slow_invasions)
 
   STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.211
diff -u -r1.211 unit.c
--- common/unit.c       25 Jun 2004 23:29:59 -0000      1.211
+++ common/unit.c       12 Jul 2004 21:00:31 -0000
@@ -1639,6 +1639,11 @@
     return FALSE;
   if (map_get_city(punit->x,punit->y))
     return FALSE;
+  if (game.borders > 0
+      && game.happyborders
+      && map_get_owner(punit->x, punit->y) == unit_owner(punit)) {
+    return FALSE;
+  }
   if (is_ground_unit(punit) &&
       map_has_special(punit->x, punit->y, S_FORTRESS))
     return !is_unit_near_a_friendly_city (punit);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.179
diff -u -r1.179 ruleset.c
--- server/ruleset.c    12 Jul 2004 20:17:07 -0000      1.179
+++ server/ruleset.c    12 Jul 2004 21:00:35 -0000
@@ -1956,6 +1956,7 @@
   packet.num_impr_types = game.num_impr_types;
   packet.num_tech_types = game.num_tech_types;
   packet.borders = game.borders;
+  packet.happyborders = game.happyborders;
   packet.slow_invasions = game.slow_invasions;
 
   packet.nation_count = game.nation_count;
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.326
diff -u -r1.326 stdinhand.c
--- server/stdinhand.c  12 Jul 2004 15:51:11 -0000      1.326
+++ server/stdinhand.c  12 Jul 2004 21:00:38 -0000
@@ -648,6 +648,13 @@
             "the maximum distance from any city specified."), NULL,
             GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS)
 
+  GEN_BOOL("happyborders", game.happyborders, SSET_RULES, SSET_MILITARY, 
+          SSET_TO_CLIENT,
+         N_("Do units cause unhappiness inside our own borders?"),
+         N_("If this is set, units will not cause unhappiness when "
+            "inside your own borders."), NULL,
+            GAME_DEFAULT_HAPPYBORDERS)
+
   GEN_INT("diplomacy", game.diplomacy, SSET_RULES, SSET_MILITARY,
           SSET_TO_CLIENT,
          N_("The ability to do diplomacy with other players"),

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