Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2005:
[freeciv-ai] (PR#14228) Ai doesn't react to explorers pillaging it's ter
Home

[freeciv-ai] (PR#14228) Ai doesn't react to explorers pillaging it's ter

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] (PR#14228) Ai doesn't react to explorers pillaging it's territory
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sat, 8 Oct 2005 05:53:59 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch fixes this.
--
mateusz
? 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!");

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#14228) Ai doesn't react to explorers pillaging it's territory, Mateusz Stefek <=