[Freeciv-Dev] Re: (PR#6131) bunch of changes to AI wall, coastal & SAM c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#6131) bunch of changes to AI wall, coastal & SAM code |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Wed, 10 Sep 2003 15:22:21 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
There was an error in the adjust_attackers diff. Here is a new one.
- Per
Index: ai/advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.150
diff -u -r1.150 advmilitary.c
--- ai/advmilitary.c 10 Sep 2003 17:51:03 -0000 1.150
+++ ai/advmilitary.c 10 Sep 2003 21:45:30 -0000
@@ -953,6 +962,16 @@
/* Is the defender veteran? */
bool def_vet;
struct ai_choice best_choice;
+ int adjust_want = 0; /* adjust want if lots of attackers already */
+
+ /* Set adjust_want exponentially */
+ unit_list_iterate(pcity->units_supported, other) {
+ if (IS_ATTACKER(other) && other->moves_left == unit_move_rate(other)
+ && (other->activity == ACTIVITY_SENTRY
+ || other->activity == ACTIVITY_FORTIFIED)) {
+ adjust_want += MAX(adjust_want / 2, 1);
+ }
+ } unit_list_iterate_end;
init_choice(&best_choice);
best_choice.choice = myunit->type;
@@ -1079,6 +1098,13 @@
&best_choice, ferryboat, boattype);
}
+ /* Adjust want for lots of attackers idling in town */
+ while (adjust_want > 0) {
+ best_choice.want -= (best_choice.want / 10) * MIN(adjust_want, 9);
+ adjust_want -= MAX(adjust_want, 9);
+ }
+ best_choice.want = MAX(0, best_choice.want);
+
if (best_choice.want > choice->want) {
/* We want attacker more that what we have selected before */
copy_if_better_choice(&best_choice, choice);
- [Freeciv-Dev] Re: (PR#6131) bunch of changes to AI wall, coastal & SAM code,
Per I. Mathisen <=
|
|