Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13320) Patch: Road want fix
Home

[Freeciv-Dev] (PR#13320) Patch: Road want fix

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13320) Patch: Road want fix
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Thu, 23 Jun 2005 11:47:44 -0700
Reply-to: bugs@xxxxxxxxxxx

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


  According to road_bonus() comment, road is valued as means to connect 
cities, not as source of trade bonus. Still, evaluate_improvements() 
values roads more in worked tiles than in non-worked tiles. Attached 
patch fixes that.


  - ML


diff -Nurd -X.diff_ignore freeciv/server/settlers.c freeciv/server/settlers.c
--- freeciv/server/settlers.c   2005-06-23 19:09:39.078125000 +0300
+++ freeciv/server/settlers.c   2005-06-23 20:43:32.609375000 +0300
@@ -908,23 +908,25 @@
                                                    S_LAST, ptile)) {
              int extra = 0;
              int base_value = pcity->ai.act_value[act][cx][cy];
+              bool consider_in_use = in_use;
 
              time = mv_turns + get_turns_for_activity_at(punit, act, ptile);
              
              if (act == ACTIVITY_ROAD) {
                extra = road_bonus(ptile, S_ROAD) * 5;
+                consider_in_use = TRUE;
                if (can_rr) {
                  /* if we can make railroads eventually, consider making
                   * road here, and set extras and time to to consider
                   * railroads in main consider_settler_action call */
-                 consider_settler_action(pplayer, ACTIVITY_ROAD,
-                               extra,
-                               pcity->ai.act_value[ACTIVITY_ROAD][cx][cy], 
-                               oldv, in_use, mv_turns, time,
-                               &best_newv, &best_oldv, travel_time,
-                               best_act, best_tile,
-                               ptile);
-                 
+                  consider_settler_action(pplayer, ACTIVITY_ROAD,
+                                          extra,
+                                          
pcity->ai.act_value[ACTIVITY_ROAD][cx][cy],
+                                          oldv, consider_in_use, mv_turns, 
time,
+                                          &best_newv, &best_oldv, travel_time,
+                                          best_act, best_tile,
+                                          ptile);
+
                  base_value
                    = pcity->ai.act_value[ACTIVITY_RAILROAD][cx][cy];
                  
@@ -934,21 +936,22 @@
                }
              } else if (act == ACTIVITY_RAILROAD) {
                extra = road_bonus(ptile, S_RAILROAD) * 3;
+                consider_in_use = TRUE;
              } else if (act == ACTIVITY_FALLOUT) {
                extra = pplayer->ai.frost;
              } else if (act == ACTIVITY_POLLUTION) {
                extra = pplayer->ai.warmth;
-             }    
-             
-             consider_settler_action(pplayer, act,
-                                     extra, 
-                                     base_value, oldv, 
-                                     in_use,
-                                     mv_turns, time,
-                                     &best_newv, &best_oldv, travel_time,
-                                     best_act, best_tile,
-                                     ptile);
-             
+             }
+
+              consider_settler_action(pplayer, act,
+                                      extra,
+                                      base_value, oldv,
+                                      consider_in_use,
+                                      mv_turns, time,
+                                      &best_newv, &best_oldv, travel_time,
+                                      best_act, best_tile,
+                                      ptile);
+
            } /* endif: can the worker perform this action */
          } activity_type_iterate_end;
        } /* endif: can we finish sooner than current worker, if any? */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13320) Patch: Road want fix, Marko Lindqvist <=