Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] [PATCH] use symbolic types for ai_choice at aicity.c part
Home

[Freeciv-Dev] [PATCH] use symbolic types for ai_choice at aicity.c part

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] use symbolic types for ai_choice at aicity.c part 2 (PR#1315)
From: Markus Linnala <maage@xxxxxxxxx>
Date: Sun, 10 Mar 2002 08:27:54 -0800 (PST)

Use CT_* instead of ints.

This is on top of: '[PATCH] use symbolic types for ai_choice at aicity.c'

--- freeciv-ct-none/ai/aicity.c_old     Sun Mar 10 18:17:37 2002
+++ freeciv-ct-none/ai/aicity.c Sun Mar 10 18:24:59 2002
@@ -437,7 +437,7 @@
             pplayer->ai.maxbuycost < 100) pplayer->ai.maxbuycost = 100;
       }
 #ifdef GRAVEDANGERWORKS
-      else if (bestchoice.type == 3 && pcity->size == 1 &&
+      else if (bestchoice.type == CT_DEFENDER && pcity->size == 1 &&
         pcity->ai.grave_danger > (assess_defense_quadratic(pcity) +
   ai_city_defender_value(pcity, U_LEGION, bestchoice.choice)) * 2 &&
                pcity->food_stock + pcity->food_surplus < 10) { /* We're DOOMED 
*/
@@ -453,13 +453,13 @@
                                    && assess_defense(pcity) == 0)) {
          really_handle_city_buy(pplayer, pcity); /* adequately tested now */
        }
-      } else if (bestchoice.type != 0 || !is_wonder(bestchoice.choice)) {
+      } else if (bestchoice.type != CT_NONE || !is_wonder(bestchoice.choice)) {
        freelog(LOG_DEBUG, "%s wants %s but can't afford to buy it"
                      " (%d < %d).", pcity->name,
-                     (bestchoice.type != 0 ? unit_name(bestchoice.choice)
+                     (bestchoice.type != CT_NONE ? unit_name(bestchoice.choice)
                       : get_improvement_name(bestchoice.choice)),
                      pplayer->economic.gold, buycost);
-        if (bestchoice.type != 0 && !unit_type_flag(bestchoice.choice, 
F_NONMIL)) {
+        if (bestchoice.type != CT_NONE && !unit_type_flag(bestchoice.choice, 
F_NONMIL)) {
           if (pcity->ai.grave_danger != 0 && assess_defense(pcity) == 0) { /* 
oh dear */
             try_to_sell_stuff(pplayer, pcity);
             if ((pplayer->economic.gold-pplayer->ai.est_upkeep) >= buycost)

-- 
//Markus



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