Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12686) new effect slow_down_timeline
Home

[Freeciv-Dev] (PR#12686) new effect slow_down_timeline

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12686) new effect slow_down_timeline
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sat, 9 Apr 2005 17:49:28 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Tue Mar 29 02:01:50 2005]:
> 
> This patch implements a new effect EFT_SLOW_DOWN_TIMELINE.  This 
> replaces the *crazy* check we have now that checks the tech requirements 
> of building requirements of space-part effects.  The actual code for 
> this (in game.c) becomes rather simple.
 
This makes the code better than it is now. So it should go in. Simple as
that. If something better shows up, then we can add that. If we always
waited for the perfect solution for everything, nothing would ever get
in CVS. Attached is a patch that will apply to current CVS.

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.208
diff -u -u -r1.208 aicity.c
--- ai/aicity.c 3 Apr 2005 20:19:51 -0000       1.208
+++ ai/aicity.c 10 Apr 2005 00:44:49 -0000
@@ -326,6 +326,10 @@
        case EFT_WASTE_PCT:
          break;
 
+      case EFT_SLOW_DOWN_TIMELINE:
+       /* AI doesn't care about these. */
+       break;
+
        /* WAG evaluated effects */
        case EFT_INCITE_DIST_PCT:
          if (palace) {
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.26
diff -u -u -r1.26 effects.c
--- common/effects.c    3 Apr 2005 20:19:52 -0000       1.26
+++ common/effects.c    10 Apr 2005 00:44:49 -0000
@@ -117,7 +117,8 @@
   "Missile_Defend",
   "No_Incite",
   "Regen_Reputation",
-  "Gain_AI_Love"
+  "Gain_AI_Love",
+  "Slow_Down_Timeline"
 };
 
 /**************************************************************************
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.16
diff -u -u -r1.16 effects.h
--- common/effects.h    3 Apr 2005 20:19:52 -0000       1.16
+++ common/effects.h    10 Apr 2005 00:44:49 -0000
@@ -105,6 +105,7 @@
   EFT_NO_INCITE,
   EFT_REGEN_REPUTATION,
   EFT_GAIN_AI_LOVE,
+  EFT_SLOW_DOWN_TIMELINE,
   EFT_LAST     /* keep this last */
 };
 
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.202
diff -u -u -r1.202 game.c
--- common/game.c       25 Mar 2005 13:08:29 -0000      1.202
+++ common/game.c       10 Apr 2005 00:44:50 -0000
@@ -374,7 +374,8 @@
 ***************************************************************/
 int game_next_year(int year)
 {
-  int spaceshipparts, space_parts[3] = {0, 0, 0};
+  const int slowdown = (game.spacerace
+                       ? get_world_bonus(EFT_SLOW_DOWN_TIMELINE) : 0);
 
   if (year == 1) /* hacked it to get rid of year 0 */
     year = 0;
@@ -392,38 +393,15 @@
    * about 1900 AD
    */
 
-  /* Count how many of the different spaceship parts we can build.  Note this
-   * operates even if Enable_Space is not active. */
-  if (game.spacerace) {
-    impr_type_iterate(impr) {
-      Tech_Type_id t = improvement_types[impr].tech_req;
-
-      if (!improvement_exists(impr)) {
-       continue;
-      }
-      if (building_has_effect(impr, EFT_SS_STRUCTURAL)
-         && tech_exists(t) && game.global_advances[t] != 0) {
-       space_parts[0] = 1;
-      }
-      if (building_has_effect(impr, EFT_SS_COMPONENT)
-         && tech_exists(t) && game.global_advances[t] != 0) {
-       space_parts[1] = 1;
-      }
-      if (building_has_effect(impr, EFT_SS_MODULE)
-         && tech_exists(t) && game.global_advances[t] != 0) {
-       space_parts[2] = 1;
-      }
-    } impr_type_iterate_end;
-  }
-  spaceshipparts = space_parts[0] + space_parts[1] + space_parts[2];
-
-  if( year >= 1900 || ( spaceshipparts>=3 && year>0 ) )
+  /* Note the slowdown operates even if Enable_Space is not active.  See
+   * README.effects for specifics. */
+  if (year >= 1900 || (slowdown >= 3 && year > 0)) {
     year += 1;
-  else if( year >= 1750 || spaceshipparts>=2 )
+  } else if (year >= 1750 || slowdown >= 2) {
     year += 2;
-  else if( year >= 1500 || spaceshipparts>=1 )
+  } else if (year >= 1500 || slowdown >= 1) {
     year += 5;
-  else if( year >= 1000 )
+  } else if( year >= 1000 )
     year += 10;
   else if( year >= 0 )
     year += 20;
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.4
diff -u -u -r1.4 effects.ruleset
--- data/default/effects.ruleset        24 Mar 2005 16:41:42 -0000      1.4
+++ data/default/effects.ruleset        10 Apr 2005 00:44:50 -0000
@@ -625,6 +625,30 @@
       "Building", "Space Structural", "City"
     }
 
+[effect_plastics_slowdown]
+name    = "Slow_Down_Timeline"
+value   = 1
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Plastics", "World"
+    }
+
+[effect_superconductor_slowdown]
+name    = "Slow_Down_Timeline"
+value   = 1
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Superconductors", "World"
+    }
+
+[effect_spaceflight_slowdown]
+name    = "Slow_Down_Timeline"
+value   = 1
+reqs    =
+    { "type", "name", "range"
+      "Tech", "Space Flight", "World"
+    }
+
 [effect_stock_exchange]
 name   = "Tax_Bonus"
 value  = 50
Index: doc/README.effects
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/README.effects,v
retrieving revision 1.6
diff -u -u -r1.6 README.effects
--- doc/README.effects  23 Mar 2005 02:07:45 -0000      1.6
+++ doc/README.effects  10 Apr 2005 00:44:52 -0000
@@ -153,6 +153,14 @@
 "Regen_Reputation" - Increase your reputation by AMOUNT units (out of 1000)
                   per turn
 
+"Slow_Down_Timeline" - Slow down the timeline based on the AMOUNT.  If
+                       AMOUNT >= 3 the timeline will be 1 year/turn; with
+                       AMOUNT == 2 it is 2 years/turn; with
+                       AMOUNT == 1 it is 5 years/turn; with
+                       AMOUNT <= 0 the timeline is unaffected.
+                       The effect will be ignored if game.spacerace isn't
+                       set.
+
 
 .range may be one of: 
              "None", "Local", "Adjacent", "City", "Continent",

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12686) new effect slow_down_timeline, Vasco Alexandre da Silva Costa <=