(PR#12126) acceptable reputation is too high for cease-fire

"Mateusz Stefek" <mstefek-IjDXvh/[email protected]> Sat, 5 Feb 2005 04:26:32 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12126 >

Acceptable reputation limit is very high - that's ok, but for cease fire
I think it would be better if the limit was much lower.
This patch implements it.
It also fixes some behavior which I think was bad:

-    /* Check if we can trust this guy. If we want to blast off to space,
+    /* Check if we can trust this guy. If we have to crash spacerace
leader,
      * we don't care, though. */
     if (ai->diplomacy.acceptable_reputation > aplayer->reputation
-        && ai->diplomacy.strategy != WIN_SPACE) {
+        && ai->diplomacy.strategy != WIN_CAPITAL


It is included in this patch, because it touches the same lines.
--
mateusz
reputation_cease_fire.diff (application/octet-stream, 2 KB)
diff -ur -Xfreeciv/diff_ignore freeciv/ai/advdiplomacy.c changed/ai/advdiplomacy.c
--- freeciv/ai/advdiplomacy.c	2004-11-22 16:02:04.000000000 +0100
+++ changed/ai/advdiplomacy.c	2005-01-23 12:29:32.000000000 +0100
@@ -275,10 +275,13 @@
       break;
     }
 
-    /* Check if we can trust this guy. If we want to blast off to space,
+    /* Check if we can trust this guy. If we have to crash spacerace leader,
      * we don't care, though. */
     if (ai->diplomacy.acceptable_reputation > aplayer->reputation
-        && ai->diplomacy.strategy != WIN_SPACE) {
+        && ai->diplomacy.strategy != WIN_CAPITAL
+	&& (pclause->type != CLAUSE_CEASEFIRE
+	    || ai->diplomacy.acceptable_reputation_for_ceasefire > 
+	       aplayer->reputation)) {
       notify(aplayer, _("*%s (AI)* Begone scoundrel, we all know that"
              " you cannot be trusted!"), pplayer->name);
       worth = -BIG_NUMBER;
diff -ur -Xfreeciv/diff_ignore freeciv/ai/aidata.c changed/ai/aidata.c
--- freeciv/ai/aidata.c	2004-10-23 21:01:01.000000000 +0200
+++ changed/ai/aidata.c	2005-01-23 12:29:40.000000000 +0100
@@ -302,6 +302,8 @@
   ai->diplomacy.acceptable_reputation =
            GAME_DEFAULT_REPUTATION -
            GAME_DEFAULT_REPUTATION / 4;
+  ai->diplomacy.acceptable_reputation_for_ceasefire =
+           GAME_DEFAULT_REPUTATION / 3;
 
   /* Set per-player variables. We must set all players, since players 
    * can be created during a turn, and we don't want those to have 
diff -ur -Xfreeciv/diff_ignore freeciv/ai/aidata.h changed/ai/aidata.h
--- freeciv/ai/aidata.h	2004-10-23 21:01:01.000000000 +0200
+++ changed/ai/aidata.h	2005-01-23 12:22:57.000000000 +0100
@@ -63,6 +63,7 @@
   /* AI diplomacy and opinions on other players */
   struct {
     int acceptable_reputation;
+    int acceptable_reputation_for_ceasefire;
     struct ai_dip_intel player_intel[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
     enum winning_strategy strategy;
     int timer; /* pursue our goals with some stubbornness, in turns */