[Freeciv-Dev] (PR#9552) Bug: Air units sentry
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9552 >
> [chrisk - Sat Nov 20 11:58:52 2004]:
>
> On Sat, Nov 20, 2004 at 12:35:28AM -0800, Jason Short wrote:
> >
> > > It is possible to sentry air units (missiles in this case) on
> places
> > > (carrier on the ocean in this case) where they can't live and go
> out of
> > > fuel. This is irritating.
> > >
> > > Since the current implementation of load/unload does not load
> sentried
> > > units
> > > automatically, this isn't useful at all.
> >
> > Indeed.
> >
> > I thought of just changing the client to not let it do this. But on
> > reflection I think we can just have this as a game rule: units are
> not
> > allowed to sentry or remain sentried on tiles that they will die on.
> >
> > This patch makes that change. Can you confirm that the behavior is
> better?
>
> Uhm, there are some problems. I tested with attached savegame, which
> is
> from before the load/unload change, though, I think.
Ouch.
> Missiles on submarines and airplanes on carriers are not and cannot be
> sentried (they most probably were in the savegame).
Yeah, can_unit_survive_at_tile ignores whether the unit is transported.
Which I should have known. Here is a patch that fixes it.
> Unload command is possible, but with no result.
>
> Load is not possible.
Now that is odd. Are you sure?
> Missiles can live on a carrier.
Isn't that the way it's supposed to be?
jason
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.220
diff -u -r1.220 unit.c
--- common/unit.c 18 Oct 2004 22:40:02 -0000 1.220
+++ common/unit.c 20 Nov 2004 17:19:58 -0000
@@ -923,6 +923,11 @@
&& !is_ocean(ptile->terrain));
case ACTIVITY_SENTRY:
+ if (!can_unit_survive_at_tile(punit, punit->tile)
+ && punit->transported_by == -1) {
+ /* Don't let units sentry on tiles they will die on. */
+ return FALSE;
+ }
return TRUE;
case ACTIVITY_RAILROAD:
|
|