Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2004:
[freeciv-ai] better massage worker/engineer want

[freeciv-ai] better massage worker/engineer want

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] better massage worker/engineer want
From: Per Inge Mathisen <per@xxxxxxxxxxx>
Date: Wed, 15 Sep 2004 09:59:08 +0000 (GMT)

In large games with a large number of cities, the existing massage of
engineer want does not work so well. I therefore made it more aggressive
in keeping the number of workers down. I also improved the logging a bit.

I commit this right away.

  - Per

Index: server/settlers.c
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.200
diff -u -r1.200 settlers.c
--- server/settlers.c   13 Sep 2004 15:54:54 -0000      1.200
+++ server/settlers.c   15 Sep 2004 09:55:43 -0000
@@ -1528,14 +1528,18 @@
   want = evaluate_improvements(virtualunit, &best_act, &gx, &gy);

-  /* modify our desire based on available statistics to prevent
+  /* Massage our desire based on available statistics to prevent
    * overflooding with worker type units if they come cheap in
    * the ruleset */
   want /= MAX(1, ai->stats.workers[ptile->continent]
-                 / MAX(1, ai->stats.cities[ptile->continent]));
+                 / ai->stats.cities[ptile->continent]);
+  want -= MIN(ai->stats.workers[ptile->continent], want);

-  CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d)",
-          unit_name(unit_type), want, get_activity_text(best_act), gx, gy);
+  CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d), "
+           "we have %d workers and %d cities on the continent",
+          unit_name(unit_type), want, get_activity_text(best_act), gx, gy,
+           ai->stats.workers[ptile->continent],
+           ai->stats.cities[ptile->continent]);
   assert(want >= 0);
   pcity->ai.settler_want = want;

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] better massage worker/engineer want, Per Inge Mathisen <=