[Freeciv-Dev] (PR#3989) Bug?: Using disband instead of add Caravan to ci
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=3989 >
> [ChrisK@xxxxxxxx - Sun Apr 13 14:45:47 2003]:
>
> CVS 13 APR 2003 GTK 1.2
>
> When I disband a caravan in a city building a wonder of the world,
> only 25 shields are added to the production.
>
> Either this is changed to 50, or the unit popup gets another button "Help
> build wonder" ...
Here's a patch. Please test.
jason
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.312
diff -u -r1.312 unithand.c
--- server/unithand.c 18 Nov 2004 04:17:58 -0000 1.312
+++ server/unithand.c 20 Nov 2004 23:09:01 -0000
@@ -322,25 +322,43 @@
if (!punit) {
return;
}
- pcity = map_get_city(punit->tile);
- if (!unit_flag(punit, F_UNDISBANDABLE)) { /* refuse to kill ourselves */
- if (pcity) {
+ if (unit_flag(punit, F_UNDISBANDABLE)) {
+ /* refuse to kill ourselves */
+ notify_player_ex(unit_owner(punit), punit->tile, E_NOEVENT,
+ _("Game: %s refuses to disband!"), unit_name(punit->type));
+ return;
+ }
+
+ pcity = map_get_city(punit->tile);
+ if (pcity) {
+ /* If you disband inside a city, it gives some shields to that city.
+ *
+ * Note: Nowadays it's possible to disband unit in allied city and
+ * your ally receives those shields. Should it be like this? Why not?
+ * That's why we must use city_owner instead of pplayer -- Zamar */
+
+ if (unit_flag(punit, F_HELP_WONDER)) {
+ /* Count this just like a caravan that was added to a wonder.
+ * However don't actually give the city the extra shields unless
+ * they are building a wonder (but switching to a wonder later in
+ * the turn will give the extra shields back). */
+ pcity->caravan_shields += unit_build_shield_cost(punit->type);
+ if (unit_can_help_build_wonder(punit, pcity)) {
+ pcity->shield_stock += unit_build_shield_cost(punit->type);
+ } else {
+ pcity->shield_stock += unit_disband_shields(punit->type);
+ }
+ } else {
pcity->shield_stock += unit_disband_shields(punit->type);
/* If we change production later at this turn. No penalty is added. */
pcity->disbanded_shields += unit_disband_shields(punit->type);
-
- /* Note: Nowadays it's possible to disband unit in allied city and
- * your ally receives those shields. Should it be like this? Why not?
- * That's why we must use city_owner instead of pplayer -- Zamar */
- send_city_info(city_owner(pcity), pcity);
}
- wipe_unit(punit);
- } else {
- notify_player_ex(unit_owner(punit), punit->tile, E_NOEVENT,
- _("Game: %s refuses to disband!"), unit_name(punit->type));
- return;
+
+ send_city_info(city_owner(pcity), pcity);
}
+
+ wipe_unit(punit);
}
/**************************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#3989) Bug?: Using disband instead of add Caravan to city gives less shields,
Jason Short <=
|
|