(PR#14228) Ai doesn't react to explorers pillaging it's territory

"Mateusz Stefek" <mstefek-IjDXvh/[email protected]> Sat, 8 Oct 2005 05:53:59 -0700
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1128776039-4975-2
Content-Type: text/plain; charset="utf-8"


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

This patch fixes this.
--
mateusz

------------=_1128776039-4975-2
Content-Type: text/x-patch; charset="ascii"; name="ai_pillage.diff"
Content-Disposition: inline; filename="ai_pillage.diff"
Content-Transfer-Encoding: 7bit

? civscore.log
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.93
diff -u -r1.93 advdiplomacy.c
--- ai/advdiplomacy.c	3 Oct 2005 23:32:54 -0000	1.93
+++ ai/advdiplomacy.c	8 Oct 2005 12:51:51 -0000
@@ -1609,3 +1609,17 @@
     }
   } players_iterate_end;
 }
+
+/***************************************************************************
+  Violator pillaged something on victims territory
+***************************************************************************/
+void ai_incident_pillage(struct player *violator, struct player *victim)
+{
+  if (violator == victim) {
+    return;
+  }
+  if (victim == NULL) {
+    return;
+  }
+  victim->ai.love[violator->player_no] -= MAX_AI_LOVE / 20;
+}
Index: ai/advdiplomacy.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.h,v
retrieving revision 1.5
diff -u -r1.5 advdiplomacy.h
--- ai/advdiplomacy.h	4 Aug 2005 16:26:11 -0000	1.5
+++ ai/advdiplomacy.h	8 Oct 2005 12:51:51 -0000
@@ -37,6 +37,7 @@
 void ai_incident_war(struct player *violator, struct player *victim);
 void ai_incident_diplomat(struct player *violator, struct player *victim);
 void ai_incident_nuclear(struct player *violator, struct player *victim);
+void ai_incident_pillage(struct player *violator, struct player *victim);
 
 bool ai_on_war_footing(struct player *pplayer);
 
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.388
diff -u -r1.388 unittools.c
--- server/unittools.c	6 Oct 2005 16:05:56 -0000	1.388
+++ server/unittools.c	8 Oct 2005 12:51:52 -0000
@@ -707,6 +707,8 @@
       } unit_list_iterate_end;
       update_tile_knowledge(ptile);
       
+      ai_incident_pillage(unit_owner(punit), ptile->owner);
+      
       /* If a watchtower has been pillaged, reduce sight to normal */
       if (what_pillaged == S_FORTRESS) {
 	freelog(LOG_VERBOSE, "Watchtower(2) pillaged!");

------------=_1128776039-4975-2--