Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Re: (PR#11589) Missing TILE_XY uses
Home

[Freeciv-Dev] Re: (PR#11589) Missing TILE_XY uses

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: badamson@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11589) Missing TILE_XY uses
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sat, 18 Dec 2004 11:47:51 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11589 >


  You had missed some cases. Attached version should fix all format 
errors in AI logging. Works both for stable and head.


  - ML

diff -Nurd -X.diff_ignore freeciv/ai/advdiplomacy.c freeciv/ai/advdiplomacy.c
--- freeciv/ai/advdiplomacy.c   2004-12-18 13:26:38.812500000 +0200
+++ freeciv/ai/advdiplomacy.c   2004-12-18 21:17:22.671875000 +0200
@@ -1154,7 +1154,7 @@
                  "alliance, and yet you remain at peace with our mortal "
                  "enemy, %s! This is unacceptable, our alliance is no "
                  "more!"), pplayer->name, target->name);
-          PLAYER_LOG(LOG_DIPL2, pplayer, ai, "breaking useless alliance with ",
+          PLAYER_LOG(LOG_DIPL2, pplayer, ai, "breaking useless alliance with "
                      "%s", aplayer->name);
          /* to peace */
          handle_diplomacy_cancel_pact(pplayer, aplayer->player_no,
diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c    2004-12-18 13:26:38.812500000 +0200
+++ freeciv/ai/advmilitary.c    2004-12-18 21:15:42.437500000 +0200
@@ -922,7 +922,7 @@
           CITY_LOG(LOG_DEBUG, pcity, "wants %s to build %s to punish 
%s@(%d,%d)"
                    " with desire %d", get_tech_name(pplayer, tech_req), 
                    unit_name(unit_type), (acity ? acity->name : "enemy"),
-                   ptile, want);
+                   TILE_XY(ptile), want);
 
         } else if (want > best_choice->want) {
           if (can_build_unit(pcity, unit_type)) {
diff -Nurd -X.diff_ignore freeciv/ai/aidiplomat.c freeciv/ai/aidiplomat.c
--- freeciv/ai/aidiplomat.c     2004-12-18 13:26:38.828125000 +0200
+++ freeciv/ai/aidiplomat.c     2004-12-18 21:15:42.437500000 +0200
@@ -517,7 +517,7 @@
     } else {
       /* usually because we ended move early due to another unit */
       UNIT_LOG(LOG_DIPLOMAT, punit, "could not bribe target (%d, %d), "
-               " %d moves left", pos.tile, punit->moves_left);
+               " %d moves left", TILE_XY(pos.tile), punit->moves_left);
       return FALSE;
     }
   } pf_iterator_end;
diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c        2004-12-18 13:26:38.843750000 +0200
+++ freeciv/ai/aiferry.c        2004-12-18 21:15:42.468750000 +0200
@@ -407,7 +407,7 @@
     struct unit *ferryboat = NULL;
 
     UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "will have to go to (%d,%d) by boat",
-             dest_tile);
+             TILE_XY(dest_tile));
 
     if (!is_ocean_near_tile(punit->tile)) {
       struct pf_path *path_to_ferry = NULL;
@@ -421,7 +421,7 @@
 
       ferryboat = find_unit_by_id(boatid);
       UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "found boat[%d](%d,%d), going there", 
-              boatid, ferryboat->tile);
+              boatid, TILE_XY(ferryboat->tile));
       /* The path can be amphibious so we will stop at the coast.  
        * It might not lead _onto_ the boat. */
       if (!ai_unit_execute_path(punit, path_to_ferry)) { 
@@ -448,7 +448,7 @@
     /* Ok, a boat found, try boarding it */
     ferryboat = find_unit_by_id(boatid);
     UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "found a nearby boat[%d](%d,%d)",
-            ferryboat->id, ferryboat->tile);
+            ferryboat->id, TILE_XY(ferryboat->tile));
     /* Setting ferry now in hope it won't run away even 
      * if we can't board it right now */
     aiferry_psngr_meet_boat(punit, ferryboat);
@@ -462,7 +462,7 @@
       /* FIXME: this is probably a serious bug, but we just skip past
        * it and continue. */
       UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, "couldn't board boat[%d](%d,%d)",
-              ferryboat->id, ferryboat->tile);
+              ferryboat->id, TILE_XY(ferryboat->tile));
       return FALSE;
     }
 
@@ -481,7 +481,7 @@
 
       UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, 
               "got boat[%d](moves left: %d), going (%d,%d)",
-               ferryboat->id, ferryboat->moves_left, dest_tile);
+               ferryboat->id, ferryboat->moves_left, TILE_XY(dest_tile));
       aiferry_psngr_meet_boat(punit, ferryboat);
 
       /* If the location is not accessible directly from sea
@@ -496,7 +496,7 @@
           return FALSE;
         }
         UNIT_LOG(LOGLEVEL_GOBYBOAT, punit, 
-                 "Found beachhead (%d,%d)", beach_tile);
+                 "Found beachhead (%d,%d)", TILE_XY(beach_tile));
       } else {
        beach_tile = dest_tile;
       }
@@ -592,7 +592,7 @@
              || aunit->ai.ferryboat == pferry->id)) {
         UNIT_LOG(LOGLEVEL_FERRY, pferry, 
                  "Found a potential cargo %s[%d](%d,%d), going there",
-                 unit_type(aunit)->name, aunit->id, aunit->tile);
+                 unit_type(aunit)->name, aunit->id, TILE_XY(aunit->tile));
        pferry->goto_tile = aunit->tile;
         /* Exchange phone numbers */
         aiferry_psngr_meet_boat(aunit, pferry);
@@ -665,7 +665,7 @@
                                       pcity->is_building_unit, TRUE);
 
       UNIT_LOG(LOGLEVEL_FERRY, pferry, "%s (%d, %d) looks promising...", 
-               pcity->name, pcity->tile);
+               pcity->name, TILE_XY(pcity->tile));
 
       if (pos.turn > turns && pcity->is_building_unit
           && unit_has_role(pcity->currently_building, L_FERRYBOAT)) {
diff -Nurd -X.diff_ignore freeciv/ai/aihunt.c freeciv/ai/aihunt.c
--- freeciv/ai/aihunt.c 2004-12-18 13:26:38.843750000 +0200
+++ freeciv/ai/aihunt.c 2004-12-18 21:22:51.140625000 +0200
@@ -291,7 +291,8 @@
         dist1 = dist2 = 0;
       }
       UNIT_LOG(LOGLEVEL_HUNT, punit, "considering chasing %s(%d, %d) id %d "
-               "dist1 %d dist2 %d", unit_type(target)->name, target->tile,
+               "dist1 %d dist2 %d",
+              unit_type(target)->name, TILE_XY(target->tile),
                target->id, dist1, dist2);
       /* We can't attack units stationary in cities. */
       if (map_get_city(target->tile) 
@@ -303,8 +304,9 @@
           && dist1 >= dist2) {
         UNIT_LOG(LOGLEVEL_HUNT, punit, "giving up racing %s (%d, %d)->(%d, 
%d)",
                  unit_type(target)->name,
-                target->ai.prev_pos ? *target->ai.prev_pos : NULL,
-                 target->tile);
+                target->ai.prev_pos ? (*target->ai.prev_pos)->x : -1,
+                 target->ai.prev_pos ? (*target->ai.prev_pos)->y : -1,
+                 TILE_XY(target->tile));
         continue;
       }
       unit_list_iterate(ptile->units, sucker) {
@@ -318,7 +320,8 @@
       if (stackcost < unit_type(punit)->build_cost
           && unit_win_chance(punit, defender) < 0.6) {
         UNIT_LOG(LOGLEVEL_HUNT, punit, "chickening out from attacking %s"
-                 "(%d, %d)", unit_type(defender)->name, defender->tile);
+                 "(%d, %d)", unit_type(defender)->name,
+                 TILE_XY(defender->tile));
         continue;
       }
       stackthreat *= 9; /* WAG */
@@ -327,7 +330,7 @@
       UNIT_LOG(LOGLEVEL_HUNT, punit, "considering hunting %s's %s(%d, %d) id "
                "id %d with want %d, dist1 %d, dist2 %d", 
                unit_owner(defender)->name, unit_type(defender)->name, 
-               defender->tile, defender->id, stackthreat, dist1, 
+               TILE_XY(defender->tile), defender->id, stackthreat, dist1,
                dist2);
       /* TO DO: probably ought to WAG down targets of players we are not (yet)
        * at war with */
@@ -391,7 +394,7 @@
           if (victim == target) {
             sucker = victim;
             UNIT_LOG(LOGLEVEL_HUNT, missile, "found primary target %d(%d, %d)"
-                     " dist %d", victim->id, victim->tile, 
+                     " dist %d", victim->id, TILE_XY(victim->tile), 
                      pos.total_MC);
             break; /* Our target! Get him!!! */
           }
@@ -402,7 +405,7 @@
             /* Threat to our carrier. Kill it. */
             sucker = victim;
             UNIT_LOG(LOGLEVEL_HUNT, missile, "found aux target %d(%d, %d)",
-                     victim->id, victim->tile);
+                     victim->id, TILE_XY(victim->tile));
             break;
           }
         } unit_list_iterate_end;
@@ -453,7 +456,7 @@
     return FALSE;
   }
   UNIT_LOG(LOGLEVEL_HUNT, punit, "hunting %d(%d, %d)",
-          target->id, target->tile);
+          target->id, TILE_XY(target->tile));
   sanity_target = target->id;
 
   /* Check if we can nuke it */
diff -Nurd -X.diff_ignore freeciv/ai/aitools.c freeciv/ai/aitools.c
--- freeciv/ai/aitools.c        2004-12-18 13:26:38.859375000 +0200
+++ freeciv/ai/aitools.c        2004-12-18 21:15:42.468750000 +0200
@@ -192,7 +192,7 @@
     if (danger >= my_def) {
       UNIT_LOG(LOGLEVEL_BODYGUARD, punit, 
                "want bodyguard @(%d, %d) danger=%d, my_def=%d", 
-               dest_tile, danger, my_def);
+               TILE_XY(dest_tile), danger, my_def);
       punit->ai.bodyguard = BODYGUARD_WANTED;
     } else {
       punit->ai.bodyguard = BODYGUARD_NONE;
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c 2004-12-18 13:26:38.859375000 +0200
+++ freeciv/ai/aiunit.c 2004-12-18 21:25:43.625000000 +0200
@@ -629,7 +629,7 @@
 
         /* No need to amortize, our operation takes one turn. */
        UNIT_LOG(LOG_DEBUG, punit, "Rampage: Desire %d to kill %s(%d,%d)",
-                desire, unit_name(pdef->type), pdef->tile);
+                desire, unit_name(pdef->type), TILE_XY(pdef->tile));
 
         return MAX(0, desire);
       }
@@ -1164,7 +1164,7 @@
 
   if (pcity) {
     UNIT_LOG(LOG_DEBUG, punit, "go home to %s(%d,%d)",
-             pcity->name, pcity->tile); 
+             pcity->name, TILE_XY(pcity->tile)); 
     if (same_pos(punit->tile, pcity->tile)) {
       UNIT_LOG(LOG_DEBUG, punit, "go home successful; role AI_NONE");
       ai_unit_new_role(punit, AIUNIT_NONE, NULL);
@@ -1596,7 +1596,7 @@
         UNIT_LOG(LOG_DEBUG, punit, "in fstk with boat %s@(%d, %d) -> %s@(%d, 
%d)"
                  " (go_by_boat=%d, move_time=%d, want=%d, best=%d)",
                  unit_type(ferryboat)->name, best_tile->x, best_tile->y,
-                 acity->name, acity->tile, 
+                 acity->name, TILE_XY(acity->tile), 
                  go_by_boat, move_time, want, best);
       }
       
@@ -1961,9 +1961,7 @@
        to protect city from attack (and be opportunistic too)*/
     if (ai_military_rampage(punit, RAMPAGE_ANYTHING, 
                             RAMPAGE_FREE_CITY_OR_BETTER)) {
-      UNIT_LOG(LOGLEVEL_RECOVERY, punit, "recovering hit points.",
-              pplayer->name, unit_type(punit)->name, punit->id,
-              punit->tile->x, punit->tile->y);
+      UNIT_LOG(LOGLEVEL_RECOVERY, punit, "recovering hit points.");
     } else {
       return; /* we died heroically defending our city */
     }
diff -Nurd -X.diff_ignore freeciv/server/settlers.c freeciv/server/settlers.c
--- freeciv/server/settlers.c   2004-12-18 13:27:46.453125000 +0200
+++ freeciv/server/settlers.c   2004-12-18 21:27:05.062500000 +0200
@@ -1136,7 +1136,7 @@
     if (result.result > best_impr) {
       if (map_get_city(result.tile)) {
         UNIT_LOG(LOG_SETTLER, punit, "immigrates to %s (%d, %d)", 
-                 map_get_city(result.tile), TILE_XY(result.tile));
+                 map_get_city(result.tile)->name, TILE_XY(result.tile));
       } else {
         UNIT_LOG(LOG_SETTLER, punit, "makes city at (%d, %d)", 
                  TILE_XY(result.tile));

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