Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#12581) out-of-tree tech achievement
Home

[Freeciv-Dev] (PR#12581) out-of-tree tech achievement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#12581) out-of-tree tech achievement
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Jun 2005 23:54:51 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [chrisk - Mon Mar 21 23:31:10 2005]:
> 
> 
> CVS 22 MAR 2005 S2 GTK2
> 
> IIRC we did a rule change that techs achieved by diplomacy must be
> next-to-researched techs.
> 
> When I conquer a city, it happens to be not the case. I get a tech of much
> greater value (physics) skipping navigation and astronomy.

This patch makes part of that change.

A strict_reqs ruleset variable is added.  If set then tech reqs are
supposed to be strict.  It's not rigorous; only diplomacy is controlled.

It's also not particularly workable in the current form.  In a diplomacy
meeting it only allows techs that are reachable to be traded.  However
since this doesn't recursively account for other techs in the treaty it
will make trading techs very tedious.  One alternative is to allow
trading of any tech but to put any reqs onto the treaty automatically.

-jason

Index: client/gui-gtk-2.0/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/diplodlg.c,v
retrieving revision 1.30
diff -u -r1.30 diplodlg.c
--- client/gui-gtk-2.0/diplodlg.c       5 May 2005 18:32:47 -0000       1.30
+++ client/gui-gtk-2.0/diplodlg.c       8 Jun 2005 06:52:14 -0000
@@ -236,7 +236,8 @@
 
     for (i = 1, flag = FALSE; i < game.control.num_tech_types; i++) {
       if (get_invention(plr0, i) == TECH_KNOWN
-         && (get_invention(plr1, i) == TECH_UNKNOWN
+         && ((!game.info.strict_reqs
+              && get_invention(plr1, i) == TECH_UNKNOWN)
              || get_invention(plr1, i) == TECH_REACHABLE)
           && tech_is_available(plr1, i)) {
        item
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.132
diff -u -r1.132 packets.def
--- common/packets.def  7 Jun 2005 06:20:05 -0000       1.132
+++ common/packets.def  8 Jun 2005 06:52:14 -0000
@@ -420,6 +420,7 @@
   UINT8 tech_cost_style;
   UINT8 tech_leakage;
   YEAR tech_cost_double_year;
+  BOOL strict_reqs;
   BOOL killstack;
   UINT8 autoupgrade_veteran_loss;
   UINT16 incite_improvement_factor;
Index: data/civ1/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/game.ruleset,v
retrieving revision 1.18
diff -u -r1.18 game.ruleset
--- data/civ1/game.ruleset      29 Jan 2005 17:58:18 -0000      1.18
+++ data/civ1/game.ruleset      8 Jun 2005 06:52:14 -0000
@@ -78,6 +78,8 @@
 ; Research cost doubles after this year. Set to zero to disable.
 tech_cost_double_year = 1
 
+strict_reqs = 0
+
 ; city_incite_cost = 
 ; total_factor * (city_size) *
 ; (base + (units_cost) * unit_factor + 
Index: data/civ2/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/game.ruleset,v
retrieving revision 1.18
diff -u -r1.18 game.ruleset
--- data/civ2/game.ruleset      29 Jan 2005 17:58:18 -0000      1.18
+++ data/civ2/game.ruleset      8 Jun 2005 06:52:14 -0000
@@ -78,6 +78,8 @@
 ; Research cost doubles after this year. Set to zero to disable.
 tech_cost_double_year = 1
 
+strict_reqs = 0
+
 ; city_incite_cost = 
 ; total_factor * (city_size) *
 ; (base + (units_cost) * unit_factor + 
Index: data/default/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/game.ruleset,v
retrieving revision 1.21
diff -u -r1.21 game.ruleset
--- data/default/game.ruleset   29 Jan 2005 17:58:19 -0000      1.21
+++ data/default/game.ruleset   8 Jun 2005 06:52:14 -0000
@@ -78,6 +78,10 @@
 ; Research cost doubles after this year. Set to zero to disable.
 tech_cost_double_year = 0
 
+; Whether out-of-tree targets (techs) are allowed as gifts.  If set then
+; players must already have the prereqs to trade for a tech.
+strict_reqs = 1
+
 ; city_incite_cost = 
 ; total_factor * (city_size) *
 ; (base + (units_cost) * unit_factor + 
Index: data/history/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/game.ruleset,v
retrieving revision 1.10
diff -u -r1.10 game.ruleset
--- data/history/game.ruleset   29 Jan 2005 17:58:19 -0000      1.10
+++ data/history/game.ruleset   8 Jun 2005 06:52:15 -0000
@@ -78,6 +78,8 @@
 ; Research cost doubles after this year. Set to zero to disable.
 tech_cost_double_year = 0
 
+strict_reqs = 1
+
 ; city_incite_cost = 
 ; total_factor * (city_size) *
 ; (base + (units_cost) * unit_factor + 
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.94
diff -u -r1.94 diplhand.c
--- server/diplhand.c   11 May 2005 14:57:10 -0000      1.94
+++ server/diplhand.c   8 Jun 2005 06:52:15 -0000
@@ -157,6 +157,14 @@
                          get_tech_name(pplayer, pclause->value));
            return;
          }
+         if (game.info.strict_reqs
+             && get_invention(pother, pclause->value) != TECH_REACHABLE) {
+           notify_player(pplayer,
+                         _("You can't give away %s; they don't have the "
+                           "prerequisites."),
+                         get_tech_name(pplayer, pclause->value));
+           return;
+         }
          break;
        case CLAUSE_CITY:
          pcity = find_city_by_id(pclause->value);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.266
diff -u -r1.266 ruleset.c
--- server/ruleset.c    22 May 2005 17:45:24 -0000      1.266
+++ server/ruleset.c    8 Jun 2005 06:52:16 -0000
@@ -2504,6 +2504,8 @@
   }
   game.info.tech_cost_double_year = 
       secfile_lookup_int_default(&file, 1, "civstyle.tech_cost_double_year");
+  game.info.strict_reqs
+    = secfile_lookup_bool(&file, "civstyle.strict_reqs");
 
   game.info.autoupgrade_veteran_loss
     = secfile_lookup_int(&file, "civstyle.autoupgrade_veteran_loss");

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