Author: sveinung
Date: Thu Apr 30 16:50:54 2015
New Revision: 28963

URL: http://svn.gna.org/viewcvs/freeciv?rev=28963&view=rev
Log:
Drop the recently introduced effect Trade_Revenue_Pct.

Use Trade_Revenue_Bonus in stead.

See patch #6051

Modified:
    trunk/ai/default/advdomestic.c
    trunk/ai/default/daieffects.c
    trunk/common/effects.h
    trunk/common/traderoutes.c
    trunk/data/alien/effects.ruleset
    trunk/data/civ1/effects.ruleset
    trunk/data/civ2/effects.ruleset
    trunk/data/civ2civ3/effects.ruleset
    trunk/data/classic/effects.ruleset
    trunk/data/experimental/effects.ruleset
    trunk/doc/README.effects
    trunk/fc_version
    trunk/server/rscompat.c

Modified: trunk/ai/default/advdomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advdomestic.c?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/ai/default/advdomestic.c      (original)
+++ trunk/ai/default/advdomestic.c      Thu Apr 30 16:50:54 2015
@@ -16,7 +16,7 @@
 #endif
 
 #include <string.h>
-#include <math.h> /* pow */
+#include <math.h> /* pow, ceil */
 
 /* utility */
 #include "log.h"
@@ -187,7 +187,7 @@
   int pct = 0;
   int trader_trait;
   bool need_boat = FALSE;
-  bool trade_action;
+  int trade_action;
 
   if (city_list_size(pplayer->cities) < 5) {
     /* Consider trade routes only if enough destination cities.
@@ -323,22 +323,23 @@
   /* We assume that we are creating trade route to city with 75% of
    * pcitys trade 10 squares away. */
   income = (10 + 10) * (1.75 * pcity->surplus[O_TRADE]) / 24 * 3;
-  bonus = get_city_bonus(pcity, EFT_TRADE_REVENUE_BONUS);
-  income = (float)income * pow(2.0, (double)bonus / 1000.0);
-
-  /* A ruleset may use the Trade_Revenue_Pct effect to reduce the one time
-   * bonus if no trade route is established. Make sure it gets the correct
-   * action. */
+
+  /* A ruleset may use the Trade_Revenue_Bonus effect to reduce the one
+   * time bonus if no trade route is established. Make sure it gets the
+   * correct action. */
   trade_action = utype_can_do_action(unit_type, ACTION_TRADE_ROUTE) ?
         ACTION_TRADE_ROUTE : ACTION_MARKETPLACE;
-  income += get_target_bonus_effects(NULL,
-                                     pplayer, NULL,
-                                     pcity, NULL,
-                                     city_tile(pcity),
-                                     NULL, NULL,
-                                     NULL, NULL,
-                                     action_by_number(trade_action),
-                                     EFT_TRADE_REVENUE_PCT) * income / 100;
+  bonus = get_target_bonus_effects(NULL,
+                                   pplayer, NULL,
+                                   pcity, NULL,
+                                   city_tile(pcity),
+                                   NULL, NULL,
+                                   NULL, NULL,
+                                   action_by_number(trade_action),
+                                   EFT_TRADE_REVENUE_BONUS);
+
+  /* Be mercy full to players with small amounts. Round up. */
+  income = ceil((float)income * pow(2.0, (double)bonus / 1000.0));
 
   if (dest_city_nat_same_cont) {
     pct = trade_route_type_trade_pct(TRT_NATIONAL);

Modified: trunk/ai/default/daieffects.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daieffects.c?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/ai/default/daieffects.c       (original)
+++ trunk/ai/default/daieffects.c       Thu Apr 30 16:50:54 2015
@@ -547,10 +547,6 @@
       v += amount; /* AI wants migration into its cities! */
     } iterate_outward_end;
     break;
-  case EFT_TRADE_REVENUE_PCT:
-    trait = ai_trait_get_value(TRAIT_TRADER, pplayer);
-    v += trait * amount * c / (20 * TRAIT_DEFAULT_VALUE);
-    break;
   case EFT_MAX_TRADE_ROUTES:
     trait = ai_trait_get_value(TRAIT_TRADER, pplayer);
     v += amount

Modified: trunk/common/effects.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/effects.h?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/common/effects.h      (original)
+++ trunk/common/effects.h      Thu Apr 30 16:50:54 2015
@@ -275,8 +275,6 @@
 #define SPECENUM_VALUE106NAME "Illegal_Action_Move_Cost"
 #define SPECENUM_VALUE107 EFT_HAVE_CONTACTS
 #define SPECENUM_VALUE107NAME "Have_Contacts"
-#define SPECENUM_VALUE108 EFT_TRADE_REVENUE_PCT
-#define SPECENUM_VALUE108NAME "Trade_Revenue_Pct"
 /* keep this last */
 #define SPECENUM_COUNT EFT_COUNT
 #include "specenum_gen.h"

Modified: trunk/common/traderoutes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/traderoutes.c?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/common/traderoutes.c  (original)
+++ trunk/common/traderoutes.c  Thu Apr 30 16:50:54 2015
@@ -386,28 +386,24 @@
   tb *= 3;
   
   /* Trade_revenue_bonus increases revenue by power of 2 in milimes */
-  bonus = get_city_bonus(pc1, EFT_TRADE_REVENUE_BONUS);
-  
-  tb = (float)tb * pow(2.0, (double)bonus / 1000.0);
-
-  /* Trade_Revenue_Pct allows the ruleset to modify the final bonus.
-   * Example: reduce the one time bonus when no trade route is
-   * established. */
-  tb += get_target_bonus_effects(NULL,
-                                 city_owner(pc1),
-                                 city_owner(pc2),
-                                 pc1,
-                                 NULL,
-                                 city_tile(pc1),
-                                 /* TODO: Should unit requirements be
-                                  * allowed so stuff like moves left and
-                                  * unit type can modify the bonus? */
-                                 NULL, NULL,
-                                 NULL, NULL,
-                                 action_by_number(establish_trade ?
-                                   ACTION_TRADE_ROUTE :
-                                   ACTION_MARKETPLACE),
-                                 EFT_TRADE_REVENUE_PCT) * tb / 100;
+  bonus = get_target_bonus_effects(NULL,
+                                   city_owner(pc1), city_owner(pc2),
+                                   pc1, NULL, city_tile(pc1),
+                                   /* TODO: Should unit requirements be
+                                    * allowed so stuff like moves left and
+                                    * unit type can modify the bonus? */
+                                   NULL, NULL,
+                                   NULL, NULL,
+                                   /* Could be used to reduce the one time
+                                    * bonus if no trade route is
+                                    * established. */
+                                   action_by_number(establish_trade ?
+                                                      ACTION_TRADE_ROUTE :
+                                                      ACTION_MARKETPLACE),
+                                   EFT_TRADE_REVENUE_BONUS);
+
+  /* Be mercy full to players with small amounts. Round up. */
+  tb = ceil((float)tb * pow(2.0, (double)bonus / 1000.0));
 
   return tb;
 }

Modified: trunk/data/alien/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/alien/effects.ruleset    (original)
+++ trunk/data/alien/effects.ruleset    Thu Apr 30 16:50:54 2015
@@ -985,6 +985,14 @@
       "Tech", "Thermal Module", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 [effect_trade_routes]
 type    = "Max_Trade_Routes"
 value   = 4
@@ -1013,11 +1021,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/data/civ1/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/civ1/effects.ruleset     (original)
+++ trunk/data/civ1/effects.ruleset     Thu Apr 30 16:50:54 2015
@@ -1226,6 +1226,14 @@
       "Tech", "Railroad", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 ; FIXME: Calendar effects are copied from default rulesets and are
 ; probably wrong for civ1 ruleset.
 [effect_calendar_base]
@@ -1435,11 +1443,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/data/civ2/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/civ2/effects.ruleset     (original)
+++ trunk/data/civ2/effects.ruleset     Thu Apr 30 16:50:54 2015
@@ -2099,6 +2099,14 @@
       "Tech", "Railroad", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 [effect_tithes_fundamentalism]
 type    = "Happiness_To_Gold" 
 value   = 1 
@@ -2289,11 +2297,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/data/civ2civ3/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/civ2civ3/effects.ruleset (original)
+++ trunk/data/civ2civ3/effects.ruleset Thu Apr 30 16:50:54 2015
@@ -3462,6 +3462,14 @@
       "Tech", "Railroad", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 [effect_calendar_base]
 type    = "Turn_Years"
 value   = 50
@@ -3739,11 +3747,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/data/classic/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/classic/effects.ruleset  (original)
+++ trunk/data/classic/effects.ruleset  Thu Apr 30 16:50:54 2015
@@ -2164,6 +2164,14 @@
       "Tech", "Railroad", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 [effect_calendar_base]
 type    = "Turn_Years"
 value   = 50
@@ -2381,11 +2389,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/data/experimental/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/effects.ruleset?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/data/experimental/effects.ruleset     (original)
+++ trunk/data/experimental/effects.ruleset     Thu Apr 30 16:50:54 2015
@@ -2362,6 +2362,14 @@
       "Tech", "Railroad", "Player"
     }
 
+[effect_enter_marketplace_bonus_reduction]
+type   = "Trade_Revenue_Bonus"
+value  = -1585
+reqs   =
+    { "type", "name", "range"
+      "Action", "Enter Marketplace", "Local"
+    }
+
 [effect_upkeep_shield2gold]
 type    = "Shield2Gold_Factor"
 value   = 100
@@ -2703,11 +2711,3 @@
       "Action", "Found City", "Local", FALSE
       "Action", "Join City", "Local", FALSE
     }
-
-[effect_enter_marketplace_bonus_reduction]
-type   = "Trade_Revenue_Pct"
-value  = -67
-reqs   =
-    { "type", "name", "range"
-      "Action", "Enter Marketplace", "Local"
-    }

Modified: trunk/doc/README.effects
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.effects?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/doc/README.effects    (original)
+++ trunk/doc/README.effects    Thu Apr 30 16:50:54 2015
@@ -388,11 +388,6 @@
     One time trade revenue bonus is multiplied by pow(2, amount/1000).
     The amount value is taken from the caravan's home city.
 
-Trade_Revenue_Pct
-    Percentage bonus for the one time trade revenue. Supports action
-    requirements. The point of view is the caravan's home city.
-    Doesn't support unit related requirements.
-
 Traderoute_Pct
     Percentage bonus for trade from traderoutes. This bonus applies after
     the value of the traderoute is already calculated. It affects one end

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Thu Apr 30 16:50:54 2015
@@ -54,7 +54,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Apr.26b"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Apr.30"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=28963&r1=28962&r2=28963&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Thu Apr 30 16:50:54 2015
@@ -287,7 +287,7 @@
   if (info->ver_effects < 10) {
     /* The reduced one time trade bonus of Enter Marketplace (compared to
      * Establish Trade Route) has moved to the ruleset. */
-    struct effect *peffect = effect_new(EFT_TRADE_REVENUE_PCT, -67);
+    struct effect *peffect = effect_new(EFT_TRADE_REVENUE_BONUS, -1585);
 
     /* The reduction only applies to Enter Marketplace. */
     effect_req_append(peffect, req_from_str("Action", "Local", FALSE, TRUE,


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

Reply via email to