[Freeciv-Dev] Re: (PR#12381) Bug: Hitting "q" to create patrol route wit
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12381 >
Well, the reason is simple. Patrol isn't allowed for air units.
This patch adds a check in request_unit_patrol. I've also added a few
is_heli_unit checks to catch problems with helicoptor units (which don't
have is_air_unit set but have the same goto limitations).
For the development branch we should commit the air-goto patch I think.
-jason
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.160
diff -u -r1.160 control.c
--- client/control.c 23 Feb 2005 03:34:05 -0000 1.160
+++ client/control.c 1 Mar 2005 18:23:38 -0000
@@ -113,6 +113,8 @@
assert(punit != NULL || state == HOVER_NONE);
assert(state == HOVER_CONNECT || activity == ACTIVITY_LAST);
assert(state == HOVER_GOTO || order == ORDER_LAST);
+ assert(state != HOVER_PATROL
+ || !(is_air_unit(punit) || is_heli_unit(punit)));
draw_goto_line = TRUE;
if (punit)
hover_unit = punit->id;
@@ -1073,6 +1075,12 @@
if (!punit)
return;
+ if (is_air_unit(punit) || is_heli_unit(punit)) {
+ /* Same string as in do_unit_patrol_to. */
+ append_output_window(_("Sorry, airunit patrol not yet implemented."));
+ return;
+ }
+
if (hover_state != HOVER_PATROL) {
set_hover_state(punit, HOVER_PATROL, ACTIVITY_LAST, ORDER_LAST);
update_unit_info_label(punit);
@@ -1712,7 +1720,8 @@
**************************************************************************/
void do_unit_patrol_to(struct unit *punit, struct tile *ptile)
{
- if (is_air_unit(punit)) {
+ if (is_air_unit(punit) || is_heli_unit(punit)) {
+ /* Same string as in request_unit_patrol. */
append_output_window(_("Sorry, airunit patrol not yet implemented."));
return;
} else {
@@ -1736,7 +1745,7 @@
void do_unit_connect(struct unit *punit, struct tile *ptile,
enum unit_activity activity)
{
- if (is_air_unit(punit)) {
+ if (is_air_unit(punit) || is_heli_unit(punit)) {
append_output_window(_("Sorry, airunit connect "
"not yet implemented."));
} else {
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.227
diff -u -r1.227 unit.c
--- common/unit.c 10 Feb 2005 17:55:08 -0000 1.227
+++ common/unit.c 1 Mar 2005 18:23:39 -0000
@@ -1680,7 +1680,7 @@
int base_unsafe_terrain_loss_pct(const struct player *pplayer,
const struct unit *punit)
{
- return is_air_unit(punit) ? 0 : 15;
+ return (is_air_unit(punit) || is_heli_unit(punit)) ? 0 : 15;
}
/**************************************************************************
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.65
diff -u -r1.65 units.ruleset
--- data/default/units.ruleset 8 Dec 2004 14:36:22 -0000 1.65
+++ data/default/units.ruleset 1 Mar 2005 18:23:40 -0000
@@ -964,7 +964,7 @@
[unit_fighter]
name = _("Fighter")
move_type = "Air"
-tech_req = "Flight"
+tech_req = "None"
obsolete_by = "Stealth Fighter"
graphic = "u.fighter"
graphic_alt = "-"
@@ -972,7 +972,7 @@
sound_move_alt = "m_generic"
sound_fight = "f_fighter"
sound_fight_alt = "f_generic"
-build_cost = 60
+build_cost = 10
pop_cost = 0
attack = 4
defense = 3
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.322
diff -u -r1.322 unittools.c
--- server/unittools.c 23 Feb 2005 03:34:06 -0000 1.322
+++ server/unittools.c 1 Mar 2005 18:23:40 -0000
@@ -362,7 +362,7 @@
unit_name(punit->type));
}
}
- } else if ((!is_air_unit(punit))
+ } else if (!(is_air_unit(punit) || is_heli_unit(punit))
&& (myrand(100) < unit_loss_pct(pplayer,
punit->tile, punit))) {
/* All units may have a chance of dying if they are on TER_UNSAFE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: (PR#12381) Bug: Hitting "q" to create patrol route with air unit twice crashes the client,
Jason Short <=
|
|