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

2008/4/16 Marko Lindqvist <cazf...@gmail.com>:
>  I don't like the way "Slow_Down_Timeline"  maps between effect values
> and hardcoded turn lengths (in years). Would it be much harder to do
> more generic "Turn_Length" -effect? Value of this effect would tell
> current year increment/turn.

 Attached patch adds new effect "Turn_Years". Old "Slow_Down_Timeline"
effect is left as it is.

 Does anybody know correct calendar effects for civ1/2? For now I made
all the rulesets to use same calendar as hardcoded version used to be,
with FIXME comment.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c 2008-10-27 04:13:32.000000000 +0200
+++ freeciv/ai/aicity.c 2009-05-08 01:00:00.000000000 +0300
@@ -427,6 +427,7 @@
     v += c * amount;
     break;
 
+  case EFT_TURN_YEARS:
   case EFT_SLOW_DOWN_TIMELINE:
     /* AI doesn't care about these. */
     break;
diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c
--- freeciv/common/effects.c    2009-05-06 11:50:59.000000000 +0300
+++ freeciv/common/effects.c    2009-05-08 00:59:01.000000000 +0300
@@ -92,6 +92,7 @@
   "Defend_Bonus",
   "No_Incite",
   "Gain_AI_Love",
+  "Turn_Years",
   "Slow_Down_Timeline",
   "Civil_War_Chance",
   "Empire_Size_Base",
diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h
--- freeciv/common/effects.h    2009-05-07 23:43:31.000000000 +0300
+++ freeciv/common/effects.h    2009-05-08 00:58:37.000000000 +0300
@@ -79,6 +79,7 @@
   EFT_DEFEND_BONUS,
   EFT_NO_INCITE,
   EFT_GAIN_AI_LOVE,
+  EFT_TURN_YEARS,
   EFT_SLOW_DOWN_TIMELINE, /* Space module tech slowdown */
   EFT_CIVIL_WAR_CHANCE,
   EFT_EMPIRE_SIZE_BASE, /* +1 unhappy when more than this cities */
diff -Nurd -X.diff_ignore freeciv/common/game.c freeciv/common/game.c
--- freeciv/common/game.c       2009-05-03 18:59:38.000000000 +0300
+++ freeciv/common/game.c       2009-05-08 01:17:41.000000000 +0300
@@ -482,11 +482,13 @@
 ***************************************************************/
 int game_next_year(int year)
 {
+  int increase = get_world_bonus(EFT_TURN_YEARS);
   const int slowdown = (game.info.spacerace
                        ? get_world_bonus(EFT_SLOW_DOWN_TIMELINE) : 0);
 
-  if (year == 1) /* hacked it to get rid of year 0 */
+  if (year == 1) { /* hacked it to get rid of year 0 */
     year = 0;
+  }
 
     /* !McFred: 
        - want year += 1 for spaceship.
@@ -503,23 +505,25 @@
 
   /* 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 || slowdown >= 2) {
-    year += 2;
-  } else if (year >= 1500 || slowdown >= 1) {
-    year += 5;
-  } else if( year >= 1000 )
-    year += 10;
-  else if( year >= 0 )
-    year += 20;
-  else if( year >= -1000 ) /* used this line for tuning (was -1250) */
-    year += 25;
-  else
-    year += 50; 
+  if (slowdown >= 3) {
+    if (increase > 1) {
+      increase = 1;
+    }
+  } else if (slowdown >= 2) {
+    if (increase > 2) {
+      increase = 2;
+    }
+  } else if (slowdown >= 1) {
+    if (increase > 5) {
+      increase = 5;
+    }
+  }
 
-  if (year == 0) 
+  year += increase;
+
+  if (year == 0) {
     year = 1;
+  }
 
   return year;
 }
diff -Nurd -X.diff_ignore freeciv/data/civ1/effects.ruleset 
freeciv/data/civ1/effects.ruleset
--- freeciv/data/civ1/effects.ruleset   2008-10-27 04:13:56.000000000 +0200
+++ freeciv/data/civ1/effects.ruleset   2009-05-08 01:19:12.000000000 +0300
@@ -1206,4 +1206,64 @@
 reqs    =
     { "type", "name", "range"
       "Tech", "Railroad", "Player"
-    }    
+    }
+
+; FIXME: Calendar effects are copied from default rulesets and are
+; probably wrong for civ1 ruleset.
+[effect_calendar_base]
+name    = "Turn_Years"
+value   = 50
+
+; 50 - 25 = 25
+[effect_calendar_1]
+name    = "Turn_Years"
+value   = -25
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "-1000", "World"
+    }
+
+; 25 - 5 = 20
+[effect_calendar_2]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "0", "World"
+    }
+
+; 20 - 10 = 10
+[effect_calendar_3]
+name    = "Turn_Years"
+value   = -10
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1000", "World"
+    }
+
+; 10 - 5 = 5
+[effect_calendar_4]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1500", "World"
+    }
+
+; 5 - 3 = 2
+[effect_calendar_5]
+name    = "Turn_Years"
+value   = -3
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1750", "World"
+    }
+
+; 2 - 1 = 1
+[effect_calendar_6]
+name    = "Turn_Years"
+value   = -1
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1900", "World"
+    }
diff -Nurd -X.diff_ignore freeciv/data/civ2/effects.ruleset 
freeciv/data/civ2/effects.ruleset
--- freeciv/data/civ2/effects.ruleset   2008-10-27 04:13:56.000000000 +0200
+++ freeciv/data/civ2/effects.ruleset   2009-05-08 01:18:39.000000000 +0300
@@ -1993,3 +1993,63 @@
     { "type", "name", "range" 
       "Gov", "Fundamentalism", "Player" 
     }
+
+; FIXME: Calendar effects are copied from default rulesets and are
+; probably wrong for civ2 ruleset.
+[effect_calendar_base]
+name    = "Turn_Years"
+value   = 50
+
+; 50 - 25 = 25
+[effect_calendar_1]
+name    = "Turn_Years"
+value   = -25
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "-1000", "World"
+    }
+
+; 25 - 5 = 20
+[effect_calendar_2]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "0", "World"
+    }
+
+; 20 - 10 = 10
+[effect_calendar_3]
+name    = "Turn_Years"
+value   = -10
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1000", "World"
+    }
+
+; 10 - 5 = 5
+[effect_calendar_4]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1500", "World"
+    }
+
+; 5 - 3 = 2
+[effect_calendar_5]
+name    = "Turn_Years"
+value   = -3
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1750", "World"
+    }
+
+; 2 - 1 = 1
+[effect_calendar_6]
+name    = "Turn_Years"
+value   = -1
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1900", "World"
+    }
diff -Nurd -X.diff_ignore freeciv/data/default/effects.ruleset 
freeciv/data/default/effects.ruleset
--- freeciv/data/default/effects.ruleset        2008-10-27 04:13:56.000000000 
+0200
+++ freeciv/data/default/effects.ruleset        2009-05-08 01:10:43.000000000 
+0300
@@ -1988,4 +1988,62 @@
 reqs    =
     { "type", "name", "range"
       "Tech", "Railroad", "Player"
-    }    
+    }
+
+[effect_calendar_base]
+name    = "Turn_Years"
+value   = 50
+
+; 50 - 25 = 25
+[effect_calendar_1]
+name    = "Turn_Years"
+value   = -25
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "-1000", "World"
+    }
+
+; 25 - 5 = 20
+[effect_calendar_2]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "0", "World"
+    }
+
+; 20 - 10 = 10
+[effect_calendar_3]
+name    = "Turn_Years"
+value   = -10
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1000", "World"
+    }
+
+; 10 - 5 = 5
+[effect_calendar_4]
+name    = "Turn_Years"
+value   = -5
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1500", "World"
+    }
+
+; 5 - 3 = 2
+[effect_calendar_5]
+name    = "Turn_Years"
+value   = -3
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1750", "World"
+    }
+
+; 2 - 1 = 1
+[effect_calendar_6]
+name    = "Turn_Years"
+value   = -1
+reqs    =
+    { "type", "name", "range"
+      "MinYear", "1900", "World"
+    }
diff -Nurd -X.diff_ignore freeciv/doc/README.effects freeciv/doc/README.effects
--- freeciv/doc/README.effects  2009-05-07 23:43:31.000000000 +0300
+++ freeciv/doc/README.effects  2009-05-08 01:21:48.000000000 +0300
@@ -206,11 +206,15 @@
 Gain_AI_Love
     Gain amount points of "AI love" with AI(s).
 
+Turn_Years
+    Year advances by AMOUNT each turn unless Slow_Down_Timeline causes it
+    to be less.
+
 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.
+will be max 1 year/turn; with AMOUNT == 2 it is max 2 years/turn;
+with AMOUNT == 1 it is max 5 years/turn; with AMOUNT <= 0 the timeline is
+unaffected. The effect will be ignored if game.spacerace isn't set.
 
 Civil_War_Chance
     Chance of player splitting due to civil war when capital captured is 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to