Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14170) Replace "Trade_revenue_reduce" tech flag with p
Home

[Freeciv-Dev] (PR#14170) Replace "Trade_revenue_reduce" tech flag with p

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14170) Replace "Trade_revenue_reduce" tech flag with proper effect
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 3 Oct 2005 09:21:50 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch replaces the "Trade_revenue_reduce" tech flag with proper effect.
--
mateusz
? civscore.log
? client/diff.diff
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.240
diff -u -r1.240 aicity.c
--- ai/aicity.c 30 Aug 2005 19:21:50 -0000      1.240
+++ ai/aicity.c 26 Sep 2005 11:34:58 -0000
@@ -653,6 +653,7 @@
         case EFT_INSPIRE_PARTISANS:
         case EFT_HAPPINESS_TO_GOLD:
         case EFT_FANATICS:
+       case EFT_TRADE_REVENUE_BONUS:
           break;
        case EFT_LAST:
          freelog(LOG_ERROR, "Bad effect type.");
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.364
diff -u -r1.364 city.c
--- common/city.c       18 Aug 2005 06:44:27 -0000      1.364
+++ common/city.c       26 Sep 2005 11:35:17 -0000
@@ -893,7 +893,7 @@
 int get_caravan_enter_city_trade_bonus(const struct city *pc1, 
                                        const struct city *pc2)
 {
-  int i, tb;
+  int tb, bonus;
 
   /* Should this be real_map_distance? */
   tb = map_distance(pc1->tile, pc2->tile) + 10;
@@ -902,12 +902,11 @@
   /*  fudge factor to more closely approximate Civ2 behavior (Civ2 is
    * really very different -- this just fakes it a little better) */
   tb *= 3;
-
-  /* Check for technologies that reduce trade revenues. */
-  for (i = 0; i < num_known_tech_with_flag(city_owner(pc1),
-                                          TF_TRADE_REVENUE_REDUCE); i++) {
-    tb = (tb * 2) / 3;
-  }
+  
+  /* Trade_revenue_bonus increases revenue by 18.9% (pow(1.189, 4) ~= 2.0) */
+  bonus = get_city_bonus(pc1, EFT_TRADE_REVENUE_BONUS);
+  
+  tb = (float)tb * pow(1.189, bonus);
 
   return tb;
 }
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.47
diff -u -r1.47 effects.c
--- common/effects.c    22 Aug 2005 21:15:48 -0000      1.47
+++ common/effects.c    26 Sep 2005 11:35:17 -0000
@@ -116,6 +116,7 @@
   "Inspire_Partisans",
   "Happiness_To_Gold",
   "Fanatics",
+  "Trade_Revenue_Bonus",
   "No_Diplomacy"
 };
 
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.28
diff -u -r1.28 effects.h
--- common/effects.h    22 Aug 2005 21:15:48 -0000      1.28
+++ common/effects.h    26 Sep 2005 11:35:17 -0000
@@ -105,6 +105,7 @@
   EFT_HAPPINESS_TO_GOLD,
   EFT_FANATICS, /* stupid special case, we hatess it */
   EFT_NO_DIPLOMACY,
+  EFT_TRADE_REVENUE_BONUS,
   EFT_LAST     /* keep this last */
 };
 
Index: common/tech.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v
retrieving revision 1.100
diff -u -r1.100 tech.c
--- common/tech.c       2 Sep 2005 23:12:40 -0000       1.100
+++ common/tech.c       26 Sep 2005 11:35:26 -0000
@@ -41,7 +41,7 @@
 
 static const char *flag_names[] = {
   "Bonus_Tech", "Bridge", "Railroad", "Fortress",
-  "Watchtower", "Population_Pollution_Inc", "Trade_Revenue_Reduce",
+  "Watchtower", "Population_Pollution_Inc", 
   "Airbase", "Farmland", "Reduce_Trireme_Loss1", "Reduce_Trireme_Loss2", 
   "Build_Airborne"
 };
Index: common/tech.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.h,v
retrieving revision 1.59
diff -u -r1.59 tech.h
--- common/tech.h       20 Jul 2005 07:19:20 -0000      1.59
+++ common/tech.h       26 Sep 2005 11:35:26 -0000
@@ -58,8 +58,6 @@
   TF_FORTRESS,  /* "Settler" unit types can build fortress */
   TF_WATCHTOWER, /* Units get enhanced visionrange in a fortress (=fortress 
acts also as a watchtower) */
   TF_POPULATION_POLLUTION_INC,  /* Increase the pollution factor created by 
popultaion by one */
-  TF_TRADE_REVENUE_REDUCE, /* When known by the player establishing a trade 
route 
-                              reduces the initial revenue by cumulative 
factors of 2/3 */
   TF_AIRBASE,   /* "Airbase" unit types can build Airbases */
   TF_FARMLAND,  /* "Settler" unit types can build farmland */
   TF_REDUCE_TRIREME_LOSS1, /* Reduces chance of Trireme being lost at sea */
Index: data/civ1/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/effects.ruleset,v
retrieving revision 1.7
diff -u -r1.7 effects.ruleset
--- data/civ1/effects.ruleset   10 May 2005 19:08:55 -0000      1.7
+++ data/civ1/effects.ruleset   26 Sep 2005 11:35:26 -0000
@@ -984,3 +984,19 @@
     { "type", "name", "range"
       "Building", "Women's Suffrage", "Player"
     }
+
+[effect_flight_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Flight", "Player"
+    }
+    
+[effect_railroad_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Railroad", "Player"
+    }    
Index: data/civ1/techs.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/techs.ruleset,v
retrieving revision 1.17
diff -u -r1.17 techs.ruleset
--- data/civ1/techs.ruleset     17 Dec 2004 00:14:15 -0000      1.17
+++ data/civ1/techs.ruleset     26 Sep 2005 11:35:26 -0000
@@ -216,7 +216,7 @@
 name     = _("Flight")
 req1     = "Combustion"
 req2     = "Physics"
-flags    = "Trade_Revenue_Reduce"
+flags    = ""
 
 [advance_fundamentalism]
 name     = _("Fundamentalism")
@@ -433,7 +433,7 @@
 name     = _("Railroad")
 req1     = "Steam Engine"
 req2     = "Bridge Building"
-flags    = "Railroad","Trade_Revenue_Reduce"
+flags    = "Railroad"
 
 [advance_recycling]
 name     = _("Recycling")
Index: data/civ2/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/effects.ruleset,v
retrieving revision 1.10
diff -u -r1.10 effects.ruleset
--- data/civ2/effects.ruleset   2 Aug 2005 06:39:49 -0000       1.10
+++ data/civ2/effects.ruleset   26 Sep 2005 11:35:26 -0000
@@ -1394,3 +1394,18 @@
       "Building", "Capitalization", "City"
     }
 
+[effect_flight_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Flight", "Player"
+    }
+    
+[effect_railroad_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Railroad", "Player"
+    }    
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.12
diff -u -r1.12 effects.ruleset
--- data/default/effects.ruleset        22 Aug 2005 21:15:49 -0000      1.12
+++ data/default/effects.ruleset        26 Sep 2005 11:35:26 -0000
@@ -1471,3 +1471,18 @@
       "Building", "Coinage", "City"
     }
 
+[effect_flight_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Flight", "Player"
+    }
+    
+[effect_railroad_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Railroad", "Player"
+    }    
Index: data/default/techs.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/techs.ruleset,v
retrieving revision 1.26
diff -u -r1.26 techs.ruleset
--- data/default/techs.ruleset  21 Apr 2005 22:53:13 -0000      1.26
+++ data/default/techs.ruleset  26 Sep 2005 11:35:26 -0000
@@ -48,9 +48,6 @@
 ; "Watchtower" = Units get enhanced visionrange in a fortress
 ; "Population_Pollution_Inc" = Increase the pollution factor created by
 ;                              popultaion by one
-; "Trade_Revenue_Reduce" = When known by the player establishing a trade
-;                          route reduces the initial revenue by cumulative
-;                          factors of 2/3
 ; "Airbase" = "Airbase" unit types can build Airbases
 ; "Build_Airborne" = from now on can build air units (for use by AI)
 
@@ -292,7 +289,7 @@
 name     = _("Flight")
 req1     = "Combustion"
 req2     = "Theory of Gravity"
-flags    = "Trade_Revenue_Reduce","Build_Airborne"
+flags    = "Build_Airborne"
 graphic     = "a.flight"
 graphic_alt = "-"
 
@@ -584,7 +581,7 @@
 name     = _("Railroad")
 req1     = "Steam Engine"
 req2     = "Bridge Building"
-flags    = "Railroad","Trade_Revenue_Reduce"
+flags    = "Railroad"
 graphic     = "a.railroad"
 graphic_alt = "-"
 
Index: data/history/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/effects.ruleset,v
retrieving revision 1.8
diff -u -r1.8 effects.ruleset
--- data/history/effects.ruleset        2 Aug 2005 06:39:49 -0000       1.8
+++ data/history/effects.ruleset        26 Sep 2005 11:35:26 -0000
@@ -1053,3 +1053,18 @@
       "Building", "Coinage", "City"
     }
 
+[effect_flight_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Flight", "Player"
+    }
+    
+[effect_railroad_trade_revenue_reduce]
+name    = "Trade_Revenue_Bonus"
+value   = -2
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Railroad", "Player"
+    }    
Index: data/history/techs.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/techs.ruleset,v
retrieving revision 1.6
diff -u -r1.6 techs.ruleset
--- data/history/techs.ruleset  21 Apr 2005 22:53:13 -0000      1.6
+++ data/history/techs.ruleset  26 Sep 2005 11:35:26 -0000
@@ -218,7 +218,7 @@
 name     = _("Flight")
 req1     = "Combustion"
 req2     = "Theory of Gravity"
-flags    = "Trade_Revenue_Reduce"
+flags    = ""
 
 [advance_fundamentalism]
 name     = _("Fundamentalism")
@@ -438,7 +438,7 @@
 name     = _("Railroad")
 req1     = "Metallurgy"
 req2     = "Bridge Building"
-flags    = "Railroad","Trade_Revenue_Reduce"
+flags    = "Railroad"
 
 [advance_recycling]
 name     = _("Recycling")
Index: doc/README.effects
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/README.effects,v
retrieving revision 1.14
diff -u -r1.14 README.effects
--- doc/README.effects  2 Aug 2005 06:39:49 -0000       1.14
+++ doc/README.effects  26 Sep 2005 11:35:27 -0000
@@ -168,6 +168,9 @@
                        AMOUNT <= 0 the timeline is unaffected.
                        The effect will be ignored if game.spacerace isn't
                        set.
+"Trade_Revenue_Bonus" - Trade revenue is multiplied by pow(1.189, amount).
+                        The amount value is taken from the caravan's home 
+                       city. pow(1.189, 4) == 2.0
 
 
 .range may be one of: 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14170) Replace "Trade_revenue_reduce" tech flag with proper effect, Mateusz Stefek <=