Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11667) Anarchy in the AI
Home

[Freeciv-Dev] (PR#11667) Anarchy in the AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11667) Anarchy in the AI
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Thu, 23 Dec 2004 10:12:32 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch makes novice AI and /away AI go through revolution just like
normal players. This closes a cheating loophole that players can use,
settings themselves to /away once they get Republic, to avoid a period of
anarchy.

(Before /away and voting, you could use /ai to achieve the same.  Now with
voting, you cannot set yourself to regular AI without consulting the other
players by means of a vote.)

This patch is intended for both branches.

  - Per

Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.135
diff -u -r1.135 player.h
--- common/player.h     19 Dec 2004 16:47:09 -0000      1.135
+++ common/player.h     23 Dec 2004 16:44:27 -0000
@@ -54,7 +54,8 @@
   H_FOG = 256,        /* Can't see through fog of war */
   H_NOPLANES = 512,   /* Doesn't build air units */
   H_MAP = 1024,       /* Only knows map_is_known tiles */
-  H_DIPLOMACY = 2048  /* Not very good at diplomacy */
+  H_DIPLOMACY = 2048, /* Not very good at diplomacy */
+  H_REVOLUTION = 4096 /* Cannot skip anarchy */
 };
 
 struct player_economic {
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.348
diff -u -r1.348 plrhand.c
--- server/plrhand.c    21 Dec 2004 22:57:36 -0000      1.348
+++ server/plrhand.c    23 Dec 2004 16:44:32 -0000
@@ -907,9 +907,9 @@
   /* Set revolution_finishes value. */
   if (pplayer->revolution_finishes > 0) {
     /* Player already has an active revolution. */
-  } else if (pplayer->ai.control
+  } else if ((pplayer->ai.control && !ai_handicap(pplayer, H_REVOLUTION))
             || get_player_bonus(pplayer, EFT_NO_ANARCHY)) {
-    /* TODO: Make this a handicap. */
+    /* AI players without the H_REVOLUTION handicap can skip anarchy */
     pplayer->revolution_finishes = game.turn;
   } else if (game.revolution_length == 0) {
     pplayer->revolution_finishes = game.turn + myrand(5) + 1;
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.371
diff -u -r1.371 stdinhand.c
--- server/stdinhand.c  9 Dec 2004 16:38:35 -0000       1.371
+++ server/stdinhand.c  23 Dec 2004 16:44:35 -0000
@@ -667,10 +667,11 @@
 static int handicap_of_skill_level(int level)
 {
   int h[11] = { -1,
- /* away   */  H_AWAY  | H_RATES | H_TARGETS | H_HUTS | H_FOG | H_MAP,
+ /* away   */  H_AWAY  | H_RATES | H_TARGETS | H_HUTS | H_FOG | H_MAP
+                        | H_REVOLUTION,
  /* novice */   H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
                         | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
-                       | H_DIPLOMACY,
+                       | H_DIPLOMACY | H_REVOLUTION,
  /* easy */    H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
                         | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE,
                H_NONE,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11667) Anarchy in the AI, Per I. Mathisen <=