[Freeciv-Dev] (PR#7250) auto-settlers won't build mines over irrigation
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#7250) auto-settlers won't build mines over irrigation |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Mon, 17 May 2004 17:30:26 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7250 >
> [jdorje - Fri Jan 16 03:14:18 2004]:
>
> In the auto-settler code there's a check to see if there's already a
> conflicting improvement. If so, no new improvement will be built.
>
> But this is bad. Say I transform my irrigated grassland into a hills.
> I want my settlers to build a mine on it. The settlers should take into
> account the overall effect of the mining (-1 to food, +3 to shields) and
> count that against the cost of building the improvement. I think this
> part is already done.
And a patch.
The current behavior is clearly buggy and should be fixed.
jason
? eff
? flags
? data/flags
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.180
diff -u -r1.180 settlers.c
--- server/settlers.c 26 Feb 2004 03:24:16 -0000 1.180
+++ server/settlers.c 18 May 2004 00:27:00 -0000
@@ -584,20 +584,27 @@
return(m);
} else if((ptile->terrain==type->irrigation_result &&
!tile_has_special(ptile, S_IRRIGATION) &&
- !tile_has_special(ptile, S_MINE) && !(ptile->city) &&
+ !(ptile->city) &&
(is_wet_or_is_wet_cardinal_around(pplayer, mx, my)))) {
+ /* Irrigate the tile (replacing the mine if applicable) and calculate
+ * the result. */
+ map_clear_special(mx, my, S_MINE);
map_set_special(mx, my, S_IRRIGATION);
m = city_tile_value(pcity, cx, cy, 0, 0);
- map_clear_special(mx, my, S_IRRIGATION);
+ ptile->special = s;
+ assert(ptile->terrain == t);
return(m);
} else if((ptile->terrain==type->irrigation_result &&
tile_has_special(ptile, S_IRRIGATION) && !tile_has_special(ptile,
S_FARMLAND) &&
player_knows_techs_with_flag(pplayer, TF_FARMLAND) &&
- !tile_has_special(ptile, S_MINE) && !(ptile->city) &&
+ !(ptile->city) &&
(is_wet_or_is_wet_cardinal_around(pplayer, mx, my)))) {
+ /* Put farmland on the tile and calculate the result. */
+ assert(!tile_has_special(ptile, S_MINE));
map_set_special(mx, my, S_FARMLAND);
m = city_tile_value(pcity, cx, cy, 0, 0);
map_clear_special(mx, my, S_FARMLAND);
+ assert(ptile->terrain == t && ptile->special == s);
return(m);
} else return(-1);
}
@@ -609,13 +616,16 @@
{
int m;
struct tile *ptile = map_get_tile(mx, my);
+ enum tile_special_type s = ptile->special;
/* Don't replace existing infrastructure */
if ((ptile->terrain == T_HILLS || ptile->terrain == T_MOUNTAINS) &&
- !tile_has_special(ptile, S_IRRIGATION) && !tile_has_special(ptile,
S_MINE)) {
+ !tile_has_special(ptile, S_MINE)) {
+ map_clear_special(mx, my, S_IRRIGATION);
+ map_clear_special(mx, my, S_FARMLAND);
map_set_special(mx, my, S_MINE);
m = city_tile_value(pcity, cx, cy, 0, 0);
- map_clear_special(mx, my, S_MINE);
+ ptile->special = s;
return(m);
} else return(-1);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#7250) auto-settlers won't build mines over irrigation,
Jason Short <=
|
|