(PR#12625) kill desire and teams

"Mateusz Stefek" <mstefek-IjDXvh/[email protected]> Fri, 25 Mar 2005 00:20:09 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12625 >

kill_desire() doesn't understand teams. You can see AI doing very stupid
things in team games. If 5 teamed players play aginst 5 other players,
the unteamed ones shouldn't fight against each other, but they do.
Here's a patch which improves AI behaviour.
--
mateusz
kill_desire_teams.diff (text/x-patch, 649 B)
--- techclean/ai/advdiplomacy.c	2005-03-15 00:48:18.000000000 +0100
+++ ff/ai/advdiplomacy.c	2005-03-15 10:58:07.000000000 +0100
@@ -705,6 +705,15 @@
     kill_desire += pcity->size > 8 ? 1 : 0;
   } city_list_iterate_end;
 
+  /* Destroy teams */
+  players_iterate(eplayer) {
+    if (!eplayer->is_alive || eplayer == aplayer
+        || !players_on_same_team(eplayer, aplayer)) {
+      continue;
+    }
+    kill_desire += city_list_size(eplayer->cities) / 2;
+  } players_iterate_end;
+  
   /* Tech lead is worrisome */
   kill_desire += MAX(aplayer->research->techs_researched -
                      pplayer->research->techs_researched, 0);