[Freeciv-Dev] (PR#13362) Better city gold worth calculation
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#13362) Better city gold worth calculation |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Tue, 28 Jun 2005 03:57:46 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13362 >
This patch makes the AI's calculation of the gold worth of cities more
realistic, adding more variables to the equation and removing a silly
constant. Prices go up by more than 100% in most cases, which should help
against the complaints that the AI sells its cities cheap.
- Per
Index: common/aicore/aisupport.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/aisupport.c,v
retrieving revision 1.10
diff -u -r1.10 aisupport.c
--- common/aicore/aisupport.c 5 May 2005 18:32:52 -0000 1.10
+++ common/aicore/aisupport.c 28 Jun 2005 10:54:46 -0000
@@ -104,9 +108,18 @@
int city_gold_worth(struct city *pcity)
{
struct player *pplayer = city_owner(pcity);
- int worth;
+ int worth = 0, i;
+ Unit_type_id u = best_role_unit_for_player(city_owner(pcity), F_CITIES);
- worth = pcity->size * 150; /* reasonable base cost */
+ if (u != U_LAST) {
+ worth += unit_buy_gold_cost(u, 0); /* cost of settler */
+ }
+ for (i = 1; i < pcity->size; i++) {
+ worth += city_granary_size(i); /* cost of growing city */
+ }
+ output_type_iterate(o) {
+ worth += pcity->prod[o] * 10;
+ } output_type_iterate_end;
unit_list_iterate(pcity->units_supported, punit) {
if (same_pos(punit->tile, pcity->tile)) {
Unit_type_id id = unit_type(punit)->obsoleted_by;
@@ -119,10 +132,10 @@
}
} unit_list_iterate_end;
built_impr_iterate(pcity, impr) {
- if (is_wonder(impr) && !improvement_obsolete(pplayer, impr)) {
- worth += impr_sell_gold(impr);
- } else {
+ if (improvement_obsolete(pplayer, impr)) {
worth += impr_sell_gold(impr) / 4;
+ } else {
+ worth += impr_sell_gold(impr);
}
} built_impr_iterate_end;
if (city_unhappy(pcity)) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13362) Better city gold worth calculation,
Per I. Mathisen <=
|
|