Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7097) feature request
Home

[Freeciv-Dev] Re: (PR#7097) feature request

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Horn.Gabor@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7097) feature request
From: "ue80@xxxxxxxxxxxxxxxxxxxxx" <ue80@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Jan 2004 13:51:05 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7097 >

On Mon, Dec 15, 2003 at 01:51:32PM -0800, Horn G?bor wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7097 >
> 
> Hi!
> 
> Would it be possible to disable random length revolution? They're very
> wrong in duel games, can affect the game much (1 vs 5 turn revo is very
> huge difference later in naval techs, and w/ close islands it can be a
> huge advantage for the luckier player). I mean not always, but have it
> as an option (/set fixedrevolution 2 or similar, 0 would be the current
> behaviour).
> 
> bye, hirisov

Ok, it's more complicate, but with this it's possible to restore the old
behavior.

Two new variables:
  game.minrevolutionlength 
  game.maxrevolutionlength

with minrev == maxrev the length is fixed.
When minrev > maxrev it's fixed to minrev.

Thomas
-- 
Thomas Strub  ***  eMail ue80@xxxxxxxxxxxxxxxxxxxxx
Reden ist Silber,
      Schweigen ist Gold!

Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.173
diff -u -r1.173 game.c
--- common/game.c       2003/11/28 17:37:21     1.173
+++ common/game.c       2004/01/13 21:42:52
@@ -227,6 +227,8 @@
   game.cityfactor  = GAME_DEFAULT_CITYFACTOR;
   game.citymindist = GAME_DEFAULT_CITYMINDIST;
   game.civilwarsize= GAME_DEFAULT_CIVILWARSIZE;
+  game.minrevolutionlength = GAME_DEFAULT_MINREVLENGTH;
+  game.maxrevolutionlength = GAME_DEFAULT_MAXREVLENGTH;
   game.contactturns= GAME_DEFAULT_CONTACTTURNS;
   game.rapturedelay= GAME_DEFAULT_RAPTUREDELAY;
   game.savepalace  = GAME_DEFAULT_SAVEPALACE;
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.128
diff -u -r1.128 game.h
--- common/game.h       2004/01/11 17:45:04     1.128
+++ common/game.h       2004/01/13 21:42:53
@@ -85,6 +85,8 @@
   int cityfactor;
   int citymindist;
   int civilwarsize;
+  int minrevolutionlength;
+  int maxrevolutionlength;
   int contactturns;
   int rapturedelay;
   int min_players, max_players, nplayers;
@@ -353,6 +355,14 @@
 #define GAME_DEFAULT_CIVILWARSIZE    10
 #define GAME_MIN_CIVILWARSIZE        6
 #define GAME_MAX_CIVILWARSIZE        1000
+
+#define GAME_DEFAULT_MINREVLENGTH    1
+#define GAME_MIN_MINREVLENGTH        0
+#define GAME_MAX_MINREVLENGTH        6
+
+#define GAME_DEFAULT_MAXREVLENGTH    6
+#define GAME_MIN_MAXREVLENGTH        0
+#define GAME_MAX_MAXREVLENGTH        6
 
 #define GAME_DEFAULT_CONTACTTURNS    20
 #define GAME_MIN_CONTACTTURNS        0
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.301
diff -u -r1.301 plrhand.c
--- server/plrhand.c    2004/01/08 11:27:11     1.301
+++ server/plrhand.c    2004/01/13 21:42:53
@@ -812,12 +812,19 @@
 **************************************************************************/
 void handle_player_revolution(struct player *pplayer)
 {
-  if ((pplayer->revolution<=5) &&
+  if ((pplayer->revolution<=game.maxrevolutionlength) &&
       (pplayer->revolution>0) &&
       ( pplayer->government==game.government_when_anarchy))
     return;
 
-  pplayer->revolution=myrand(5)+1;
+  if (game.maxrevolutionlength - game.minrevolutionlength > 0) {
+      pplayer->revolution=
+        myrand(game.maxrevolutionlength-game.minrevolutionlength)
+                                 + game.minrevolutionlength; 
+  } else {
+    pplayer->revolution= game.minrevolutionlength;
+  }
+                                
   pplayer->government=game.government_when_anarchy;
   notify_player_ex(pplayer, -1, -1, E_REVOLT_START,
                   _("Game: The %s have incited a revolt!"),
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.144
diff -u -r1.144 savegame.c
--- server/savegame.c   2004/01/12 16:59:17     1.144
+++ server/savegame.c   2004/01/13 21:42:53
@@ -2009,6 +2009,14 @@
     game.civilwarsize =
       secfile_lookup_int_default(file, GAME_DEFAULT_CIVILWARSIZE,
                                 "game.civilwarsize");
+   
+    game.minrevolutionlength =
+      secfile_lookup_int_default(file, GAME_DEFAULT_MINREVLENGTH,
+                                 "game.minrevolutionlength");
+    game.maxrevolutionlength =
+      secfile_lookup_int_default(file, GAME_DEFAULT_MAXREVLENGTH,
+                                 "game.maxrevolutionlength");
+   
     game.contactturns =
       secfile_lookup_int_default(file, GAME_DEFAULT_CONTACTTURNS,
                                 "game.contactturns");
@@ -2371,6 +2379,8 @@
   secfile_insert_int(file, game.cityfactor, "game.cityfactor");
   secfile_insert_int(file, game.citymindist, "game.citymindist");
   secfile_insert_int(file, game.civilwarsize, "game.civilwarsize");
+  secfile_insert_int(file, game.minrevolutionlength, 
"game.minrevolutionlength");
+  secfile_insert_int(file, game.maxrevolutionlength, 
"game.maxrevolutionlength");
   secfile_insert_int(file, game.contactturns, "game.contactturns");
   secfile_insert_int(file, game.rapturedelay, "game.rapturedelay");
   secfile_insert_int(file, game.diplcost, "game.diplcost");
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.303
diff -u -r1.303 stdinhand.c
--- server/stdinhand.c  2004/01/09 05:55:55     1.303
+++ server/stdinhand.c  2004/01/13 21:42:54
@@ -667,6 +667,20 @@
          GAME_MIN_CIVILWARSIZE, GAME_MAX_CIVILWARSIZE, 
          GAME_DEFAULT_CIVILWARSIZE)
 
+  GEN_INT("minrevolutionlength", game.minrevolutionlength, SSET_RULES_FLEXIBLE,
+         SSET_TO_CLIENT,
+         N_("Minimum length of revolution in turns"),
+         N_("There is no check if this value is higher than max length"), NULL,
+         GAME_MIN_MINREVLENGTH, GAME_MAX_MINREVLENGTH, 
+         GAME_DEFAULT_MINREVLENGTH)
+
+  GEN_INT("maxrevolutionlength", game.maxrevolutionlength, SSET_RULES_FLEXIBLE,
+         SSET_TO_CLIENT,
+         N_("Maximum length of revolution in turns"),
+         N_("There is no check if this value is higher than max length"), NULL,
+         GAME_MIN_MAXREVLENGTH, GAME_MAX_MAXREVLENGTH, 
+         GAME_DEFAULT_MAXREVLENGTH)
+  
   GEN_INT("contactturns", game.contactturns, SSET_RULES_FLEXIBLE,
          SSET_TO_CLIENT,
          N_("Number of turns players may meet after contact"),

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