Complete.Org: Mailing Lists: Archives: freeciv-ai: June 2004:
[freeciv-ai] (PR#8992) Building ferries
Home

[freeciv-ai] (PR#8992) Building ferries

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#8992) Building ferries
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Tue, 15 Jun 2004 08:36:04 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8992 >

I decided that the code is almost ready to make ferry-building more
centralized.  General layout will be:

1. If a city wants to build something that will need a boat, it will
just set need_boat field in the choice struct and decrease the want for
the unit by some WAG (to account for the fact that a ferry will possibly
need to be built).  No checks or searches for ferries will be done at
this stage.

2. After all cities chose their builds, a function will be called which
will compare the number of existing ferries with the number of
passengers + passengers-to-be-built and will make some of the cities
switch their production.

3. (optional improvemnt) The same function can tell the cities which
"want reduction value" to use in step 1 the next turn (i.e. if there are
plenty ferries there is no need to punish sea travel).

The first patch, however, is just making sure that need_boat field is
set correctly.

G.
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.109
diff -u -r1.109 advdomestic.c
--- ai/advdomestic.c    27 May 2004 22:14:17 -0000      1.109
+++ ai/advdomestic.c    15 Jun 2004 15:23:30 -0000
@@ -978,17 +978,8 @@
       choice->want = want;
       choice->type = CT_NONMIL;
       ai_choose_role_unit(pplayer, pcity, choice, F_SETTLERS, want);
-      
-    } else if (want < 0) {
-      /* Negative value is a hack to tell us that we need boats to colonize.
-       * abs(want) is desire for the boats. */
-      CITY_LOG(LOG_DEBUG, pcity, "desires settlers with passion %d and asks"
-              " for a boat", want);
-      choice->want = 0 - want;
-      choice->type = CT_NONMIL;
-      choice->choice = unit_type; /* default */
-      ai_choose_role_unit(pplayer, pcity, choice, L_FERRYBOAT, -want);
     }
+    /* Terrain improvers don't use boats (yet) */
   }
 
   /* Find out desire for city founders */
@@ -1014,6 +1005,7 @@
       choice->want = 0 - want;
       choice->type = CT_NONMIL;
       choice->choice = unit_type; /* default */
+      choice->need_boat = TRUE;
       ai_choose_role_unit(pplayer, pcity, choice, L_FERRYBOAT, -want);
     }
   }

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