Complete.Org: Mailing Lists: Archives: freeciv-ai: July 2003:
[freeciv-ai] Re: [Freeciv-Dev] (PR#4349) New tax code
Home

[freeciv-ai] Re: [Freeciv-Dev] (PR#4349) New tax code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [freeciv-ai] Re: [Freeciv-Dev] (PR#4349) New tax code
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sat, 12 Jul 2003 04:09:45 -0700
Reply-to: rt@xxxxxxxxxxxxxx

I am continuing my crusade against the new tax code :)

Let's take the maxbuycost patch and criticise it step by step:

+static void adjust_buylimit(struct player *pplayer, int by_how_much)
+{
+  if (pplayer->economic.gold - pplayer->ai.est_upkeep
+      < pplayer->ai.maxbuycost) {
+    pplayer->ai.maxbuycost = MAX(pplayer->ai.maxbuycost, by_how_much);
+  }
+}

Naming is bad, but the worst is I don't understand the meaning of "if" 
here.  Per, please explain.  You might need to lecture me on the general 
use of maxbuycost too...

-  /* Disband troops that are at home but don't serve a purpose. */
+  /* Disband explorers that are at home but don't serve a purpose. 
+   * FIXME: This is a clever hack, but should be removed once we
+   * learn how to ferry explorers to new land. */
   city_list_iterate(pplayer->cities, pcity) {
     struct tile *ptile = map_get_tile(pcity->x, pcity->y);
     unit_list_iterate(ptile->units, punit) {
-      if (((unit_types[punit->type].shield_cost > 0
-            && pcity->shield_prod == 0)
-           || unit_has_role(punit->type, L_EXPLORER))
+      if (unit_has_role(punit->type, L_EXPLORER)
           && pcity->id == punit->homecity
-          && pcity->ai.urgency == 0
-          && is_ground_unit(punit)) {
+          && pcity->ai.urgency == 0) {
         struct packet_unit_request packet;
         packet.unit_id = punit->id;
         CITY_LOG(LOG_BUY, pcity, "disbanding %s to increase production",

The new code means that if an explorer walks into a city by chance, it's 
dead.  Nice...

The old code means that a production-1 cannot build itself a defender 
unless it's urgent.  Nice...

I really dislike both.

-        CITY_LOG(LOG_BUY, pcity, "Wonder being built in dangerous 
position!");
+        CITY_LOG(LOG_ERROR, pcity, "Wonder being built in dangerous 
position!");

Surely this is some artefact.

-  if (pplayer->economic.gold + cached_limit < pplayer->ai.maxbuycost) {
-    /* We have too much gold! Don't raise taxes */
-    pplayer->ai.maxbuycost = 0;
-  }
-

What was that supposed to mean??


G.




[Prev in Thread] Current Thread [Next in Thread]